Groovy Documentation

## org.codehaus.groovy.grails.web.servlet
[Java] Class GrailsDispatcherServlet

    java.lang.Object
      org.springframework.web.servlet.DispatcherServlet
          org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet

    public class GrailsDispatcherServlet
    extends DispatcherServlet

Handles incoming requests for Grails.

Loads the Spring configuration based on the Grails application in the parent application context.

Authors:
  Steven Devijver
  Graeme Rocher

Since:
  Jul 2, 2005

Field Summary
`protected HandlerInterceptor[]` | `interceptors`
`protected MultipartResolver` | `multipartResolver`

Constructor Summary
`GrailsDispatcherServlet()` Constructor.

Method Summary
`protected HttpServletRequest` | `checkMultipart(HttpServletRequest request)` Convert the request into a multipart request.
`protected void` | `copyParamsFromPreviousRequest(GrailsWebRequest previousRequestAttributes, GrailsWebRequest requestAttributes)`
`protected WebApplicationContext` | `createWebApplicationContext(WebApplicationContext parent)`
`void` | `destroy()`
`protected void` | `doDispatch(HttpServletRequest request, HttpServletResponse response)`
`protected HandlerInterceptor[]` | `establishInterceptors(WebApplicationContext webContext)` Evalutes the given WebApplicationContext for all HandlerInterceptor and WebRequestInterceptor instances
`HandlerExecutionChain` | `getHandler(HttpServletRequest request, boolean cache)`
`protected void` | `initFrameworkServlet()`
`protected void` | `initStrategies(ApplicationContext context)`
`void` | `setApplication(GrailsApplication application)` Dependency injection for the application.
`protected void` | `triggerAfterCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex, HttpServletRequest request, HttpServletResponse response, java.lang.Exception ex)` Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
`protected HttpServletResponse` | `useWrappedOrOriginalResponse(HttpServletResponse response)`

Field Detail

### interceptors

    protected HandlerInterceptor[] interceptors

### multipartResolver

    protected MultipartResolver multipartResolver

Constructor Detail

### GrailsDispatcherServlet

    public GrailsDispatcherServlet()

  Constructor.

Method Detail

### checkMultipart

    @Override
    protected HttpServletRequest checkMultipart(HttpServletRequest request)

  Convert the request into a multipart request. If no multipart resolver is set, simply use the existing request.
  Parameters:
    `request` - current HTTP request
  Returns:
    the processed request (multipart wrapper if necessary)

### copyParamsFromPreviousRequest

    @SuppressWarnings({ "unchecked", "rawtypes" })
    protected void copyParamsFromPreviousRequest(GrailsWebRequest previousRequestAttributes, GrailsWebRequest requestAttributes)

### createWebApplicationContext

    @Override
    protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent)

### destroy

    @Override
    public void destroy()

### doDispatch

    @Override
    protected void doDispatch(HttpServletRequest request, HttpServletResponse response)

### establishInterceptors

    protected HandlerInterceptor[] establishInterceptors(WebApplicationContext webContext)

  Evalutes the given WebApplicationContext for all HandlerInterceptor and WebRequestInterceptor instances
  Parameters:
    `webContext` - The WebApplicationContext
  Returns:
    An array of HandlerInterceptor instances

### getHandler

    @Override
    public HandlerExecutionChain getHandler(HttpServletRequest request, boolean cache)

### initFrameworkServlet

    @Override
    protected void initFrameworkServlet()

### initStrategies

    @Override
    protected void initStrategies(ApplicationContext context)

### setApplication

    public void setApplication(GrailsApplication application)

  Dependency injection for the application.
  Parameters:
    `application` - the application

### triggerAfterCompletion

    protected void triggerAfterCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex, HttpServletRequest request, HttpServletResponse response, java.lang.Exception ex)

  Trigger afterCompletion callbacks on the mapped HandlerInterceptors. Will just invoke afterCompletion for all interceptors whose preHandle invocation has successfully completed and returned true.
  Parameters:
    `mappedHandler` - the mapped HandlerExecutionChain
    `interceptorIndex` - index of last interceptor that successfully completed
    `ex` - Exception thrown on handler execution, or `null` if none
  See Also:
    HandlerInterceptor#afterCompletion#afterCompletion

### useWrappedOrOriginalResponse

    protected HttpServletResponse useWrappedOrOriginalResponse(HttpServletResponse response)

Groovy Documentation