Package org.takes.tk

Class TkProxy

  • All Implemented Interfaces:
    Take

    public final class TkProxy
    extends Object
    implements Take
    Take that proxies requests to another destination.

    The class is immutable and thread-safe.

    Since:
    0.25
    • Constructor Detail

      • TkProxy

        public TkProxy​(URI tgt)
        Ctor.
        Parameters:
        tgt - Target to which requests are forwarded
      • TkProxy

        public TkProxy​(String tgt)
        Ctor.
        Parameters:
        tgt - Target to which requests are forwarded
      • TkProxy

        public TkProxy​(String tgt,
                       String mark)
        Ctor.
        Parameters:
        tgt - Target to which requests are forwarded
        mark - Marker (text label) to add to the HTTP header
      • TkProxy

        public TkProxy​(URI tgt,
                       String mark)
        Ctor.

        The target parameter takes the destination URL to which requests are proxied. Some valid examples:

        • http://example.com
        • http://www.example.com
        • https://example.com:8080
        • https://example.com/x/y
        Parameters:
        tgt - Target to which requests are forwarded
        mark - Marker (text label) to add to the HTTP header
    • Method Detail

      • act

        public Response act​(Request req)
                     throws Exception
        Description copied from interface: Take
        Convert request to response.
        Specified by:
        act in interface Take
        Parameters:
        req - Request to process
        Returns:
        Response
        Throws:
        Exception - If fails