Package mg.emberframework.core
Class FrontController
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
mg.emberframework.core.FrontController
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
public class FrontController
extends jakarta.servlet.http.HttpServlet
The central servlet for handling HTTP requests in the Ember Framework.
This class extends HttpServlet to process GET and POST requests, initialize
the framework, and manage URL mappings, initialization parameters, and exceptions.
It is annotated with @MultipartConfig to support file uploads.
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- Sandratra NIAINA
- See Also:
-
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Handles HTTP GET requests.protected voiddoPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Handles HTTP POST requests.static StringGets the custom error page URL.Gets the exception encountered during processing.Gets the initialization parameters.Gets the request handler.Gets the URL mappings.voidinit()Initializes the servlet by setting up the request handler and framework configuration.static voidsetCustomErrorPage(String customErrorPage) Sets the custom error page URL.static voidsetException(Exception newException) Sets the exception encountered during processing.static voidsetInitParameter(InitParameter newInitParameter) Sets the initialization parameters.voidsetRequestHandler(RequestHandler requestHandler) Sets the request handler.static voidsetUrlMapping(Map<String, Mapping> urlMapping) Sets the URL mappings.Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, init, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
-
Constructor Details
-
FrontController
public FrontController()
-
-
Method Details
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException Handles HTTP GET requests.- Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Parameters:
req- the HTTP requestresp- the HTTP response- Throws:
jakarta.servlet.ServletException- if a servlet error occursIOException- if an I/O error occurs
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException Handles HTTP POST requests.- Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Parameters:
req- the HTTP requestresp- the HTTP response- Throws:
jakarta.servlet.ServletException- if a servlet error occursIOException- if an I/O error occurs
-
init
public void init() throws jakarta.servlet.ServletExceptionInitializes the servlet by setting up the request handler and framework configuration.- Overrides:
initin classjakarta.servlet.GenericServlet- Throws:
jakarta.servlet.ServletException- if an error occurs during initialization
-
getUrlMapping
Gets the URL mappings.- Returns:
- the map of URL mappings
-
setUrlMapping
Sets the URL mappings.- Parameters:
urlMapping- the map of URL mappings to set
-
getException
Gets the exception encountered during processing.- Returns:
- the exception, or null if none
-
setException
Sets the exception encountered during processing.- Parameters:
newException- the exception to set
-
getInitParameter
Gets the initialization parameters.- Returns:
- the initialization parameters
-
setInitParameter
Sets the initialization parameters.- Parameters:
newInitParameter- the initialization parameters to set
-
getRequestHandler
Gets the request handler.- Returns:
- the request handler
-
setRequestHandler
Sets the request handler.- Parameters:
requestHandler- the request handler to set
-
getCustomErrorPage
Gets the custom error page URL.- Returns:
- the custom error page URL, or null if not set
-
setCustomErrorPage
Sets the custom error page URL.- Parameters:
customErrorPage- the custom error page URL to set
-