Class PathServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
fc.web.servlet.PathServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.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 jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) abstract voiddoPathInfo(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, String pathinfo) The pathinfo parameter is not intern()'ed but can be if/as needed in this method.voiddoPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) voidSends a 404 (page not found) error to the client.voidinit(jakarta.servlet.ServletConfig conf) Methods inherited from class jakarta.servlet.http.HttpServlet
serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
PathServlet
public PathServlet()
-
-
Method Details
-
init
- Specified by:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletException
-
doPost
public void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws jakarta.servlet.ServletException, IOException - Throws:
jakarta.servlet.ServletExceptionIOException
-
doGet
public void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws jakarta.servlet.ServletException, IOException - Throws:
jakarta.servlet.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(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, String pathinfo) throws jakarta.servlet.ServletException, IOException The pathinfo parameter is not intern()'ed but can be if/as needed in this method.- Throws:
jakarta.servlet.ServletExceptionIOException
-