diff --git a/src/main/java/de/thm/arsnova/controller/AbstractController.java b/src/main/java/de/thm/arsnova/controller/AbstractController.java index bdb2d8f7eb724935efa44e643ef44611b98bb254..664ffffabfceef51facb10e913616b002b0d7bea 100644 --- a/src/main/java/de/thm/arsnova/controller/AbstractController.java +++ b/src/main/java/de/thm/arsnova/controller/AbstractController.java @@ -23,4 +23,12 @@ package de.thm.arsnova.controller; public class AbstractController { protected static final String X_DEPRECATED_API = "X-Deprecated-API"; protected static final String X_FORWARDED = "X-Forwarded"; + protected static final String HTML_STATUS_200 = "OK"; + protected static final String HTML_STATUS_201 = "Created"; + protected static final String HTML_STATUS_204 = "No Content"; + protected static final String HTML_STATUS_400 = "Bad request"; + protected static final String HTML_STATUS_403 = "Forbidden"; + protected static final String HTML_STATUS_404 = "Not Found"; + protected static final String HTML_STATUS_501 = "Not Implemented"; + protected static final String HTML_STATUS_503 = "Service Unavailable"; } diff --git a/src/main/java/de/thm/arsnova/controller/AudienceQuestionController.java b/src/main/java/de/thm/arsnova/controller/AudienceQuestionController.java index 1e7fdbc26c331cc15b0efc8a9e57a07294ad98e2..2f60da21dd009c4e363e9321aab34b89a72d8b24 100644 --- a/src/main/java/de/thm/arsnova/controller/AudienceQuestionController.java +++ b/src/main/java/de/thm/arsnova/controller/AudienceQuestionController.java @@ -93,7 +93,7 @@ public class AudienceQuestionController extends PaginationController { @ApiOperation(value = "Creates a new Interposed Question for a Session and returns the InterposedQuestion's data", nickname = "postInterposedQuestion") @ApiResponses(value = { - @ApiResponse(code = 400, message = "Bad Request - The Api cannot or will not process the request due to something that is perceived to be a client error") + @ApiResponse(code = 400, message = HTML_STATUS_400) }) @RequestMapping(value = "/", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) diff --git a/src/main/java/de/thm/arsnova/controller/CourseController.java b/src/main/java/de/thm/arsnova/controller/CourseController.java index f365f8cb77f10f605857b66e045cb980ad85736e..7975975d8f6df808357b29b913e8681b1e87b2c9 100644 --- a/src/main/java/de/thm/arsnova/controller/CourseController.java +++ b/src/main/java/de/thm/arsnova/controller/CourseController.java @@ -62,7 +62,7 @@ public class CourseController extends AbstractController { @ApiOperation(value = "retrieves a User Courses", nickname = "myCourses") @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful API requests") + @ApiResponse(code = 200, message = HTML_STATUS_200) }) @RequestMapping(value = "/mycourses", method = RequestMethod.GET) public List<Course> myCourses( diff --git a/src/main/java/de/thm/arsnova/controller/FeedbackController.java b/src/main/java/de/thm/arsnova/controller/FeedbackController.java index 800b12cd8ffa37a0ae87197bf810c5b2dddd2318..91280b70b57bb277becdb3697491c1146159436e 100644 --- a/src/main/java/de/thm/arsnova/controller/FeedbackController.java +++ b/src/main/java/de/thm/arsnova/controller/FeedbackController.java @@ -70,7 +70,7 @@ public class FeedbackController extends AbstractController { @ApiOperation(value = "Get own feedback from a session", nickname = "getMyFeedback") @ApiResponses(value = { - @ApiResponse(code = 404, message = "Not Found - The requested resource could not be found but may be available again in the future.") + @ApiResponse(code = 404, message = HTML_STATUS_404) }) @DeprecatedApi @Deprecated @@ -111,7 +111,7 @@ public class FeedbackController extends AbstractController { @ApiOperation(value = "Post feedback for a session", nickname = "postFeedback") @ApiResponses(value = { - @ApiResponse(code = 404, message = "Not Found - The requested resource could not be found but may be available again in the future.") + @ApiResponse(code = 404, message = HTML_STATUS_404) }) @DeprecatedApi @Deprecated diff --git a/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java b/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java index 2df69c77bbac2a0edf04b783a090c4962244dcd4..a63e6cff5216ef22d3a54d436061af6f25397449 100644 --- a/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java +++ b/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java @@ -67,7 +67,7 @@ public class LecturerQuestionController extends PaginationController { @ApiOperation(value = "Get question with provided question Id", nickname = "getQuestion") @ApiResponses(value = { - @ApiResponse(code = 404, message = "Not Found - The requested resource could not be found but may be available again in the future.") + @ApiResponse(code = 404, message = HTML_STATUS_404) }) @RequestMapping(value = "/{questionId}", method = RequestMethod.GET) public Question getQuestion(@PathVariable final String questionId) { @@ -82,7 +82,7 @@ public class LecturerQuestionController extends PaginationController { @ApiOperation(value = "Post provided question", nickname = "postQuestion") @ApiResponses(value = { - @ApiResponse(code = 400, message = "Bad Request - The Api cannot or will not process the request due to something that is perceived to be a client error") + @ApiResponse(code = 400, message = HTML_STATUS_400) }) @RequestMapping(value = "/", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) @@ -96,7 +96,7 @@ public class LecturerQuestionController extends PaginationController { @ApiOperation(value = "Update the question, identified by provided id, with the provided question in the Request Body", nickname = "updateQuestion") @ApiResponses(value = { - @ApiResponse(code = 400, message = "Bad Request - The Api cannot or will not process the request due to something that is perceived to be a client error") + @ApiResponse(code = 400, message = HTML_STATUS_400) }) @RequestMapping(value = "/{questionId}", method = RequestMethod.PUT) public Question updateQuestion( @@ -619,7 +619,7 @@ public class LecturerQuestionController extends PaginationController { @ApiOperation(value = "Set the sort order of the subjects from a session, identified by the sessionkey", nickname = "setSubjectSortOrder") @ApiResponses(value = { - @ApiResponse(code = 400, message = "Bad Request - The Api cannot or will not process the request due to something that is perceived to be a client error") + @ApiResponse(code = 400, message = HTML_STATUS_400) }) @RequestMapping(value = "/subjectsort", method = RequestMethod.POST) public void setSubjectSortOrder( @@ -648,7 +648,7 @@ public class LecturerQuestionController extends PaginationController { @ApiOperation(value = "Set the sort order of the questions from a subject in a session, identified by the sessionkey", nickname = "setQuestionSortOrder") @ApiResponses(value = { - @ApiResponse(code = 400, message = "Bad Request - The Api cannot or will not process the request due to something that is perceived to be a client error") + @ApiResponse(code = 400, message = HTML_STATUS_400) }) @RequestMapping(value = "/questionsort", method = RequestMethod.POST) public void setQuestionSortOrder( @@ -668,7 +668,7 @@ public class LecturerQuestionController extends PaginationController { @ApiOperation(value = "Get the sort order of the questions from a subject in a session, identified by the sessionkey", nickname = "getQuestionSortType") @ApiResponses(value = { - @ApiResponse(code = 204, message = "No Content - successfully processed the request") + @ApiResponse(code = 204, message = HTML_STATUS_204) }) @RequestMapping(value = "/questionsort", method = RequestMethod.GET) public String getQuestionSortType( diff --git a/src/main/java/de/thm/arsnova/controller/SessionController.java b/src/main/java/de/thm/arsnova/controller/SessionController.java index 18ed900f7c8f931568b1cc9e765eca03498edae8..63eb9dd43dd77d5eb98b13e57472abcc729adcf6 100644 --- a/src/main/java/de/thm/arsnova/controller/SessionController.java +++ b/src/main/java/de/thm/arsnova/controller/SessionController.java @@ -100,8 +100,8 @@ public class SessionController extends PaginationController { @ApiOperation(value = "Creates a new Session and returns the Session's data", nickname = "postNewSession") @ApiResponses(value = { - @ApiResponse(code = 201, message = "The request has been fulfilled and resulted in a new resource being created"), - @ApiResponse(code = 503, message = "Service Unavailable - The Api is currently unavailable (because it is overloaded or down for maintenance)") + @ApiResponse(code = 201, message = HTML_STATUS_201), + @ApiResponse(code = 503, message = HTML_STATUS_503) }) @RequestMapping(value = "/", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) @@ -142,8 +142,8 @@ public class SessionController extends PaginationController { @ApiOperation(value = "Retrieves a list of Sessions", nickname = "getSessions") @ApiResponses(value = { - @ApiResponse(code = 204, message = "No Content - successfully processed the request"), - @ApiResponse(code = 501, message = "Not implemented - The Api either does not recognize the request method, or it lacks the ability to fulfil the request") + @ApiResponse(code = 204, message = HTML_STATUS_204), + @ApiResponse(code = 501, message = HTML_STATUS_501) }) @RequestMapping(value = "/", method = RequestMethod.GET) @Pagination @@ -192,7 +192,7 @@ public class SessionController extends PaginationController { @ApiOperation(value = "Retrieves a Session", nickname = "getMySessions") @ApiResponses(value = { - @ApiResponse(code = 204, message = "No Content - successfully processed the request") + @ApiResponse(code = 204, message = HTML_STATUS_204) }) @RequestMapping(value = "/", method = RequestMethod.GET, params = "statusonly=true") @Pagination @@ -224,7 +224,7 @@ public class SessionController extends PaginationController { @ApiOperation(value = "Retrieves all public pool sessions for the current user", nickname = "getMyPublicPoolSessions") @ApiResponses(value = { - @ApiResponse(code = 204, message = "No Content - successfully processed the request") + @ApiResponse(code = 204, message = HTML_STATUS_204) }) @RequestMapping(value = "/publicpool", method = RequestMethod.GET, params = "statusonly=true") public List<SessionInfo> getMyPublicPoolSessions( @@ -243,7 +243,7 @@ public class SessionController extends PaginationController { @ApiOperation(value = "Retrieves all public pool sessions", nickname = "getMyPublicPoolSessions") @ApiResponses(value = { - @ApiResponse(code = 204, message = "No Content - successfully processed the request") + @ApiResponse(code = 204, message = HTML_STATUS_204) }) @RequestMapping(value = "/publicpool", method = RequestMethod.GET) public List<SessionInfo> getPublicPoolSessions( @@ -272,7 +272,7 @@ public class SessionController extends PaginationController { @ApiOperation(value = "Locks or unlocks a Session", nickname = "lockSession") @ApiResponses(value = { - @ApiResponse(code = 404, message = "Not Found - The requested resource could not be found but may be available again in the future") + @ApiResponse(code = 404, message = HTML_STATUS_404) }) @RequestMapping(value = "/{sessionkey}/lock", method = RequestMethod.POST) public Session lockSession( diff --git a/src/main/java/de/thm/arsnova/controller/SocketController.java b/src/main/java/de/thm/arsnova/controller/SocketController.java index fe3eca592a57f7ebb8197729abcf4a9b2ecd8e5e..e6de3faf268b93db54a2e391234fc47cd1732ec9 100644 --- a/src/main/java/de/thm/arsnova/controller/SocketController.java +++ b/src/main/java/de/thm/arsnova/controller/SocketController.java @@ -65,9 +65,9 @@ public class SocketController extends AbstractController { @ApiOperation(value = "requested to assign Websocket session", nickname = "authorize") @ApiResponses(value = { - @ApiResponse(code = 204, message = "No Content - successfully processed the request"), - @ApiResponse(code = 400, message = "Bad Request - The Api cannot or will not process the request due to something that is perceived to be a client error"), - @ApiResponse(code = 403, message = "Forbidden - The request was a valid request, but the Api is refusing to respond to it") + @ApiResponse(code = 204, message = HTML_STATUS_204), + @ApiResponse(code = 400, message = HTML_STATUS_400), + @ApiResponse(code = 403, message = HTML_STATUS_403) }) @RequestMapping(method = RequestMethod.POST, value = "/assign") public void authorize(@ApiParam(value="sessionMap", required=true) @RequestBody final Map<String, String> sessionMap, @ApiParam(value="response", required=true) final HttpServletResponse response) {