HttpService is a server side HTTP protocol handler based on
the classic (blocking) I/O model.
HttpService relies on HttpProcessor to generate mandatory
protocol headers for all outgoing messages and apply common, cross-cutting
message transformations to all incoming and outgoing messages, whereas
individual HttpRequestHandlers are expected to implement
application specific content generation and processing.
HttpService uses HttpRequestHandlerMapper to map
matching request handler for a particular request URI of an incoming HTTP
request.
HttpService can use optional HttpExpectationVerifier
to ensure that incoming requests meet server's expectations.
| Modifier and Type | Class and Description |
|---|---|
| private static class | HttpService.HttpRequestHandlerResolverAdapter
Deprecated
Do not use.
Adaptor class to transition from HttpRequestHandlerResolver to HttpRequestHandlerMapper.
|
| Modifier and Type | Field and Description |
|---|---|
| private volatile ConnectionReuseStrategy | |
| private volatile HttpExpectationVerifier | |
| private volatile HttpRequestHandlerMapper | |
| private volatile HttpParams | params
TODO: make all variables final in the next major version |
| private volatile HttpProcessor | |
| private volatile HttpResponseFactory |
| Access | Constructor and Description |
|---|---|
| public | HttpService(final HttpProcessor
the processor to use on requests and responses processor, final ConnectionReuseStrategy the connection reuse strategy connStrategy, final HttpResponseFactory the response factory responseFactory, final HttpRequestHandlerResolver the handler resolver. May be null. handlerResolver, final HttpExpectationVerifier the expectation verifier. May be null. expectationVerifier, final HttpParams the HTTP parameters params)
Create a new HTTP service.
|
| public | HttpService(final HttpProcessor
the processor to use on requests and responses processor, final ConnectionReuseStrategy the connection reuse strategy connStrategy, final HttpResponseFactory the response factory responseFactory, final HttpRequestHandlerResolver the handler resolver. May be null. handlerResolver, final HttpParams the HTTP parameters params)
Create a new HTTP service.
|
| public | HttpService(final HttpProcessor
the processor to use on requests and responses proc, final ConnectionReuseStrategy the connection reuse strategy connStrategy, final HttpResponseFactory the response factory responseFactory)
Create a new HTTP service.
|
| public | HttpService(final HttpProcessor
the processor to use on requests and responses processor, final ConnectionReuseStrategy the connection reuse strategy. If connStrategy, final HttpResponseFactory null
DefaultConnectionReuseStrategy#INSTANCE will be used.the response factory. If responseFactory, final HttpRequestHandlerMapper null
DefaultHttpResponseFactory#INSTANCE will be used.the handler mapper. May be null. handlerMapper, final HttpExpectationVerifier the expectation verifier. May be null. expectationVerifier)Create a new HTTP service. |
| public | HttpService(final HttpProcessor
the processor to use on requests and responses processor, final ConnectionReuseStrategy the connection reuse strategy. If connStrategy, final HttpResponseFactory null
DefaultConnectionReuseStrategy#INSTANCE will be used.the response factory. If responseFactory, final HttpRequestHandlerMapper null
DefaultHttpResponseFactory#INSTANCE will be used.the handler mapper. May be null. handlerMapper)Create a new HTTP service. |
| public | HttpService(final HttpProcessor
the processor to use on requests and responses processor, final HttpRequestHandlerMapper the handler mapper. May be null. handlerMapper)Create a new HTTP service. |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| protected void | doService(final HttpRequest
the HTTP request. request, final HttpResponse the HTTP response. response, final HttpContext the execution context. context)The default implementation of this method attempts to resolve an
|
| public HttpParams | |
| protected void | handleException(final HttpException
the exception. ex, final HttpResponse the HTTP response. response)Handles the given exception and generates an HTTP response to be sent back to the client to inform about the exceptional condition encountered in the course of the request processing. |
| public void | handleRequest(final HttpServerConnection
the active connection to the client conn, final HttpContext the actual execution context. context)Handles receives one HTTP request over the given connection within the given execution context and sends a response back to the client. |
| public void | setConnReuseStrategy(final ConnectionReuseStrategy connStrategy)
Deprecated
(4.1) set
ConnectionReuseStrategy using constructor
|
| public void | setExpectationVerifier(final HttpExpectationVerifier expectationVerifier)
Deprecated
(4.1) set
HttpExpectationVerifier using constructor
|
| public void | setHandlerResolver(final HttpRequestHandlerResolver handlerResolver)
Deprecated
(4.1) set
HttpRequestHandlerResolver using constructor
|
| public void | setHttpProcessor(final HttpProcessor processor)
Deprecated
(4.1) set
HttpProcessor using constructor
|
| public void | |
| public void | setResponseFactory(final HttpResponseFactory responseFactory)
Deprecated
(4.1) set
HttpResponseFactory using constructor
|
| connStrategy | back to summary |
|---|---|
| private volatile ConnectionReuseStrategy connStrategy | |
| expectationVerifier | back to summary |
|---|---|
| private volatile HttpExpectationVerifier expectationVerifier | |
| handlerMapper | back to summary |
|---|---|
| private volatile HttpRequestHandlerMapper handlerMapper | |
| params | back to summary |
|---|---|
| private volatile HttpParams params
Deprecated as a consequence of TODO: make all variables final in the next major version | |
| processor | back to summary |
|---|---|
| private volatile HttpProcessor processor | |
| responseFactory | back to summary |
|---|---|
| private volatile HttpResponseFactory responseFactory | |
| HttpService | back to summary |
|---|---|
| public HttpService(final HttpProcessor processor, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory, final HttpRequestHandlerResolver handlerResolver, final HttpExpectationVerifier expectationVerifier, final HttpParams params)
Deprecated Create a new HTTP service.
| |
| HttpService | back to summary |
|---|---|
| public HttpService(final HttpProcessor processor, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory, final HttpRequestHandlerResolver handlerResolver, final HttpParams params)
Deprecated Create a new HTTP service.
| |
| HttpService | back to summary |
|---|---|
| public HttpService(final HttpProcessor proc, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory)
Deprecated Create a new HTTP service.
| |
| HttpService | back to summary |
|---|---|
| public HttpService(final HttpProcessor processor, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory, final HttpRequestHandlerMapper handlerMapper, final HttpExpectationVerifier expectationVerifier) Create a new HTTP service.
| |
| HttpService | back to summary |
|---|---|
| public HttpService(final HttpProcessor processor, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory, final HttpRequestHandlerMapper handlerMapper) Create a new HTTP service.
| |
| HttpService | back to summary |
|---|---|
| public HttpService(final HttpProcessor processor, final HttpRequestHandlerMapper handlerMapper) Create a new HTTP service.
| |
| canResponseHaveBody | back to summary |
|---|---|
| private boolean canResponseHaveBody(final HttpRequest request, final HttpResponse response) | |
| doService | back to summary |
|---|---|
| protected void doService(final HttpRequest request, final HttpResponse response, final HttpContext context) throws HttpException, IOException The default implementation of this method attempts to resolve an
Super-classes can override this method in order to provide a custom implementation of the request processing logic.
| |
| getParams | back to summary |
|---|---|
| public HttpParams getParams()
Deprecated (4.3) no longer used.
| |
| handleException | back to summary |
|---|---|
| protected void handleException(final HttpException ex, final HttpResponse response) Handles the given exception and generates an HTTP response to be sent back to the client to inform about the exceptional condition encountered in the course of the request processing.
| |
| handleRequest | back to summary |
|---|---|
| public void handleRequest(final HttpServerConnection conn, final HttpContext context) throws IOException, HttpException Handles receives one HTTP request over the given connection within the given execution context and sends a response back to the client.
| |
| setConnReuseStrategy | back to summary |
|---|---|
| public void setConnReuseStrategy(final ConnectionReuseStrategy connStrategy)
Deprecated (4.1) set
| |
| setExpectationVerifier | back to summary |
|---|---|
| public void setExpectationVerifier(final HttpExpectationVerifier expectationVerifier)
Deprecated (4.1) set
| |
| setHandlerResolver | back to summary |
|---|---|
| public void setHandlerResolver(final HttpRequestHandlerResolver handlerResolver)
Deprecated (4.1) set
| |
| setHttpProcessor | back to summary |
|---|---|
| public void setHttpProcessor(final HttpProcessor processor)
Deprecated (4.1) set
| |
| setParams | back to summary |
|---|---|
| public void setParams(final HttpParams params)
Deprecated (4.1) set
| |
| setResponseFactory | back to summary |
|---|---|
| public void setResponseFactory(final HttpResponseFactory responseFactory)
Deprecated (4.1) set
| |
Deprecated
Do not use.
| Modifier and Type | Field and Description |
|---|---|
| private final HttpRequestHandlerResolver | resolver
Deprecated
as a consequence of
HttpRequestHandlerResolver being deprecated.
|
| Access | Constructor and Description |
|---|---|
| public | HttpRequestHandlerResolverAdapter(final HttpRequestHandlerResolver resolver)
Deprecated
as a consequence of
HttpRequestHandlerResolver being deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
| public HttpRequestHandler | lookup(final HttpRequest
the request to map to a handler request)Implements org. |
| resolver | back to summary |
|---|---|
| private final HttpRequestHandlerResolver resolver
Deprecated as a consequence of | |
| HttpRequestHandlerResolverAdapter | back to summary |
|---|---|
| public HttpRequestHandlerResolverAdapter(final HttpRequestHandlerResolver resolver)
Deprecated as a consequence of | |
| lookup | back to summary |
|---|---|
| public HttpRequestHandler lookup(final HttpRequest request) Implements org. Doc from org. Looks up a handler matching the given request.
| |