Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      javax.servlet.GenericServlet
          javax.servlet.http.HttpServlet
              org.springframework.web.servlet.HttpServletBean
                  org.springframework.web.servlet.FrameworkServlet
                      org.springframework.web.servlet.DispatcherServlet
                          org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet

    public class GrailsDispatcherServlet
    extends org.springframework.web.servlet.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 org.springframework.web.servlet.HandlerInterceptor[]` | `interceptors`
`protected org.springframework.web.servlet.ViewResolver` | `layoutViewResolver`
`protected org.springframework.web.multipart.MultipartResolver` | `multipartResolver`

Fields inherited from class org.springframework.web.servlet.DispatcherServlet
MULTIPART_RESOLVER_BEAN_NAME, LOCALE_RESOLVER_BEAN_NAME, THEME_RESOLVER_BEAN_NAME, HANDLER_MAPPING_BEAN_NAME, HANDLER_ADAPTER_BEAN_NAME, HANDLER_EXCEPTION_RESOLVER_BEAN_NAME, REQUEST_TO_VIEW_NAME_TRANSLATOR_BEAN_NAME, VIEW_RESOLVER_BEAN_NAME, FLASH_MAP_MANAGER_BEAN_NAME, WEB_APPLICATION_CONTEXT_ATTRIBUTE, LOCALE_RESOLVER_ATTRIBUTE, THEME_RESOLVER_ATTRIBUTE, THEME_SOURCE_ATTRIBUTE, INPUT_FLASH_MAP_ATTRIBUTE, OUTPUT_FLASH_MAP_ATTRIBUTE, FLASH_MAP_MANAGER_ATTRIBUTE, PAGE_NOT_FOUND_LOG_CATEGORY, DEFAULT_NAMESPACE_SUFFIX, DEFAULT_CONTEXT_CLASS, SERVLET_CONTEXT_PREFIX

Fields inherited from class org.springframework.web.servlet.FrameworkServlet
DEFAULT_NAMESPACE_SUFFIX, DEFAULT_CONTEXT_CLASS, SERVLET_CONTEXT_PREFIX

Constructor Summary
`GrailsDispatcherServlet()` Constructor.

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

Methods inherited from class org.springframework.web.servlet.DispatcherServlet
org.springframework.web.servlet.DispatcherServlet#getThemeSource(), org.springframework.web.servlet.DispatcherServlet#setDetectAllHandlerMappings(boolean), org.springframework.web.servlet.DispatcherServlet#setDetectAllHandlerAdapters(boolean), org.springframework.web.servlet.DispatcherServlet#setDetectAllHandlerExceptionResolvers(boolean), org.springframework.web.servlet.DispatcherServlet#setDetectAllViewResolvers(boolean), org.springframework.web.servlet.DispatcherServlet#setCleanupAfterInclude(boolean), org.springframework.web.servlet.DispatcherServlet#getMultipartResolver(), org.springframework.web.servlet.DispatcherServlet#refresh(), org.springframework.web.servlet.DispatcherServlet#destroy(), org.springframework.web.servlet.DispatcherServlet#setNamespace(java.lang.String), org.springframework.web.servlet.DispatcherServlet#getNamespace(), org.springframework.web.servlet.DispatcherServlet#getContextAttribute(), org.springframework.web.servlet.DispatcherServlet#getWebApplicationContext(), org.springframework.web.servlet.DispatcherServlet#getServletContextAttributeName(), org.springframework.web.servlet.DispatcherServlet#setContextAttribute(java.lang.String), org.springframework.web.servlet.DispatcherServlet#setContextClass(java.lang.Class), org.springframework.web.servlet.DispatcherServlet#getContextClass(), org.springframework.web.servlet.DispatcherServlet#setContextId(java.lang.String), org.springframework.web.servlet.DispatcherServlet#getContextId(), org.springframework.web.servlet.DispatcherServlet#setContextConfigLocation(java.lang.String), org.springframework.web.servlet.DispatcherServlet#getContextConfigLocation(), org.springframework.web.servlet.DispatcherServlet#setContextInitializers([Lorg.springframework.context.ApplicationContextInitializer;), org.springframework.web.servlet.DispatcherServlet#setContextInitializerClasses(java.lang.String), org.springframework.web.servlet.DispatcherServlet#setPublishContext(boolean), org.springframework.web.servlet.DispatcherServlet#setPublishEvents(boolean), org.springframework.web.servlet.DispatcherServlet#setThreadContextInheritable(boolean), org.springframework.web.servlet.DispatcherServlet#setDispatchOptionsRequest(boolean), org.springframework.web.servlet.DispatcherServlet#setDispatchTraceRequest(boolean), org.springframework.web.servlet.DispatcherServlet#onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent), org.springframework.web.servlet.DispatcherServlet#init(), org.springframework.web.servlet.DispatcherServlet#getEnvironment(), org.springframework.web.servlet.DispatcherServlet#getEnvironment(), org.springframework.web.servlet.DispatcherServlet#setEnvironment(org.springframework.core.env.Environment), org.springframework.web.servlet.DispatcherServlet#getServletContext(), org.springframework.web.servlet.DispatcherServlet#getServletName(), org.springframework.web.servlet.DispatcherServlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse), org.springframework.web.servlet.DispatcherServlet#log(java.lang.String, java.lang.Throwable), org.springframework.web.servlet.DispatcherServlet#log(java.lang.String), org.springframework.web.servlet.DispatcherServlet#init(javax.servlet.ServletConfig), org.springframework.web.servlet.DispatcherServlet#getServletConfig(), org.springframework.web.servlet.DispatcherServlet#getServletInfo(), org.springframework.web.servlet.DispatcherServlet#getInitParameter(java.lang.String), org.springframework.web.servlet.DispatcherServlet#getInitParameterNames(), org.springframework.web.servlet.DispatcherServlet#wait(long, int), org.springframework.web.servlet.DispatcherServlet#wait(long), org.springframework.web.servlet.DispatcherServlet#wait(), org.springframework.web.servlet.DispatcherServlet#equals(java.lang.Object), org.springframework.web.servlet.DispatcherServlet#toString(), org.springframework.web.servlet.DispatcherServlet#hashCode(), org.springframework.web.servlet.DispatcherServlet#getClass(), org.springframework.web.servlet.DispatcherServlet#notify(), org.springframework.web.servlet.DispatcherServlet#notifyAll()

Methods inherited from class org.springframework.web.servlet.FrameworkServlet
org.springframework.web.servlet.FrameworkServlet#refresh(), org.springframework.web.servlet.FrameworkServlet#destroy(), org.springframework.web.servlet.FrameworkServlet#setNamespace(java.lang.String), org.springframework.web.servlet.FrameworkServlet#getNamespace(), org.springframework.web.servlet.FrameworkServlet#getContextAttribute(), org.springframework.web.servlet.FrameworkServlet#getWebApplicationContext(), org.springframework.web.servlet.FrameworkServlet#getServletContextAttributeName(), org.springframework.web.servlet.FrameworkServlet#setContextAttribute(java.lang.String), org.springframework.web.servlet.FrameworkServlet#setContextClass(java.lang.Class), org.springframework.web.servlet.FrameworkServlet#getContextClass(), org.springframework.web.servlet.FrameworkServlet#setContextId(java.lang.String), org.springframework.web.servlet.FrameworkServlet#getContextId(), org.springframework.web.servlet.FrameworkServlet#setContextConfigLocation(java.lang.String), org.springframework.web.servlet.FrameworkServlet#getContextConfigLocation(), org.springframework.web.servlet.FrameworkServlet#setContextInitializers([Lorg.springframework.context.ApplicationContextInitializer;), org.springframework.web.servlet.FrameworkServlet#setContextInitializerClasses(java.lang.String), org.springframework.web.servlet.FrameworkServlet#setPublishContext(boolean), org.springframework.web.servlet.FrameworkServlet#setPublishEvents(boolean), org.springframework.web.servlet.FrameworkServlet#setThreadContextInheritable(boolean), org.springframework.web.servlet.FrameworkServlet#setDispatchOptionsRequest(boolean), org.springframework.web.servlet.FrameworkServlet#setDispatchTraceRequest(boolean), org.springframework.web.servlet.FrameworkServlet#onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent), org.springframework.web.servlet.FrameworkServlet#init(), org.springframework.web.servlet.FrameworkServlet#getEnvironment(), org.springframework.web.servlet.FrameworkServlet#getEnvironment(), org.springframework.web.servlet.FrameworkServlet#setEnvironment(org.springframework.core.env.Environment), org.springframework.web.servlet.FrameworkServlet#getServletContext(), org.springframework.web.servlet.FrameworkServlet#getServletName(), org.springframework.web.servlet.FrameworkServlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse), org.springframework.web.servlet.FrameworkServlet#log(java.lang.String, java.lang.Throwable), org.springframework.web.servlet.FrameworkServlet#log(java.lang.String), org.springframework.web.servlet.FrameworkServlet#init(javax.servlet.ServletConfig), org.springframework.web.servlet.FrameworkServlet#getServletConfig(), org.springframework.web.servlet.FrameworkServlet#getServletInfo(), org.springframework.web.servlet.FrameworkServlet#getInitParameter(java.lang.String), org.springframework.web.servlet.FrameworkServlet#getInitParameterNames(), org.springframework.web.servlet.FrameworkServlet#wait(long, int), org.springframework.web.servlet.FrameworkServlet#wait(long), org.springframework.web.servlet.FrameworkServlet#wait(), org.springframework.web.servlet.FrameworkServlet#equals(java.lang.Object), org.springframework.web.servlet.FrameworkServlet#toString(), org.springframework.web.servlet.FrameworkServlet#hashCode(), org.springframework.web.servlet.FrameworkServlet#getClass(), org.springframework.web.servlet.FrameworkServlet#notify(), org.springframework.web.servlet.FrameworkServlet#notifyAll()

Field Detail

### interceptors

    protected org.springframework.web.servlet.HandlerInterceptor[] interceptors

### layoutViewResolver

    protected org.springframework.web.servlet.ViewResolver layoutViewResolver

### multipartResolver

    protected org.springframework.web.multipart.MultipartResolver multipartResolver

Constructor Detail

### GrailsDispatcherServlet

    public GrailsDispatcherServlet()

  Constructor.

Method Detail

### buildRequestAttributes

    @java.lang.Override
    protected org.springframework.web.context.request.ServletRequestAttributes buildRequestAttributes(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.context.request.RequestAttributes previousAttributes)

### checkMultipart

    @java.lang.Override
    protected javax.servlet.http.HttpServletRequest checkMultipart(javax.servlet.http.HttpServletRequest request)

### copyParamsFromPreviousRequest

    @java.lang.SuppressWarningscatch (Throwable e) {
    protected void copyParamsFromPreviousRequest(org.springframework.web.context.request.RequestAttributes previousRequestAttributes, GrailsWebRequest requestAttributes)

### createWebApplicationContext

    @java.lang.Override// construct the SpringConfig for the container managed application
    protected org.springframework.web.context.WebApplicationContext createWebApplicationContext(org.springframework.web.context.WebApplicationContext parent)

### destroy

    @java.lang.Overridetry {
    public void destroy()

### doDispatch

    @java.lang.Override// Expose current LocaleResolver and request as LocaleContext.
    protected void doDispatch(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

### establishInterceptors

    protected org.springframework.web.servlet.HandlerInterceptor[] establishInterceptors(org.springframework.web.context.WebApplicationContext webContext)

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

### getHandler

    @java.lang.Override
    public org.springframework.web.servlet.HandlerExecutionChain getHandler(javax.servlet.http.HttpServletRequest request)

### initFrameworkServlet

    @java.lang.Override
    protected void initFrameworkServlet()

### initStrategies

    @java.lang.Overrideprotected void initStrategies(ApplicationContext context) {
    protected void initStrategies(org.springframework.context.ApplicationContext context)

### setApplication

    public void setApplication(GrailsApplication application)

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

### triggerAfterCompletion

    protected void triggerAfterCompletion(org.springframework.web.servlet.HandlerExecutionChain mappedHandler, int interceptorIndex, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Exception ex)

  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)

### useWrappedOrOriginalResponse

    protected javax.servlet.http.HttpServletResponse useWrappedOrOriginalResponse(javax.servlet.http.HttpServletResponse response)

  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:
    org.springframework.web.servlet.HandlerInterceptor#afterCompletion

Groovy Documentation