站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

HttpRequestHandler (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.web
Interface HttpRequestHandler

All Known Implementing Classes:
BurlapServiceExporter, HessianServiceExporter, HttpInvokerServiceExporter

public interface HttpRequestHandler

Plain handler interface for components that process HTTP requests, analogous to a Servlet. Only throws ServletException and IOException, to allow for usage within any HttpServlet. Essentially the direct equivalent of an HttpServlet, reduced to a handle method.

The easiest way to expose an HttpRequestHandler bean in Spring style is to define it in Spring's root web application context and define an HttpRequestHandlerServlet in web.xml, pointing at the target HttpRequestHandler bean through its servlet-name which needs to match the target bean name.

Supported as a handler type within Spring's DispatcherServlet, being able to leverage the dispatcher's advanced mapping and interception facilities. This is the recommended way of exposing an HttpRequestHandler, while keeping the handler implementations free of direct dependencies on a DispatcherServlet environment.

Typically implemented to generate binary responses directly, with no separate view resource involved. This differentiates it from a Controller within Spring's Web MVC framework. The lack of a ModelAndView return value gives a clearer signature to callers other than the DispatcherServlet, indicating there will never be a view to render.

As of Spring 2.0, Spring's HTTP-based remote exporters, such as HttpInvokerServiceExporter and HessianServiceExporter, implement this interface rather than the more extensive Controller interface, for minimal dependencies on Spring-specific web infrastructure.

Note that RequestHandlers can optionally implement the LastModified interface, just like Controllers can, provided that they run within Spring's DispatcherServlet.

Since:
2.0
Author:
Juergen Hoeller
See Also:
HttpRequestHandlerServlet, DispatcherServlet, ModelAndView, Controller, LastModified, HttpRequestHandlerAdapter, HttpInvokerServiceExporter, HessianServiceExporter, BurlapServiceExporter

Method Summary
 void handleRequest(HttpServletRequest request, HttpServletResponse response)
          Process the given request, generating a response.
 

Method Detail

handleRequest

void handleRequest(HttpServletRequest request,
                   HttpServletResponse response)
                   throws ServletException,
                          IOException
Process the given request, generating a response.

Parameters:
request - current HTTP request
response - current HTTP response
Throws:
ServletException - in case of general errors
IOException - in case of I/O errors

The Spring Framework

Copyright © 2002-2007 The Spring Framework.