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.HttpServlet
The switching servlet dispatches an incoming request to a specific web resource depending on thereslcass
parameter. 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 theresclass
parameter and finds the corresponding web resource path. It then fowards the request to that resource, but without theresclass
parameter.If the
resclass
parameter 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 void
doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
void
doIt(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
Examine the resclass parameter and forward to the mapped web context resource.void
doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
void
init(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.ServletException
Initialize the resource mappings. Each init parameter maps a resclass to a web context resource.- Specified by:
init
in interfacejavax.servlet.Servlet
- Overrides:
init
in classjavax.servlet.GenericServlet
- Parameters:
config
- aServletConfig
value.- 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:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
doPost
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException
- Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
doIt
public void doIt(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException
Examine the resclass parameter and forward to the mapped web context resource.- Parameters:
req
- aHttpServletRequest
value.res
- aHttpServletResponse
value.- Throws:
javax.servlet.ServletException
- if an error occurs.IOException
- if an error occurs.
-
-