OFBiz
  1. OFBiz
  2. OFBIZ-3988

Redirect from Http to Https causes double service call

    Details

      Description

      Hi guys,

      little patch a big effect
      The problem is, when you call a request over http, but the controller wants an https request, the RequestHandler make an redirect to https (which is indeed pretty cool). But this redirect causes that Events/ Services will be called twice.

      This can be avoided when we return from the Service/ Event directly after doing the redirect.

      Have a good day
      Sascha

        Activity

        Hide
        Scott Gray added a comment -

        Looks good to me

        Show
        Scott Gray added a comment - Looks good to me
        Hide
        Sascha Rodekamp added a comment -

        Thanks Scott, for review!

        Show
        Sascha Rodekamp added a comment - Thanks Scott, for review!
        Hide
        Jacques Le Roux added a comment -

        Hi Sascha,

        Have you a clear OOTB use case to test quickly test the issue and the fix?

        Thanks

        Show
        Jacques Le Roux added a comment - Hi Sascha, Have you a clear OOTB use case to test quickly test the issue and the fix? Thanks
        Hide
        Sascha Rodekamp added a comment -

        Hi Jacques,

        here is a example on the DEMO System:

        http://demo-trunk.ofbiz.apache.org:8080/ecommerce/control/setdistributor?distributor=4711

        Have a look in the log file, you will find something like:

        [ RequestHandler.java:694:INFO ] Sending redirect to: https://demo-trunk.ofbiz.apache.org:8443/ecommerce/control/setdistributor?distributor=4711, sessionId=6168538EE2980500EAC52585C21EB384.jvm1
        2010-11-09 14:27:33,593 (TP-Processor31) [ ThirdPartyEvents.java:175:WARN ] Cannot associate distributor since not logged in yet
        2010-11-09 14:27:33,594 (TP-Processor31) [ ThirdPartyEvents.java:175:WARN ] Cannot associate distributor since not logged in yet

        ThirdPartyEvents is called twice.

        Cheers
        Sascha

        Show
        Sascha Rodekamp added a comment - Hi Jacques, here is a example on the DEMO System: http://demo-trunk.ofbiz.apache.org:8080/ecommerce/control/setdistributor?distributor=4711 Have a look in the log file, you will find something like: [ RequestHandler.java:694:INFO ] Sending redirect to: https://demo-trunk.ofbiz.apache.org:8443/ecommerce/control/setdistributor?distributor=4711 , sessionId=6168538EE2980500EAC52585C21EB384.jvm1 2010-11-09 14:27:33,593 (TP-Processor31) [ ThirdPartyEvents.java:175:WARN ] Cannot associate distributor since not logged in yet 2010-11-09 14:27:33,594 (TP-Processor31) [ ThirdPartyEvents.java:175:WARN ] Cannot associate distributor since not logged in yet ThirdPartyEvents is called twice. Cheers Sascha
        Hide
        Jacques Le Roux added a comment -

        Sascha,

        Not quite sure, here are the two stacks I got:

        Daemon Thread [http-0.0.0.0-38443-5] (Suspended (breakpoint at line 175 in org.ofbiz.ecommerce.misc.ThirdPartyEvents))
        org.ofbiz.ecommerce.misc.ThirdPartyEvents.updateAssociatedDistributor(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 175
        org.ofbiz.ecommerce.misc.ThirdPartyEvents.setAssociationId(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 90
        sun.reflect.GeneratedMethodAccessor148.invoke(java.lang.Object, java.lang.Object[]) line: not available
        sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 25
        java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: 597
        org.ofbiz.webapp.event.JavaEventHandler.invoke(java.lang.String, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[], java.lang.Object[]) line: 92
        org.ofbiz.webapp.event.JavaEventHandler.invoke(org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 78
        org.ofbiz.webapp.control.RequestHandler.runEvent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, java.lang.String) line: 633
        org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 297
        org.ofbiz.webapp.control.ControlServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 224
        org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 617
        org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 717
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 290
        org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206
        org.ofbiz.webapp.control.ContextFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) line: 271
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 235
        org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206
        org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 233
        org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 191
        org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 127
        org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 102
        org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 109
        org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 555
        org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) line: 298
        org.apache.coyote.http11.Http11Processor.process(java.net.Socket) line: 857
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket) line: 588
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run() line: 489
        java.lang.Thread.run() line: 662

        Daemon Thread [http-0.0.0.0-38443-5] (Suspended (breakpoint at line 175 in org.ofbiz.ecommerce.misc.ThirdPartyEvents))
        org.ofbiz.ecommerce.misc.ThirdPartyEvents.updateAssociatedDistributor(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 175
        org.ofbiz.ecommerce.misc.ThirdPartyEvents.setAssociationId(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 90
        sun.reflect.GeneratedMethodAccessor148.invoke(java.lang.Object, java.lang.Object[]) line: not available
        sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 25
        java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: 597
        org.ofbiz.webapp.event.JavaEventHandler.invoke(java.lang.String, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[], java.lang.Object[]) line: 92
        org.ofbiz.webapp.event.JavaEventHandler.invoke(org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 78
        org.ofbiz.webapp.control.RequestHandler.runEvent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, java.lang.String) line: 633
        org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 379
        org.ofbiz.webapp.control.ControlServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 224
        org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 617
        org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 717
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 290
        org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206
        org.ofbiz.webapp.control.ContextFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) line: 271
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 235
        org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206
        org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 233
        org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 191
        org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 127
        org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 102
        org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 109
        org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 555
        org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) line: 298
        org.apache.coyote.http11.Http11Processor.process(java.net.Socket) line: 857
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket) line: 588
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run() line: 489
        java.lang.Thread.run() line: 662

        As you can see they are the same but the call from lines 297 and 379 in RequestHandler.doRequest. There are no calls from RequestHandler.java:694 in these stacks. So I think I still miss a piece in the puzzle (I use http://localhost:8080/ecommerce/control/main and then the URL you provided)

        Thanks

        Show
        Jacques Le Roux added a comment - Sascha, Not quite sure, here are the two stacks I got: Daemon Thread [http-0.0.0.0-38443-5] (Suspended (breakpoint at line 175 in org.ofbiz.ecommerce.misc.ThirdPartyEvents)) org.ofbiz.ecommerce.misc.ThirdPartyEvents.updateAssociatedDistributor(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 175 org.ofbiz.ecommerce.misc.ThirdPartyEvents.setAssociationId(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 90 sun.reflect.GeneratedMethodAccessor148.invoke(java.lang.Object, java.lang.Object[]) line: not available sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 25 java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: 597 org.ofbiz.webapp.event.JavaEventHandler.invoke(java.lang.String, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[], java.lang.Object[]) line: 92 org.ofbiz.webapp.event.JavaEventHandler.invoke(org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 78 org.ofbiz.webapp.control.RequestHandler.runEvent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, java.lang.String) line: 633 org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 297 org.ofbiz.webapp.control.ControlServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 224 org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 617 org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 717 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 290 org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206 org.ofbiz.webapp.control.ContextFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) line: 271 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 235 org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206 org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 233 org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 191 org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 127 org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 102 org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 109 org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 555 org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) line: 298 org.apache.coyote.http11.Http11Processor.process(java.net.Socket) line: 857 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket) line: 588 org.apache.tomcat.util.net.JIoEndpoint$Worker.run() line: 489 java.lang.Thread.run() line: 662 Daemon Thread [http-0.0.0.0-38443-5] (Suspended (breakpoint at line 175 in org.ofbiz.ecommerce.misc.ThirdPartyEvents)) org.ofbiz.ecommerce.misc.ThirdPartyEvents.updateAssociatedDistributor(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 175 org.ofbiz.ecommerce.misc.ThirdPartyEvents.setAssociationId(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 90 sun.reflect.GeneratedMethodAccessor148.invoke(java.lang.Object, java.lang.Object[]) line: not available sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 25 java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: 597 org.ofbiz.webapp.event.JavaEventHandler.invoke(java.lang.String, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[], java.lang.Object[]) line: 92 org.ofbiz.webapp.event.JavaEventHandler.invoke(org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 78 org.ofbiz.webapp.control.RequestHandler.runEvent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, java.lang.String) line: 633 org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 379 org.ofbiz.webapp.control.ControlServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 224 org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 617 org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 717 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 290 org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206 org.ofbiz.webapp.control.ContextFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) line: 271 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 235 org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206 org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 233 org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 191 org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 127 org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 102 org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 109 org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 555 org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) line: 298 org.apache.coyote.http11.Http11Processor.process(java.net.Socket) line: 857 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket) line: 588 org.apache.tomcat.util.net.JIoEndpoint$Worker.run() line: 489 java.lang.Thread.run() line: 662 As you can see they are the same but the call from lines 297 and 379 in RequestHandler.doRequest. There are no calls from RequestHandler.java:694 in these stacks. So I think I still miss a piece in the puzzle (I use http://localhost:8080/ecommerce/control/main and then the URL you provided) Thanks
        Hide
        Sascha Rodekamp added a comment -

        Hi Jacques, when you set a breakpoint in the Method you will see that the debuger stops twice.

        Cheers

        Show
        Sascha Rodekamp added a comment - Hi Jacques, when you set a breakpoint in the Method you will see that the debuger stops twice. Cheers
        Hide
        Jacques Le Roux added a comment -

        Hi Sasch,

        Which method, at which line? I have already tried to put some breakpoints here and there (for instance above at: Suspended (breakpoint at line 175 in org.ofbiz.ecommerce.misc.ThirdPartyEvents

        Show
        Jacques Le Roux added a comment - Hi Sasch, Which method, at which line? I have already tried to put some breakpoints here and there (for instance above at: Suspended (breakpoint at line 175 in org.ofbiz.ecommerce.misc.ThirdPartyEvents
        Hide
        Sascha Rodekamp added a comment -

        Doesn't matter Jacques.
        Just put a Breakpoint in an Event which is called from a request. This Request should use https. When you call the request from http ofbiz switches from http to https, and here is the bug, the event is called twice.
        Important is that the Event is called from a request which uses https and you type in your browser *http://...:*

        Show
        Sascha Rodekamp added a comment - Doesn't matter Jacques. Just put a Breakpoint in an Event which is called from a request. This Request should use https . When you call the request from http ofbiz switches from http to https, and here is the bug, the event is called twice. Important is that the Event is called from a request which uses https and you type in your browser * http://...:*
        Hide
        Jacques Le Roux added a comment -

        Sorry Sascha,

        I still don't get your point. Because if I apply your patch I still get 2 calls to the event

        For instance here are the 2 tasks (1st call, 2d call from the same request) shown above but this time with the patch applied

        Daemon Thread [http-0.0.0.0-28443-6] (Suspended (breakpoint at line 106 in org.ofbiz.ecommerce.misc.ThirdPartyEvents))
        org.ofbiz.ecommerce.misc.ThirdPartyEvents.updateAssociatedDistributor(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 106
        org.ofbiz.ecommerce.misc.ThirdPartyEvents.setAssociationId(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 90
        sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.reflect.Method, java.lang.Object, java.lang.Object[]) line: not available [native method]
        sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: not available
        sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: not available
        java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: not available
        org.ofbiz.webapp.event.JavaEventHandler.invoke(java.lang.String, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[], java.lang.Object[]) line: 92
        org.ofbiz.webapp.event.JavaEventHandler.invoke(org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 78
        org.ofbiz.webapp.control.RequestHandler.runEvent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, java.lang.String) line: 635
        org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 299
        org.ofbiz.webapp.control.ControlServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 230
        org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 617
        org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 717
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 290
        org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206
        org.ofbiz.webapp.control.ContextFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) line: 332
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 235
        org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206
        org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 233
        org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 191
        org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 127
        org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 102
        org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 109
        org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 555
        org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) line: 298
        org.apache.coyote.http11.Http11Processor.process(java.net.Socket) line: 857
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket) line: 588
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run() line: 489
        java.lang.Thread.run() line: not available

        Daemon Thread [http-0.0.0.0-28443-6] (Suspended (breakpoint at line 106 in org.ofbiz.ecommerce.misc.ThirdPartyEvents))
        org.ofbiz.ecommerce.misc.ThirdPartyEvents.updateAssociatedDistributor(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 106
        org.ofbiz.ecommerce.misc.ThirdPartyEvents.setAssociationId(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 90
        sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.reflect.Method, java.lang.Object, java.lang.Object[]) line: not available [native method]
        sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: not available
        sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: not available
        java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: not available
        org.ofbiz.webapp.event.JavaEventHandler.invoke(java.lang.String, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[], java.lang.Object[]) line: 92
        org.ofbiz.webapp.event.JavaEventHandler.invoke(org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 78
        org.ofbiz.webapp.control.RequestHandler.runEvent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, java.lang.String) line: 635
        org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 381
        org.ofbiz.webapp.control.ControlServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 230
        org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 617
        org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 717
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 290
        org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206
        org.ofbiz.webapp.control.ContextFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) line: 332
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 235
        org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206
        org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 233
        org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 191
        org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 127
        org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 102
        org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 109
        org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 555
        org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) line: 298
        org.apache.coyote.http11.Http11Processor.process(java.net.Socket) line: 857
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket) line: 588
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run() line: 489
        java.lang.Thread.run() line: not available

        As you can see the only difference are these lines
        org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 299
        org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 381

        But still 2 calls to the event. I did not digg further

        Show
        Jacques Le Roux added a comment - Sorry Sascha, I still don't get your point. Because if I apply your patch I still get 2 calls to the event For instance here are the 2 tasks (1st call, 2d call from the same request) shown above but this time with the patch applied Daemon Thread [http-0.0.0.0-28443-6] (Suspended (breakpoint at line 106 in org.ofbiz.ecommerce.misc.ThirdPartyEvents)) org.ofbiz.ecommerce.misc.ThirdPartyEvents.updateAssociatedDistributor(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 106 org.ofbiz.ecommerce.misc.ThirdPartyEvents.setAssociationId(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 90 sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.reflect.Method, java.lang.Object, java.lang.Object[]) line: not available [native method] sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: not available sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: not available java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: not available org.ofbiz.webapp.event.JavaEventHandler.invoke(java.lang.String, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[], java.lang.Object[]) line: 92 org.ofbiz.webapp.event.JavaEventHandler.invoke(org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 78 org.ofbiz.webapp.control.RequestHandler.runEvent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, java.lang.String) line: 635 org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 299 org.ofbiz.webapp.control.ControlServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 230 org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 617 org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 717 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 290 org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206 org.ofbiz.webapp.control.ContextFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) line: 332 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 235 org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206 org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 233 org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 191 org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 127 org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 102 org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 109 org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 555 org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) line: 298 org.apache.coyote.http11.Http11Processor.process(java.net.Socket) line: 857 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket) line: 588 org.apache.tomcat.util.net.JIoEndpoint$Worker.run() line: 489 java.lang.Thread.run() line: not available Daemon Thread [http-0.0.0.0-28443-6] (Suspended (breakpoint at line 106 in org.ofbiz.ecommerce.misc.ThirdPartyEvents)) org.ofbiz.ecommerce.misc.ThirdPartyEvents.updateAssociatedDistributor(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 106 org.ofbiz.ecommerce.misc.ThirdPartyEvents.setAssociationId(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 90 sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.reflect.Method, java.lang.Object, java.lang.Object[]) line: not available [native method] sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: not available sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: not available java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: not available org.ofbiz.webapp.event.JavaEventHandler.invoke(java.lang.String, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[], java.lang.Object[]) line: 92 org.ofbiz.webapp.event.JavaEventHandler.invoke(org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 78 org.ofbiz.webapp.control.RequestHandler.runEvent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.ofbiz.webapp.control.ConfigXMLReader$Event, org.ofbiz.webapp.control.ConfigXMLReader$RequestMap, java.lang.String) line: 635 org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 381 org.ofbiz.webapp.control.ControlServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 230 org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 617 org.ofbiz.webapp.control.ControlServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 717 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 290 org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206 org.ofbiz.webapp.control.ContextFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) line: 332 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 235 org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 206 org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 233 org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 191 org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 127 org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 102 org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 109 org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) line: 555 org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) line: 298 org.apache.coyote.http11.Http11Processor.process(java.net.Socket) line: 857 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket) line: 588 org.apache.tomcat.util.net.JIoEndpoint$Worker.run() line: 489 java.lang.Thread.run() line: not available As you can see the only difference are these lines org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 299 org.ofbiz.webapp.control.RequestHandler.doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, org.ofbiz.entity.GenericValue, org.ofbiz.entity.Delegator) line: 381 But still 2 calls to the event. I did not digg further
        Hide
        Sascha Rodekamp added a comment -

        hi Jacques how are you today,

        let me explain my test case, i think the log is (maybe) a little bit confusing.

        I set a breakpoint in the setAssociationId Method of the class ThirdPartyEvents.java.

        When i know call the request with *http://* (without patch)
        http://localhost:8080/ecommerce/control/setdistributor?distributor=4711

        The Debugger stops four times in the method. After applying the patch the debugger stops (only) two times in the message.

        So without the patch he tries to call the method two times for the http request and again two times for the https request. (can be seen in the request object, the first two have the secure attribute false and the second two true)

        I hope that makes my point a little bit clearer.

        Have a good day
        cheers Sascha

        Show
        Sascha Rodekamp added a comment - hi Jacques how are you today, let me explain my test case, i think the log is (maybe) a little bit confusing. I set a breakpoint in the setAssociationId Method of the class ThirdPartyEvents.java. When i know call the request with * http://* (without patch) http://localhost:8080/ecommerce/control/setdistributor?distributor=4711 The Debugger stops four times in the method. After applying the patch the debugger stops (only) two times in the message. So without the patch he tries to call the method two times for the http request and again two times for the https request. (can be seen in the request object, the first two have the secure attribute false and the second two true) I hope that makes my point a little bit clearer. Have a good day cheers Sascha
        Hide
        Jacques Le Roux added a comment -

        Thanks Sascha,

        Your patch is in trunk at r1040044, R10.04 at r1040045, R9.04 at r1040046 (maybe incomplete see comment)

        Thanks to your clear explanation, it was then a breeze to test. Tough one time I got something weird. Before applying the patch, the 1st request call did 2 non secured calls to setAssociationId and then 2 secured calls as you said. Then the next request call*s* (still with http://8080) did only 2 secured to setAssociationId. I was not able to reproduce though. Anyway your patch is the clear solution to this issue.

        Show
        Jacques Le Roux added a comment - Thanks Sascha, Your patch is in trunk at r1040044, R10.04 at r1040045, R9.04 at r1040046 (maybe incomplete see comment) Thanks to your clear explanation, it was then a breeze to test. Tough one time I got something weird. Before applying the patch, the 1st request call did 2 non secured calls to setAssociationId and then 2 secured calls as you said. Then the next request call*s* (still with http://8080 ) did only 2 secured to setAssociationId. I was not able to reproduce though. Anyway your patch is the clear solution to this issue.
        Hide
        Sascha Rodekamp added a comment -

        Cool Jacques, thank you.

        Have a good day.

        Show
        Sascha Rodekamp added a comment - Cool Jacques, thank you. Have a good day.

          People

          • Assignee:
            Jacques Le Roux
            Reporter:
            Sascha Rodekamp
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development