Class PathServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
fc.web.servlet.PathServlet
- All Implemented Interfaces:
Servlet, ServletConfig, Serializable
A convenient base class for servlets that use path info (must
be path mapped; extension mapped servlets (like *.mp) do not
have any path info associated with them.
If the request has a non-null non-empty path, then that path
is sent to the doPathInfo method, which
a subclass should implement. A request with an empty or null
path info results in sending a 404 error back to the client.
- See Also:
-
Field Summary
Fields inherited from class HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoGet(HttpServletRequest req, HttpServletResponse res) abstract voiddoPathInfo(HttpServletRequest req, HttpServletResponse res, String pathinfo) The pathinfo parameter is notintern()'ed but can be if/as needed in this method.voiddoPost(HttpServletRequest req, HttpServletResponse res) voiderror(HttpServletResponse res, String msg) Sends a 404 (page not found) error to the client.voidinit(ServletConfig conf) Methods inherited from class HttpServlet
serviceMethods inherited from class GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
PathServlet
public PathServlet()
-
-
Method Details
-
init
- Specified by:
initin interfaceServlet- Overrides:
initin classHttpServlet- Throws:
ServletException
-
doPost
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException - Throws:
ServletExceptionIOException
-
doGet
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException - Throws:
ServletExceptionIOException
-
error
Sends a 404 (page not found) error to the client. Invoke this method if there is missing/bad path info and return from the servlet.- Throws:
IOException
-
doPathInfo
public abstract void doPathInfo(HttpServletRequest req, HttpServletResponse res, String pathinfo) throws ServletException, IOException The pathinfo parameter is notintern()'ed but can be if/as needed in this method.- Throws:
ServletExceptionIOException
-