Class LoopbackRestServerImpl

    • Constructor Detail

      • LoopbackRestServerImpl

        public LoopbackRestServerImpl()
    • Method Detail

      • onHttpRequest

        public void onHttpRequest​(java.net.InetSocketAddress aLocalAddress,
                                  java.net.InetSocketAddress aClientAddress,
                                  org.refcodes.net.HttpMethod aHttpMethod,
                                  org.refcodes.net.Url aUrl,
                                  org.refcodes.net.RequestHeaderFields aRequestHeaderFields,
                                  java.io.InputStream aHttpInputStream,
                                  org.refcodes.net.HttpServerResponse aHttpServerResponse)
                           throws org.refcodes.net.HttpStatusException
        Extensions of this class disect an incoming request and pass it to this method for doing the actual invocation of the registered RestEndpoint instances. An extension might call this method from inside an event (request) handler.
        Specified by:
        onHttpRequest in interface LoopbackRestServer
        Overrides:
        onHttpRequest in class AbstractRestServer
        Parameters:
        aLocalAddress - The host and port of your REST service.
        aClientAddress - The host and port for the caller.
        aHttpMethod - The HttpMethod of the request.
        aUrl - The Url from which to take the URL specific data.
        aRequestHeaderFields - The Header-Fields (HeaderFields) belonging to the request.
        aHttpInputStream - The body passed by the request.
        aHttpServerResponse - A HttpServerResponse instance to be used by the extension to produce an according HTTP-Response.
        Throws:
        org.refcodes.net.HttpStatusException - thrown in case of an RestEndpoint responsible for the given request encountered a problem or none RestEndpoint felt responsible to produce a HttpServerResponse.
      • onHttpRequest

        public void onHttpRequest​(java.net.InetSocketAddress aLocalAddress,
                                  java.net.InetSocketAddress aClientAddress,
                                  org.refcodes.net.HttpMethod aHttpMethod,
                                  org.refcodes.net.Url aUrl,
                                  org.refcodes.net.RequestHeaderFields aRequestHeaderFields,
                                  java.lang.String aHttpBody,
                                  org.refcodes.net.HttpServerResponse aHttpServerResponse)
                           throws org.refcodes.net.HttpStatusException
        Invoke this method to simulate a REST request to be handled by the according registered RestEndpoint instances:
        Specified by:
        onHttpRequest in interface LoopbackRestServer
        Parameters:
        aLocalAddress - the local address
        aClientAddress - the client address
        aHttpMethod - The method for the simulated REST request to be used
        aUrl - The query string part of the request.
        aRequestHeaderFields - The simulated REST request's Header-Fields to be used
        aHttpBody - The raw body for the simulated REST request to be used.
        aHttpServerResponse - The HttpServerResponse to be filled with the complete result of processing the request.
        Throws:
        org.refcodes.net.HttpStatusException - the http status exception