Class DefaultProxyService

  • All Implemented Interfaces:
    ProxyService

    public class DefaultProxyService
    extends java.lang.Object
    implements ProxyService
    Default implementation for proxy service.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String extractNamespace​(javax.servlet.http.HttpServletRequest request)
      Extracts the namespace from the client request.
      java.util.Map<java.lang.String,​java.lang.String> getExtraHeaders()
      Returns the extra headers configured for the application.
      java.lang.String getNextRandomNamespace()
      Generates a random namespace.
      void proxy​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String namespace, java.lang.String url, boolean forceGetMethod, java.util.Map<java.lang.String,​java.lang.String> headers)
      Proxies content.
      java.lang.String rewriteURL​(java.lang.String url, boolean embeddable)
      Rewrites a URL to be used for the proxy.
      java.lang.String rewriteURL​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId)
      Rewrites a URL to be used for the proxy.
      java.lang.String rewriteURL​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId, boolean editable)
      Rewrites a URL to be used for the proxy.
      void setExtraHeaders​(java.util.Map<java.lang.String,​java.lang.String> extraHeaders)  
      void setOrbeonAddress​(java.lang.String orbeonAddress)  
      void setProxyEngine​(ProxyEngine proxyEngine)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ORBEON_WEB_PREFIX

        protected static final java.lang.String ORBEON_WEB_PREFIX
        See Also:
        Constant Field Values
      • orbeonAddress

        protected java.lang.String orbeonAddress
      • extraHeaders

        protected java.util.Map<java.lang.String,​java.lang.String> extraHeaders
    • Constructor Detail

      • DefaultProxyService

        public DefaultProxyService()
    • Method Detail

      • rewriteURL

        public java.lang.String rewriteURL​(java.lang.String url,
                                           boolean embeddable)
                                    throws java.net.MalformedURLException
        Description copied from interface: ProxyService
        Rewrites a URL to be used for the proxy.
        Specified by:
        rewriteURL in interface ProxyService
        Parameters:
        url - the url path to be rewritten
        embeddable - the flag that specifies if the rewriter should produce a URL that produces embeddable content
        Returns:
        the URL of the proxy
        Throws:
        java.net.MalformedURLException - if result URL is invalid
      • rewriteURL

        public java.lang.String rewriteURL​(java.lang.String applicationId,
                                           java.lang.String formId,
                                           java.lang.String formDataId,
                                           boolean editable)
                                    throws java.net.MalformedURLException
        Description copied from interface: ProxyService
        Rewrites a URL to be used for the proxy.
        Specified by:
        rewriteURL in interface ProxyService
        Parameters:
        applicationId - the application Id
        formId - the form Id
        formDataId - the form data Id
        editable - the flag that specifies whether form should be editable or not
        Returns:
        the URL of the proxy
        Throws:
        java.net.MalformedURLException - if result URL is invalid
      • rewriteURL

        public java.lang.String rewriteURL​(java.lang.String applicationId,
                                           java.lang.String formId,
                                           java.lang.String formDataId)
                                    throws java.net.MalformedURLException
        Description copied from interface: ProxyService
        Rewrites a URL to be used for the proxy.
        Specified by:
        rewriteURL in interface ProxyService
        Parameters:
        applicationId - the application Id
        formId - the form Id
        formDataId - the form data Id
        Returns:
        the URL of the proxy
        Throws:
        java.net.MalformedURLException - if result URL is invalid
      • getNextRandomNamespace

        public java.lang.String getNextRandomNamespace()
        Description copied from interface: ProxyService
        Generates a random namespace.
        Specified by:
        getNextRandomNamespace in interface ProxyService
        Returns:
        the random namespace string
      • proxy

        public void proxy​(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response,
                          java.lang.String namespace,
                          java.lang.String url,
                          boolean forceGetMethod,
                          java.util.Map<java.lang.String,​java.lang.String> headers)
                   throws ProxyException
        Description copied from interface: ProxyService
        Proxies content.
        Specified by:
        proxy in interface ProxyService
        Parameters:
        request - the HttpServletRequest associated to the call
        response - the HttpServletResponse associated to the call
        namespace - the namespace for HTML element's id generation
        url - the url to be called
        forceGetMethod - the flag for specifying if only "GET" method should be used, useful when proxying content
        headers - extra headers to be passed to the proxy service
        Throws:
        ProxyException - if request cannot be proxied
      • extractNamespace

        public java.lang.String extractNamespace​(javax.servlet.http.HttpServletRequest request)
        Description copied from interface: ProxyService
        Extracts the namespace from the client request.
        Specified by:
        extractNamespace in interface ProxyService
        Parameters:
        request - the request to get namespace from
        Returns:
        the extracted namespace
      • setOrbeonAddress

        public void setOrbeonAddress​(java.lang.String orbeonAddress)
                              throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException
      • getExtraHeaders

        public java.util.Map<java.lang.String,​java.lang.String> getExtraHeaders()
        Description copied from interface: ProxyService
        Returns the extra headers configured for the application.
        Specified by:
        getExtraHeaders in interface ProxyService
        Returns:
        the extra headers as map
      • setExtraHeaders

        public void setExtraHeaders​(java.util.Map<java.lang.String,​java.lang.String> extraHeaders)
      • setProxyEngine

        public void setProxyEngine​(ProxyEngine proxyEngine)