This project involves building a lightweight Java-based web framework that handles controllers, routing, and form management through a series of sprints. Each sprint progressively adds functionality to the framework, from simple URL mapping to form handling and exception management.
- Goal: Create a
FrontControllerto capture and display the URL entered by the user. - Description:
- Developed the
FrontControllerto handle HTTP requests and print the URL for basic validation.
- Developed the
- Goal: Modify the
FrontControllerto list all controllers in the project. - Description:
- Created a
Controllerannotation for marking classes as controllers. - Introduced an XML configuration file to specify the directory containing the controllers.
- Extended the
FrontControllerto dynamically detect and list all annotated controllers.
- Created a
- Goal: Implement routing for controllers using annotations.
- Description:
- Added a
Controllerannotation to denote classes and aGetannotation to map routes to methods. - Modified the
FrontControllerto associate URLs with controller classes and methods. - Mapped specific URLs to corresponding methods, displaying which class and method the route points to.
- Added a
- Goal: Display the return values of functions corresponding to URLs.
- Description:
- Updated the framework to invoke the method mapped to the URL and display its return value in the response.
- Goal: Handle requests and redirect to JSP pages.
- Description:
- Introduced
ModelAndViewclass for managing model data and views. - Enabled the
FrontControllerto redirect to JSP pages, providing a seamless view rendering process.
- Introduced
- Goal: Integrate exception handling into the framework.
- Description:
- Added exception handling to
FrontControllerandAccessController. - Handled both system and user-defined exceptions, improving error management and debugging.
- Added exception handling to
- Goal: Enable form data submission and processing.
- Description:
- Built functionality to capture form data and call the corresponding function based on the URL.
- Displayed the function’s response after form submission.
- Implemented a
Paramannotation for mapping form fields to method parameters. - Note: To ensure proper mapping, compile the project using the
-parametersflag.
- Goal: Map form fields directly to an object’s properties.
- Description:
- Collected form arguments and set them into a Java object, then returned the object for further processing.
- Goal: Implement a REST API layer.
- Description:
- Created a new
RestApiannotation for REST-enabled controllers. - Modified the
FrontControllerto detect and verify the presence of theRestApiannotation. - Retrieved the return value of methods annotated with
RestApi, converted the data to JSON using the Gson library, and returned it to the client viagetWriterfor JSON responses.
- Created a new