While attempting to solve the Servlets-4b assignment, I've noticing that my solution continues to become more and more convoluted and it still does not produce some of the desired results.
After reading the intent of the assignment, it seemed to me that the containers built-in authentication api or
servlet filters could be well suited to solving this problem. However, the assignment deliverables did not show that these features are used as a solution. So I attempted to mimic filters by decorating/wrapping my application ActionHandler classes with a subclass containing authentication logic. My thought being, I+ didn't want to duplicate all of this code in each action handler, so instead I'd wrap the authentication logic around the application logic.
So everything work good upon until a certain point. The Authentication sub-class .doAction() is called, the object detects that there so no authentication cookie set, so it forwards the ServletData object to the videologin.jsp rather than the actionhandler designated in by the "action" in ServletData request object.
The password is then entered by the user using the webpage rendered by the videologin.jsp, the container sends to new request and response objects back to ActionServlet, which then finds the "login" action handler. The login action handler creates the cookie and adds it to the ServletData and then *forwards* the request/response objects to .... ???; Well the login action handler doesn't know who called it so it doesn't have another
JSP to redirect its response to, and it doesn't know which action handler was responsible for its invocation. So at this point, I'm stuck.
However not wanting to hold up the rest of the assignment design for this little problem, I continued
testing the login actionhandler by hard coding the "com.javaranch.drive.video.VideoServlet" in the forward and I set a desired "action" for testing in the ServletData object. But at this point I get errors emitted from the container once the forward() is processed.
So, does anyone have a little advice to offer on a good design practices to use for password authentication using cookies? I probably wouldn't need to ask this question if I had more experience with Servlets.