Class RoutingServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
pl.edu.icm.unity.engine.api.utils.RoutingServlet
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public class RoutingServlet
extends javax.servlet.http.HttpServlet
Simple routing (dispatching) servlet. Requires a default target servlet path and can have additional
servlets registered. Should be installed as an entry point for externally visible path. Subsequently it
routes all requests to a current destination. The destination can be changed with a customized forward.
Internally stores state in a single session variable.
- Author:
- K. Benedyczak
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclean(javax.servlet.http.HttpServletRequest req) Cleans any previous routing settings.static voidforwardTo(String newDestination, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) The routing will be reconfigured to forward all requests to the given destination.protected voidservice(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Field Details
-
CURRENT_DESTINATION
-
-
Constructor Details
-
RoutingServlet
-
-
Method Details
-
service
protected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException - Overrides:
servicein classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
forwardTo
public static void forwardTo(String newDestination, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException The routing will be reconfigured to forward all requests to the given destination.- Parameters:
newDestination-req-resp-- Throws:
javax.servlet.ServletExceptionIOException
-
clean
public static void clean(javax.servlet.http.HttpServletRequest req) Cleans any previous routing settings. Useful when a new interaction is started, but when the old session is still used.- Parameters:
req-
-