Class HTTPProxy


  • public class HTTPProxy
    extends Object
    • Constructor Detail

      • HTTPProxy

        public HTTPProxy()
    • Method Detail

      • pipeServiceRequest

        public static javax.ws.rs.core.Response pipeServiceRequest​(String remoteWMSUrl,
                                                                   HttpMethod method,
                                                                   javax.ws.rs.core.MultivaluedMap<String,​String> queryParams,
                                                                   Map<String,​String> headers,
                                                                   String body,
                                                                   HTTPBasicAuthorizationFactory authFactory,
                                                                   boolean followRedirects)
                                                            throws Exception
        Pipes a request to a remote service. Returns all the body and header information, that was sent from the remote service. See also georepo-server proxy stuff. TODO: Should be tested for different response types, if requested service is not a WMS service.
        Parameters:
        remoteWMSUrl -
        method -
        queryParams -
        authFactory -
        Returns:
        Throws:
        Exception
      • pipeServiceRequest

        public static javax.ws.rs.core.Response pipeServiceRequest​(HTTPRequestParams params,
                                                                   boolean toExternal,
                                                                   boolean fix401)
                                                            throws Exception
        Parameters:
        params -
        toExternal -
        fix401 -
        Returns:
        Throws:
        Exception
      • finish

        public static javax.ws.rs.core.Response finish​(de.narimo.commons.http.URLResponse response,
                                                       boolean responseAsStream)
                                                throws Exception
        Finish piping a http response by converting to javax.ws.rs.core.Response
        Parameters:
        response -
        responseAsStream -
        Returns:
        Throws:
        Exception
      • finish

        public static javax.ws.rs.core.Response finish​(de.narimo.commons.http.URLResponse response,
                                                       boolean responseAsStream,
                                                       boolean fix401)
                                                throws Exception
        Some (browser) clients are not able to handle 401 responses. We can support custom apps to find a 4010 instead of a 401 code.
        Parameters:
        response -
        responseAsStream -
        fix401 -
        Returns:
        Throws:
        Exception
      • removeHeader

        public static void removeHeader​(javax.ws.rs.core.MultivaluedMap<String,​String> inputHeaders,
                                        String omit)
      • checkHeaders

        public static void checkHeaders​(javax.ws.rs.core.MultivaluedMap<String,​String> inputHeaders)
      • setHeader

        public static javax.ws.rs.core.MultivaluedMap<String,​String> setHeader​(javax.ws.rs.core.MultivaluedMap<String,​String> inputHeaders,
                                                                                     String headerKey,
                                                                                     String headerValue)
      • setHeader

        public static javax.ws.rs.core.MultivaluedMap<String,​String> setHeader​(javax.ws.rs.core.MultivaluedMap<String,​String> inputHeaders,
                                                                                     String headerKey,
                                                                                     List<String> headerValue)
      • pipeOutgoingHeaders

        public static Map<String,​List<String>> pipeOutgoingHeaders​(javax.ws.rs.core.HttpHeaders requestHeaders,
                                                                         Map<String,​List<String>> responseHeaders,
                                                                         boolean enableCORS)
        aka GeoserverHTTPProxy.pipeGeoserverHeaders Will create a new map of outgoing headers as they otherwise could not be modified.
        Parameters:
        responseHeaders -
        Returns:
      • getHeaders

        public static Map<String,​String> getHeaders​(javax.servlet.http.HttpServletRequest request)
        Puts all headers from a HttpServletRequest. Header keys are stored in lower-case in the resulting map.
        Parameters:
        request -
        Returns: