You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2021/05/23 19:54:37 UTC

[GitHub] [cxf] reta commented on a change in pull request #801: [CXF-8540] Fix logging event type of CORS preflight requests

reta commented on a change in pull request #801:
URL: https://github.com/apache/cxf/pull/801#discussion_r637593599



##########
File path: rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
##########
@@ -320,7 +322,7 @@ public EventType getEventType(Message message) {
      */
     private boolean isRESTFault(Message message) {
         Object opName = message.getExchange().get("org.apache.cxf.resource.operation.name");
-        if (opName == null) {
+        if (opName == null && !PREFLIGHT_PASSED.equals(message.getExchange().get(CORS_FILTER))) {

Review comment:
       Thanks for the PR @borcsokj , I think your solution relies heavily on internals of `CrossOriginResourceSharingFilter` but should not. By and large, anyone could come up with own CORS filter implementation and  `DefaultLogEventMapper` has to work as expected.
   
   I would suggest to rethink the approach and combine the checks of `opName` and `responseCode` (which should be available). In this case, even if operation is `null`, the `responseCode` would help to distinguish fault from non-fault, what do you think? Thank you.




-- 
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