You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by GitBox <gi...@apache.org> on 2021/03/31 15:13:37 UTC

[GitHub] [unomi] jkevan commented on a change in pull request #273: UNOMI-449 : forward existing endpoints to jax-rs endpoints

jkevan commented on a change in pull request #273:
URL: https://github.com/apache/unomi/pull/273#discussion_r604981886



##########
File path: wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
##########
@@ -61,182 +44,23 @@ public void destroy() {
     }
 
     @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        try {
-            doEvent(req, resp);
-        } catch (Throwable t) { // Here in order to return generic message instead of the whole stack trace in case of not caught exception
-            logger.error("EventsCollectorServlet failed to execute get", t);
-            resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal server error");
-        }
+    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        HttpServletRequestForwardWrapper.forward(request, response);
     }
 
     @Override
-    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        try {
-            doEvent(req, resp);
-        } catch (Throwable t) { // Here in order to return generic message instead of the whole stack trace in case of not caught exception
-            logger.error("EventsCollectorServlet failed to execute post", t);
-            resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal server error");
-        }
+    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        HttpServletRequestForwardWrapper.forward(request, response);
     }
 
     @Override
     protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

Review comment:
       Why not using the options implem of the endpoint by just forwarding the request here ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org