Package me.nickhanson.codeforge.web
Class ChallengesServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
me.nickhanson.codeforge.web.ChallengesServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
@WebServlet(urlPatterns={"/challenges","/challenges/*"})
public class ChallengesServlet
extends jakarta.servlet.http.HttpServlet
Servlet for handling CRUD operations on Challenge entities.
Supports listing, creating, viewing, editing, and deleting challenges.
URL Patterns:
- GET /challenges : List all challenges (optionally filtered by difficulty)
- GET /challenges/new : Show form to create a new challenge
- POST /challenges : Create a new challenge
- GET /challenges/{id} : View details of a specific challenge
- GET /challenges/{id}/edit : Show form to edit an existing challenge
- POST /challenges/{id} : Update an existing challenge
- POST /challenges/{id}/delete : Delete a specific challenge
- Author:
- Nick Hanson
- 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 GET requests for listing, viewing, and editing challenges.protected voiddoPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Handles POST requests for creating, updating, and deleting challenges.voidinit()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
-
ChallengesServlet
public ChallengesServlet()
-
-
Method Details
-
init
public void init()- Overrides:
initin classjakarta.servlet.GenericServlet
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException Handles GET requests for listing, viewing, and editing challenges.- Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Parameters:
req- the HttpServletRequest objectresp- the HttpServletResponse object- Throws:
jakarta.servlet.ServletException- the servlet exceptionIOException- the IO exception
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws IOException Handles POST requests for creating, updating, and deleting challenges.- Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Parameters:
req- the HttpServletRequestresp- the HttpServletResponse- Throws:
IOException- if an I/O error occurs while sending redirect or error
-