Class WebProxy

  • All Implemented Interfaces:
    URIResolverHandler, org.mortbay.component.LifeCycle, org.mortbay.jetty.Handler

    public class WebProxy
    extends org.mortbay.jetty.handler.DefaultHandler
    implements URIResolverHandler
    The WebProxy is the ONLY viewerproxy class that interfaces with the Jetty classes. This class packages all requests up nicely as calls to uriResolver.lookup().

    In particular, it handles the control of the Jetty server that the Proxy server builds on.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  WebProxy.HttpRequest
      A wrapper around the Jetty HttpRequest, giving the simple Request interface used in our URIResolvers.
      static class  WebProxy.HttpResponse
      A wrapper around the Jetty HttpResponse, giving the simple Response interface used in our URIResolvers.
      • Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle

        org.mortbay.component.LifeCycle.Listener
    • Field Summary

      • Fields inherited from class org.mortbay.jetty.handler.AbstractHandler

        _string
      • Fields inherited from class org.mortbay.component.AbstractLifeCycle

        _listeners
      • Fields inherited from interface org.mortbay.jetty.Handler

        ALL, DEFAULT, ERROR, FORWARD, INCLUDE, REQUEST
    • Constructor Summary

      Constructors 
      Constructor Description
      WebProxy​(URIResolver uriResolver)
      Initialises a new web proxy, which delegates lookups to the given uri resolver.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void handle​(String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int dispatch)
      Handle an HTTP request.
      void kill()
      Shut down this server.
      void setURIResolver​(URIResolver ur)
      Sets the current URIResolver.
      • Methods inherited from class org.mortbay.jetty.handler.DefaultHandler

        getServeIcon, setServeIcon
      • Methods inherited from class org.mortbay.jetty.handler.AbstractHandler

        destroy, doStart, doStop, getServer, setServer, toString
      • Methods inherited from class org.mortbay.component.AbstractLifeCycle

        addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
      • Methods inherited from interface org.mortbay.component.LifeCycle

        addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
    • Constructor Detail

      • WebProxy

        public WebProxy​(URIResolver uriResolver)
        Initialises a new web proxy, which delegates lookups to the given uri resolver. The WebProxy will start listening on port given in settings.
        Parameters:
        uriResolver - The uriResolver used to handle lookups in the proxy.
        Throws:
        IOFailure - on trouble starting the proxy server.
        ArgumentNotValid - on null uriResolver.
    • Method Detail

      • handle

        public void handle​(String target,
                           javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response,
                           int dispatch)
        Handle an HTTP request. Overrides default behaviour of Jetty. This will forward the URI and response to the wrapped URI resolver. Note that the server will NOT force the return value to be the one returned by the uri resolver, rather it will use the one the uri resolver has set in the response object.

        Exceptions will generate an internal server error-page with the details.

        Specified by:
        handle in interface org.mortbay.jetty.Handler
        Overrides:
        handle in class org.mortbay.jetty.handler.DefaultHandler
        Parameters:
        target - URL or name for request. Not used
        request - The original request, including URL
        response - The object that receives the result
      • kill

        public void kill()
        Shut down this server.