info.magnolia.module.groovy.servlets
Class MgnlGroovyRescueServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
info.magnolia.module.groovy.servlets.MgnlGroovyRescueServlet
- All Implemented Interfaces:
- Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public final class MgnlGroovyRescueServlet
- extends javax.servlet.http.HttpServlet
A special servlet which makes at your disposal the Magnolia's Groovy interactive console bypassing the
normal Magnolia's filters chain. This can be useful, for instance, to perform rescue operations on a corrupted Magnolia instance.
Warning: All operations are executed in system context, meaning that no security restrictions are enforced which
might expose your data to risk of irreversible damages if you are not aware of what you are doing. In other words, use it at your own risk.
To use it, in your web.xml
you must explicitly comment out the Magnolia filter chain part and add or uncomment the Groovy rescue servlet.
Important: You also need to explicitly add a servlet
and a servlet-mapping
for
info.magnolia.cms.servlets.ClasspathSpool
as this is needed to serve correctly the javascript and css needed by the console.
For a sample configuration, see the web.xml
fragment below:
[...]
<!--
<filter>
<display-name>Magnolia global filters</display-name>
<filter-name>magnoliaFilterChain</filter-name>
<filter-class>info.magnolia.cms.filters.MgnlMainFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>magnoliaFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
-->
<servlet>
<servlet-name>mgnlGroovyServlet</servlet-name>
<servlet-class>info.magnolia.module.groovy.servlets.MgnlGroovyRescueServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mgnlGroovyServlet</servlet-name>
<url-pattern>/.magnolia/pages/groovyInteractiveConsole.html</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>resourcesServlet</servlet-name>
<servlet-class>info.magnolia.cms.servlets.ClasspathSpool</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>resourcesServlet</servlet-name>
<url-pattern>/.resources/*</url-pattern>
</servlet-mapping>
[...]
Once configured and having restarted the web container, you can access the console like this
http://yourserver[:port]/contextname/.magnolia/pages/groovyInteractiveConsole.html
- Version:
- $Id$
- Author:
- fgrilli
- See Also:
- Serialized Form
Method Summary |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
|
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
init()
|
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, 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 |
MgnlGroovyRescueServlet
public MgnlGroovyRescueServlet()
init
public void init()
throws javax.servlet.ServletException
- Overrides:
init
in class javax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
IOException
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.