Package org.apache.wiki.ajax
Class WikiAjaxDispatcherServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.wiki.ajax.WikiAjaxDispatcherServlet
- All Implemented Interfaces:
java.io.Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class WikiAjaxDispatcherServlet extends javax.servlet.http.HttpServlet
This provides a simple ajax servlet for handling /ajax/ requests. HttpServlet classes need to be registered using
registerServlet(WikiAjaxServlet)
- Since:
- 2.10.2-svn12
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description WikiAjaxDispatcherServlet()
-
Method Summary
Modifier and Type Method Description void
doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
CallsperformAction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void
doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
CallsperformAction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
WikiAjaxServlet
findServletByName(java.lang.String servletAlias)
Find theWikiAjaxServlet
given the servletAlias that it was registered with.java.lang.String
getServletName(java.lang.String path)
Get the ServletName from the requestURI "/ajax/", using AjaxUtil.getNextPathPart(java.lang.String, java.lang.String)
.void
init(javax.servlet.ServletConfig config)
This sets the AjaxPath to "/ajax/" as configured in "jspwiki.ajax.url.prefix".static void
registerServlet(java.lang.String alias, WikiAjaxServlet servlet)
Register aWikiAjaxServlet
with a specific alias, and default permissionPagePermission.VIEW
.static void
registerServlet(java.lang.String alias, WikiAjaxServlet servlet, java.security.Permission perm)
Regster aWikiAjaxServlet
given an alias, the servlet, and the permission.static void
registerServlet(WikiAjaxServlet servlet)
Register aWikiAjaxServlet
using the servlet mapping as the aliasMethods 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
-
Constructor Details
-
WikiAjaxDispatcherServlet
public WikiAjaxDispatcherServlet()
-
-
Method Details
-
init
This sets the AjaxPath to "/ajax/" as configured in "jspwiki.ajax.url.prefix". Note: Do not change this without also changing the web.xml file.- Specified by:
init
in interfacejavax.servlet.Servlet
- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
registerServlet
Register aWikiAjaxServlet
using the servlet mapping as the alias -
registerServlet
Register aWikiAjaxServlet
with a specific alias, and default permissionPagePermission.VIEW
. -
registerServlet
public static void registerServlet(java.lang.String alias, WikiAjaxServlet servlet, java.security.Permission perm)Regster aWikiAjaxServlet
given an alias, the servlet, and the permission. This creates a temporary bundle object calledWikiAjaxDispatcherServlet.AjaxServletContainer
- Parameters:
alias
- the uri link to this servletservlet
- the servlet being registeredperm
- the permission required to execute the servlet.
-
doPost
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException, javax.servlet.ServletExceptionCallsperformAction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Throws:
java.io.IOException
javax.servlet.ServletException
-
doGet
public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException, javax.servlet.ServletExceptionCallsperformAction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
java.io.IOException
javax.servlet.ServletException
-
getServletName
public java.lang.String getServletName(java.lang.String path) throws javax.servlet.ServletExceptionGet the ServletName from the requestURI "/ajax/", using AjaxUtil.getNextPathPart(java.lang.String, java.lang.String)
.- Parameters:
path
- The requestURI, which must contains "/ajax/" in the path - Returns:
- The ServletName for the requestURI, or null
- Throws:
javax.servlet.ServletException
- if the path is invalid
-
findServletByName
Find theWikiAjaxServlet
given the servletAlias that it was registered with.- Parameters:
servletAlias
- the value provided toregisterServlet(org.apache.wiki.ajax.WikiAjaxServlet)
- Returns:
- the
WikiAjaxServlet
given the servletAlias that it was registered with.
-