Overview | Package | Class
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.servlet
Class GroovyServlet

This servlet will run Groovy scripts as Groovlets. Groovlets are scripts with these objects implicit in their scope:

- request - the HttpServletRequest
- response - the HttpServletResponse
- application - the ServletContext associated with the servlet
- session - the HttpSession associated with the HttpServletRequest
- out - the PrintWriter associated with the ServletRequest

Your script sources can be placed either in your web application's normal web root (allows for subdirectories) or in /WEB-INF/groovy/* (also allows subdirectories).

To make your web application more groovy, you must add the GroovyServlet to your application's web.xml configuration using any mapping you like, so long as it follows the pattern *.* (more on this below). Here is the web.xml entry:

          Groovy
          groovy.servlet.GroovyServlet

          Groovy
          *.groovy
          *.gdo

The URL pattern does not require the "*.groovy" mapping. You can, for example, make it more Struts-like but groovy by making your mapping "*.gdo".

author:
  Sam Pullara

author:
  Mark Turansky (markturansky at hotmail.com)

author:
  Guillaume Laforge

author:
  Christian Stein

see:
  ServletBinding

Field Summary
`GroovyScriptEngine` | `gse`

Constructor Summary
`GroovyServlet()`

Method Summary
`GroovyScriptEngine` | `createGroovyScriptEngine()` Hook method to setup the GroovyScriptEngine to use.
`void` | `init(ServletConfig config)` The script engine executing the Groovy scripts for this servlet
`void` | `service(HttpServletRequest request, HttpServletResponse response)` Handle web requests to the GroovyServlet

Constructor Detail

### GroovyServlet

    GroovyServlet()

Method Detail

### createGroovyScriptEngine

    GroovyScriptEngine createGroovyScriptEngine()

  Hook method to setup the GroovyScriptEngine to use.
  Subclasses may override this method to provide a custom engine.

### init

    public void init(ServletConfig config)

  The script engine executing the Groovy scripts for this servlet

### service

    public void service(HttpServletRequest request, HttpServletResponse response)

  Handle web requests to the GroovyServlet