groovy.servlet
Class GroovyServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bygroovy.servlet.AbstractHttpServlet
              extended bygroovy.servlet.GroovyServlet
All Implemented Interfaces:
ResourceConnector, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class GroovyServlet
extends AbstractHttpServlet

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

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, Mark Turansky (markturansky at hotmail.com), Guillaume Laforge, Christian Stein
See Also:
ServletBinding, Serialized Form

Field Summary
 
Fields inherited from class groovy.servlet.AbstractHttpServlet
CONTENT_TYPE_TEXT_HTML, INC_PATH_INFO, INC_REQUEST_URI, INC_SERVLET_PATH, reflection, resourceNameMatcher, resourceNameReplaceAll, resourceNameReplacement, servletContext, verbose
 
Constructor Summary
GroovyServlet()
           
 
Method Summary
 void init(javax.servlet.ServletConfig config)
          Initialize the GroovyServlet.
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handle web requests to the GroovyServlet
 
Methods inherited from class groovy.servlet.AbstractHttpServlet
getResourceConnection, getScriptUri, getScriptUriAsFile
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyServlet

public GroovyServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initialize the GroovyServlet.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class AbstractHttpServlet
Parameters:
config - the servlet coniguration provided by the container
Throws:
javax.servlet.ServletException - if this method encountered difficulties

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws IOException
Handle web requests to the GroovyServlet

Throws:
IOException


Copyright © 2003-2005 The Codehaus. All Rights Reserved.