Interface UriMapper


  • public interface UriMapper
    A function that maps an incoming request to a target URI.
    Version:
    1.0
    Author:
    Daniel Flower
    • Method Detail

      • mapFrom

        java.net.URI mapFrom​(io.muserver.MuRequest request)
                      throws java.lang.Exception
        Gets a URI to proxy to based on the given request.
        Parameters:
        request - The client request to potentially proxy.
        Returns:
        A URI if this request should be proxied; otherwise null.
        Throws:
        java.lang.Exception - Unhandled exceptions will result in an HTTP 500 error being sent to the client
      • toDomain

        static UriMapper toDomain​(java.net.URI targetDomain)
        Creates a mapper that directs all requests to a new target domain.
        Parameters:
        targetDomain - The target URI to send proxied requests to. Any path or query strings will be ignored.
        Returns:
        Returns a URI mapper that can be passed to ReverseProxyBuilder.withUriMapper(UriMapper)