public class GroovyServlet extends AbstractHttpServlet
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".
ServletBinding
,
Serialized FormCONTENT_TYPE_TEXT_HTML, INC_PATH_INFO, INC_REQUEST_URI, INC_SERVLET_PATH, reflection, resourceNameMatcher, resourceNameReplaceAll, resourceNameReplacement, servletContext, verbose
Constructor and Description |
---|
GroovyServlet() |
Modifier and Type | Method and Description |
---|---|
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
|
getResourceConnection, getScriptUri, getScriptUriAsFile
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class AbstractHttpServlet
config
- the servlet coniguration provided by the containerjavax.servlet.ServletException
- if this method encountered difficultiespublic void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
service
in class javax.servlet.http.HttpServlet
java.io.IOException