Class WikiAjaxDispatcherServlet

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.wiki.ajax.WikiAjaxDispatcherServlet
All Implemented Interfaces:
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 Details

  • Method Details

    • init

      public void init​(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
      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 interface javax.servlet.Servlet
      Overrides:
      init in class javax.servlet.GenericServlet
      Throws:
      javax.servlet.ServletException
    • registerServlet

      public static void registerServlet​(WikiAjaxServlet servlet)
      Register a WikiAjaxServlet using the servlet mapping as the alias
    • registerServlet

      public static void registerServlet​(String alias, WikiAjaxServlet servlet)
      Register a WikiAjaxServlet with a specific alias, and default permission PagePermission.VIEW.
    • registerServlet

      public static void registerServlet​(String alias, WikiAjaxServlet servlet, Permission perm)
      Regster a WikiAjaxServlet given an alias, the servlet, and the permission. This creates a temporary bundle object called WikiAjaxDispatcherServlet.AjaxServletContainer
      Parameters:
      alias - the uri link to this servlet
      servlet - the servlet being registered
      perm - the permission required to execute the servlet.
    • doPost

      public void doPost​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException, javax.servlet.ServletException
      Calls performAction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      Overrides:
      doPost in class javax.servlet.http.HttpServlet
      Throws:
      IOException
      javax.servlet.ServletException
    • doGet

      public void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException, javax.servlet.ServletException
      Calls performAction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      Overrides:
      doGet in class javax.servlet.http.HttpServlet
      Throws:
      IOException
      javax.servlet.ServletException
    • getServletName

      public String getServletName​(String path) throws javax.servlet.ServletException
      Get 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

      public WikiAjaxServlet findServletByName​(String servletAlias)
      Find the WikiAjaxServlet given the servletAlias that it was registered with.
      Parameters:
      servletAlias - the value provided to registerServlet(org.apache.wiki.ajax.WikiAjaxServlet)
      Returns:
      the WikiAjaxServlet given the servletAlias that it was registered with.