Package mg.emberframework.core.handler
Class RequestHandler
java.lang.Object
mg.emberframework.core.handler.RequestHandler
Main process handler for the Ember Framework.
This class manages the initialization of the framework and the handling of HTTP requests, including URL mapping, role validation, method execution, and response generation.
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- Sandratra NIAINA
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
handleRequest
(FrontController controller, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Handles an incoming HTTP request and generates a response.void
init
(FrontController controller) Initializes the framework by scanning for controller mappings and setting parameters.
-
Constructor Details
-
RequestHandler
public RequestHandler()
-
-
Method Details
-
init
public void init(FrontController controller) throws ClassNotFoundException, IOException, DuplicateUrlException, InvalidControllerPackageException Initializes the framework by scanning for controller mappings and setting parameters.- Parameters:
controller
- the front controller instance- Throws:
ClassNotFoundException
- if a class cannot be found during scanningIOException
- if an I/O error occurs during initializationDuplicateUrlException
- if duplicate URL mappings are detectedInvalidControllerPackageException
- if the controller package is invalid
-
handleRequest
public void handleRequest(FrontController controller, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException, UrlNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, jakarta.servlet.ServletException, IllegalReturnTypeException, AnnotationNotPresentException, InvalidRequestException, UnauthorizedAccessException, URISyntaxException Handles an incoming HTTP request and generates a response.- Parameters:
controller
- the front controller instancerequest
- the HTTP requestresponse
- the HTTP response- Throws:
IOException
- if an I/O error occursUrlNotFoundException
- if the requested URL is not mappedNoSuchMethodException
- if a method cannot be foundSecurityException
- if a security violation occursIllegalAccessException
- if access to a method is deniedIllegalArgumentException
- if an argument is invalidInvocationTargetException
- if method invocation failsInstantiationException
- if an object cannot be instantiatedjakarta.servlet.ServletException
- if a servlet error occursIllegalReturnTypeException
- if the return type is unsupportedAnnotationNotPresentException
- if a required annotation is missingInvalidRequestException
- if the request is malformedUnauthorizedAccessException
- if the user lacks permissionURISyntaxException
- if the URI syntax is invalid
-