Package org.apache.http.protocol
Class HttpService
java.lang.Object
org.apache.http.protocol.HttpService
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.
- Since:
- 4.0
-
Constructor Summary
ConstructorsConstructorDescriptionHttpService(HttpProcessor proc, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory) Deprecated.HttpService(HttpProcessor processor, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, HttpRequestHandlerMapper handlerMapper) Create a new HTTP service.HttpService(HttpProcessor processor, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, HttpRequestHandlerMapper handlerMapper, HttpExpectationVerifier expectationVerifier) Create a new HTTP service.HttpService(HttpProcessor processor, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, HttpRequestHandlerResolver handlerResolver, HttpParams params) HttpService(HttpProcessor processor, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, HttpRequestHandlerResolver handlerResolver, HttpExpectationVerifier expectationVerifier, HttpParams params) HttpService(HttpProcessor processor, HttpRequestHandlerMapper handlerMapper) Create a new HTTP service. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.(4.3) no longer used.voidhandleRequest(HttpServerConnection conn, HttpContext context) Handles receives one HTTP request over the given connection within the given execution context and sends a response back to the client.voidsetConnReuseStrategy(ConnectionReuseStrategy connStrategy) Deprecated.(4.1) setConnectionReuseStrategyusing constructorvoidsetExpectationVerifier(HttpExpectationVerifier expectationVerifier) Deprecated.(4.1) setHttpExpectationVerifierusing constructorvoidsetHandlerResolver(HttpRequestHandlerResolver handlerResolver) Deprecated.(4.1) setHttpRequestHandlerResolverusing constructorvoidsetHttpProcessor(HttpProcessor processor) Deprecated.(4.1) setHttpProcessorusing constructorvoidsetParams(HttpParams params) Deprecated.(4.1) setHttpResponseFactoryusing constructorvoidsetResponseFactory(HttpResponseFactory responseFactory) Deprecated.(4.1) setHttpResponseFactoryusing constructor
-
Constructor Details
-
HttpService
@Deprecated public HttpService(HttpProcessor processor, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, HttpRequestHandlerResolver handlerResolver, HttpExpectationVerifier expectationVerifier, HttpParams params) Deprecated.Create a new HTTP service.- Parameters:
processor- the processor to use on requests and responsesconnStrategy- the connection reuse strategyresponseFactory- the response factoryhandlerResolver- the handler resolver. May be null.expectationVerifier- the expectation verifier. May be null.params- the HTTP parameters- Since:
- 4.1
-
HttpService
@Deprecated public HttpService(HttpProcessor processor, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, HttpRequestHandlerResolver handlerResolver, HttpParams params) Deprecated.Create a new HTTP service.- Parameters:
processor- the processor to use on requests and responsesconnStrategy- the connection reuse strategyresponseFactory- the response factoryhandlerResolver- the handler resolver. May be null.params- the HTTP parameters- Since:
- 4.1
-
HttpService
@Deprecated public HttpService(HttpProcessor proc, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory) Deprecated.Create a new HTTP service.- Parameters:
proc- the processor to use on requests and responsesconnStrategy- the connection reuse strategyresponseFactory- the response factory
-
HttpService
public HttpService(HttpProcessor processor, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, HttpRequestHandlerMapper handlerMapper, HttpExpectationVerifier expectationVerifier) Create a new HTTP service.- Parameters:
processor- the processor to use on requests and responsesconnStrategy- the connection reuse strategy. IfnullDefaultConnectionReuseStrategy.INSTANCEwill be used.responseFactory- the response factory. IfnullDefaultHttpResponseFactory.INSTANCEwill be used.handlerMapper- the handler mapper. May be null.expectationVerifier- the expectation verifier. May be null.- Since:
- 4.3
-
HttpService
public HttpService(HttpProcessor processor, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, HttpRequestHandlerMapper handlerMapper) Create a new HTTP service.- Parameters:
processor- the processor to use on requests and responsesconnStrategy- the connection reuse strategy. IfnullDefaultConnectionReuseStrategy.INSTANCEwill be used.responseFactory- the response factory. IfnullDefaultHttpResponseFactory.INSTANCEwill be used.handlerMapper- the handler mapper. May be null.- Since:
- 4.3
-
HttpService
Create a new HTTP service.- Parameters:
processor- the processor to use on requests and responseshandlerMapper- the handler mapper. May be null.- Since:
- 4.3
-
-
Method Details
-
setHttpProcessor
Deprecated.(4.1) setHttpProcessorusing constructor -
setConnReuseStrategy
Deprecated.(4.1) setConnectionReuseStrategyusing constructor -
setResponseFactory
Deprecated.(4.1) setHttpResponseFactoryusing constructor -
setParams
Deprecated.(4.1) setHttpResponseFactoryusing constructor -
setHandlerResolver
Deprecated.(4.1) setHttpRequestHandlerResolverusing constructor -
setExpectationVerifier
Deprecated.(4.1) setHttpExpectationVerifierusing constructor -
getParams
Deprecated.(4.3) no longer used. -
handleRequest
public void handleRequest(HttpServerConnection conn, 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.- Parameters:
conn- the active connection to the clientcontext- the actual execution context.- Throws:
IOException- in case of an I/O error.HttpException- in case of HTTP protocol violation or a processing problem.
-
HttpService(HttpProcessor, ConnectionReuseStrategy, HttpResponseFactory, HttpRequestHandlerResolver, HttpParams)