Class HttpRequestHandlerServlet
- java.lang.Object
- javax.servlet.GenericServlet
- javax.servlet.http.HttpServlet
- org.springframework.web.context.support.HttpRequestHandlerServlet
- All Implemented Interfaces:
Serializable
,Servlet
,ServletConfig
public class HttpRequestHandlerServlet extends HttpServlet
Simple HttpServlet that delegates to anHttpRequestHandler
bean defined in Spring's root web application context. The target bean name must match the HttpRequestHandlerServlet servlet-name as defined inweb.xml
.This can for example be used to expose a single Spring remote exporter, such as
HttpInvokerServiceExporter
orHessianServiceExporter
, per HttpRequestHandlerServlet definition. This is a minimal alternative to defining remote exporters as beans in a DispatcherServlet context (with advanced mapping and interception facilities being available there).- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
HttpRequestHandler
,DispatcherServlet
, Serialized Form
Constructor Summary
Constructors Constructor Description HttpRequestHandlerServlet()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
init()
A convenience method which can be overridden so that there's no need to callsuper.init(config)
.protected void
service(HttpServletRequest request, HttpServletResponse response)
Receives standard HTTP requests from the publicservice
method and dispatches them to thedo
XXX methods defined in this class.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
Constructor Detail
HttpRequestHandlerServlet
public HttpRequestHandlerServlet()
Method Detail
init
public void init() throws ServletException
Description copied from class:javax.servlet.GenericServlet
A convenience method which can be overridden so that there's no need to callsuper.init(config)
.Instead of overriding
GenericServlet.init(ServletConfig)
, simply override this method and it will be called byGenericServlet.init(ServletConfig config)
. TheServletConfig
object can still be retrieved viaGenericServlet.getServletConfig()
.- Overrides:
init
in classGenericServlet
- Throws:
ServletException
- if an exception occurs that interrupts the servlet's normal operation
service
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
Description copied from class:javax.servlet.http.HttpServlet
Receives standard HTTP requests from the publicservice
method and dispatches them to thedo
XXX methods defined in this class. This method is an HTTP-specific version of theServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
method. There's no need to override this method.- Overrides:
service
in classHttpServlet
- Parameters:
request
- theHttpServletRequest
object that contains the request the client made of the servletresponse
- theHttpServletResponse
object that contains the response the servlet returns to the client- Throws:
ServletException
- if the HTTP request cannot be handledIOException
- if an input or output error occurs while the servlet is handling the HTTP request- See Also:
Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)