Package gov.nasa.pds.dsview.servlets
Class SwitchingQueryServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- gov.nasa.pds.dsview.servlets.SwitchingQueryServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public class SwitchingQueryServlet extends javax.servlet.http.HttpServletThe switching servlet dispatches an incoming request to a specific web resource depending on thereslcassparameter. At initialization time, the servlet reads each initialization parameter and treats it as aresclass-to-web resource (by path) mapping. It saves each mapping. Then, for any GET or POST request, it looks for theresclassparameter and finds the corresponding web resource path. It then fowards the request to that resource, but without theresclassparameter.If the
resclassparameter is missing or is empty, the result is a 400 (bad request). If the web resource is missing from the web server, the result is a 404 (not found).- Version:
- $Revision$
- Author:
- Kelly
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SwitchingQueryServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)voiddoIt(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Examine the resclass parameter and forward to the mapped web context resource.voiddoPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)voidinit(javax.servlet.ServletConfig config)Initialize the resource mappings.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
-
-
-
-
Method Detail
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletExceptionInitialize the resource mappings. Each init parameter maps a resclass to a web context resource.- Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classjavax.servlet.GenericServlet- Parameters:
config- aServletConfigvalue.- Throws:
javax.servlet.ServletException- if an error occurs.
-
doGet
public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException- Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
doPost
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException- Overrides:
doPostin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
doIt
public void doIt(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOExceptionExamine the resclass parameter and forward to the mapped web context resource.- Parameters:
req- aHttpServletRequestvalue.res- aHttpServletResponsevalue.- Throws:
javax.servlet.ServletException- if an error occurs.IOException- if an error occurs.
-
-