Class DefaultSimpleProxyEngine

java.lang.Object
de.hybris.platform.xyformsservices.proxy.orbeonservices.impl.DefaultSimpleProxyEngine
All Implemented Interfaces:
ProxyEngine

public class DefaultSimpleProxyEngine extends Object implements ProxyEngine
ProxyEngine implementation for Orbeon.

It uses a CookieManager to mantain orbeon's session.

  • Field Details

  • Constructor Details

    • DefaultSimpleProxyEngine

      public DefaultSimpleProxyEngine()
  • Method Details

    • extractNamespace

      public String extractNamespace(javax.servlet.http.HttpServletRequest request)
      Extracts the namespace coming from client.
      Specified by:
      extractNamespace in interface ProxyEngine
      Parameters:
      request -
    • proxy

      public void proxy(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String namespace, String url, boolean forceGetMethod, Map<String,String> headers) throws ProxyException
      Description copied from interface: ProxyEngine
      Proxies content
      Specified by:
      proxy in interface ProxyEngine
      Parameters:
      request - The HttpServletRequest associated to the call
      response - The HttpServletResponse associated to the call
      namespace - Used for HTML element's id generation
      url - The url to be called
      forceGetMethod - Useful when proxying content, when false it uses the same method used in the original request.
      headers - Extra headers to be passed to the connection, useful for authentication headers.
      Throws:
      ProxyException
    • rewriteLocation

      protected void rewriteLocation(HttpURLConnection conn, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String namespace, String url) throws UrlRewriterException
      Throws:
      UrlRewriterException
    • getHostPart

      protected String getHostPart(String url)
      Gets the host part of an URL, including protocol, host, port with no trailing slash.
      Parameters:
      url -
    • getPrefixFromRequest

      protected String getPrefixFromRequest(javax.servlet.http.HttpServletRequest request)
      Gets the prefix from the request URI address.
      Parameters:
      request -
    • connect

      protected HttpURLConnection connect(javax.servlet.http.HttpServletRequest request, String url, String method, Map<String,String> headers) throws URISyntaxException, MalformedURLException, IOException, org.apache.http.cookie.MalformedCookieException
      Stablishes an HTTP connection with the given URL.
      Parameters:
      request - Request to get headers from.
      url - HTTP Address to be connected.
      method - request method for orbeon
      Throws:
      URISyntaxException - If the URI is not well formed
      MalformedURLException - If the URL is not well formed
      IOException - If there is a connection problem with the remote server.
      org.apache.http.cookie.MalformedCookieException - If there is a problem when dealing with Cookies
    • isServerError

      protected boolean isServerError(int sc)
      True if the status code represents an error on the server side
      Parameters:
      sc -
    • isTextFile

      protected boolean isTextFile(String contentType)
      Returns true if the given contentType refers to a text file.
      Parameters:
      contentType -
    • sendRequestHeaders

      protected void sendRequestHeaders(Set<String> headers, javax.servlet.http.HttpServletRequest request, HttpURLConnection conn)
      Sends headers from the request to the remote server.
      Parameters:
      headers - headers that should be sent
      request - Request to take header values from.
      conn - Remote server connection
    • sendResponseHeaders

      protected void sendResponseHeaders(Set<String> headers, HttpURLConnection conn, javax.servlet.http.HttpServletResponse response)
      Get headers from remote connection and copies them back to the current response.
      Parameters:
      headers - headers that should be copied back
      conn - Remote server connection
      response - Response to copy header values to.
    • setCookieManager

      public void setCookieManager(CookieManager cookieManager)
    • setUrlRewriter

      public void setUrlRewriter(UrlRewriter urlRewriter)
    • setHeadersTo

      public void setHeadersTo(List<String> headersTo)
    • setHeadersFrom

      public void setHeadersFrom(List<String> headersFrom)
    • getConfigurationService

      protected ConfigurationService getConfigurationService()
    • setConfigurationService

      public void setConfigurationService(ConfigurationService configurationService)