Wicket
  1. Wicket
  2. WICKET-5435

Ajaxified version of WebSession#getClientInfo should be added

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.13.0
    • Fix Version/s: 6.13.0, 7.0.0-M1
    • Component/s: wicket
    • Labels:

      Description

      It would be nice to have Ajaxified version of WebSession#getClientInfo of of the box

      here is the link to the discussion: http://markmail.org/message/ex3hxtynnmnktzgy

      My implementation based on wicket quickstart is here: https://github.com/solomax/ajax-client-info/blob/master/src/main/java/org/ajax/ClientInfoBehavior.java

      Thanks in advance

        Activity

        Hide
        Paul Bors added a comment -

        I've used this many times before:

                add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) {
                    @Override
                    protected void onTimer(AjaxRequestTarget target) {
                        ajaxEnabled = (target != null);
                        stop(target);
                    }
                });
        

        Mostly because getClientInfo() is not around out of the box and I needed to know if JS is turned on in the client browser.

        Show
        Paul Bors added a comment - I've used this many times before: add( new AbstractAjaxTimerBehavior(Duration.seconds(1)) { @Override protected void onTimer(AjaxRequestTarget target) { ajaxEnabled = (target != null ); stop(target); } }); Mostly because getClientInfo() is not around out of the box and I needed to know if JS is turned on in the client browser.
        Hide
        Martin Grigorov added a comment -

        Branch '5435-ajax-browser-info' contains the Ajax-y version of BrowserInfoForm.
        There is also an example at http://localhost:8080/ajaxhellobrowser

        https://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=commitdiff;h=90235c1c2ef7eb6ffa9d5d836ce7d0a398ca2821

        Please try it and give feedback.

        Show
        Martin Grigorov added a comment - Branch '5435-ajax-browser-info' contains the Ajax-y version of BrowserInfoForm. There is also an example at http://localhost:8080/ajaxhellobrowser https://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=commitdiff;h=90235c1c2ef7eb6ffa9d5d836ce7d0a398ca2821 Please try it and give feedback.
        Hide
        Maxim Solodovnik added a comment -

        Thanks Martin!
        you version works as expected!
        The thing I would like to change is: it require <div wicket:id="form"></div> to work

        My version implemented as behavior, maybe there is an option to make it behavior?

        Show
        Maxim Solodovnik added a comment - Thanks Martin! you version works as expected! The thing I would like to change is: it require <div wicket:id="form"></div> to work My version implemented as behavior, maybe there is an option to make it behavior?
        Hide
        Martin Grigorov added a comment -

        My approach uses a normal Panel to deliver the <form> and all its form components. The form is positioned in an invisible area of the display so it doesn't affect the page UI.

        Your approach in ClientInfoBehavior uses a lot of magic that I personally do not like.
        Maybe there is a middle ground by using Wicket's BorderBehavior but again I think it will complicate the code a lot for no big benefit.

        Show
        Martin Grigorov added a comment - My approach uses a normal Panel to deliver the <form> and all its form components. The form is positioned in an invisible area of the display so it doesn't affect the page UI. Your approach in ClientInfoBehavior uses a lot of magic that I personally do not like. Maybe there is a middle ground by using Wicket's BorderBehavior but again I think it will complicate the code a lot for no big benefit.
        Hide
        Martin Grigorov added a comment -

        Actually we can use plain Ajax behavior that does what Paul Bors did above. The extension would be to send dynamic extra parameters for all things we submit now with the form.
        The benefit is that it will be easy to extend from developers to add more properties.
        The drawback is that it will not reuse anything from the current BrowserInfo related classes.

        Show
        Martin Grigorov added a comment - Actually we can use plain Ajax behavior that does what Paul Bors did above. The extension would be to send dynamic extra parameters for all things we submit now with the form. The benefit is that it will be easy to extend from developers to add more properties. The drawback is that it will not reuse anything from the current BrowserInfo related classes.
        Hide
        Maxim Solodovnik added a comment -

        Additional benefit will be: you can use the behavior exactly where necessary without any markup changes ...
        Actually both approaches will work for me right now, since we currently using "single page" application

        Show
        Maxim Solodovnik added a comment - Additional benefit will be: you can use the behavior exactly where necessary without any markup changes ... Actually both approaches will work for me right now, since we currently using "single page" application
        Hide
        Martin Grigorov added a comment -

        The branch is updated.
        Please review.

        Show
        Martin Grigorov added a comment - The branch is updated. Please review.
        Hide
        Maxim Solodovnik added a comment -

        I like this version
        Please release it (I'll remove my current hacks )

        Thanks!

        Show
        Maxim Solodovnik added a comment - I like this version Please release it (I'll remove my current hacks ) Thanks!
        Hide
        Ufuk Altin added a comment - - edited

        Sorry to dig this out, but after updateing to 6.13.0 we have some errors.

        We are calling getSession.getClientInfo in onInitialize in our TemplatePage. The first time, after the server restarts, we get an "Status 500 - Cannot call sendRedirect() after response has been committed" (see below).

        edit-start: Not only the first time. Every time a new browsser (maybe session) connects to it. edit-end

        Even when we comment this out we get the exception when we use the DateConverter (as this is somwhere calling getClientInfo as well).
        Unfortunatly I could not yet reproduce this on a startup wicket project.

        SEVERE: Servlet.service() for servlet [default] in context with path [/lsg-service-client] threw exception
        java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
        at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:483)
        at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:138)
        at org.springframework.security.web.firewall.FirewalledResponse.sendRedirect(FirewalledResponse.java:25)
        at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:138)
        at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.sendRedirect(SaveContextOnUpdateOrErrorResponseWrapper.java:107)
        at org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:268)
        at org.apache.wicket.protocol.http.BufferedWebResponse$SendRedirectAction.invoke(BufferedWebResponse.java:400)
        at org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:588)
        at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.stopBuffering(HeaderBufferingWebResponse.java:60)
        at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:97)
        at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:269)
        at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:94)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

        Show
        Ufuk Altin added a comment - - edited Sorry to dig this out, but after updateing to 6.13.0 we have some errors. We are calling getSession.getClientInfo in onInitialize in our TemplatePage. The first time, after the server restarts , we get an "Status 500 - Cannot call sendRedirect() after response has been committed" (see below). edit-start: Not only the first time. Every time a new browsser (maybe session) connects to it. edit-end Even when we comment this out we get the exception when we use the DateConverter (as this is somwhere calling getClientInfo as well). Unfortunatly I could not yet reproduce this on a startup wicket project. SEVERE: Servlet.service() for servlet [default] in context with path [/lsg-service-client] threw exception java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:483) at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:138) at org.springframework.security.web.firewall.FirewalledResponse.sendRedirect(FirewalledResponse.java:25) at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:138) at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.sendRedirect(SaveContextOnUpdateOrErrorResponseWrapper.java:107) at org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:268) at org.apache.wicket.protocol.http.BufferedWebResponse$SendRedirectAction.invoke(BufferedWebResponse.java:400) at org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:588) at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.stopBuffering(HeaderBufferingWebResponse.java:60) at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:97) at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:269) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:94) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722)
        Hide
        Martin Grigorov added a comment -

        Hi,

        I will review the change and try to find out how this error could happen.
        But it will be much simpler to fix if you can reproduce it in a quickstart app.

        Show
        Martin Grigorov added a comment - Hi, I will review the change and try to find out how this error could happen. But it will be much simpler to fix if you can reproduce it in a quickstart app.
        Hide
        Martin Grigorov added a comment -

        Please paste the rest of the stacktrace.
        Reviewing the changed code I see no obvious reason why this may happen.

        Show
        Martin Grigorov added a comment - Please paste the rest of the stacktrace. Reviewing the changed code I see no obvious reason why this may happen.
        Hide
        Martin Grigorov added a comment -

        The stacktrace doesn't help either.

        Put breakpoints at:

        • org.apache.wicket.protocol.http.BufferedWebResponse#setText(CharSequence)
        • org.apache.wicket.protocol.http.BufferedWebResponse#write(byte[])
        • org.apache.wicket.protocol.http.BufferedWebResponse#write(byte[], int, int)
        • org.apache.wicket.protocol.http.BufferedWebResponse#sendRedirect(String)

        Something uses any of the first three methods and then the redirect to the BrowserInfoPage fails. See what causes the text/binary write.

        Show
        Martin Grigorov added a comment - The stacktrace doesn't help either. Put breakpoints at: org.apache.wicket.protocol.http.BufferedWebResponse#setText(CharSequence) org.apache.wicket.protocol.http.BufferedWebResponse#write(byte[]) org.apache.wicket.protocol.http.BufferedWebResponse#write(byte[], int, int) org.apache.wicket.protocol.http.BufferedWebResponse#sendRedirect(String) Something uses any of the first three methods and then the redirect to the BrowserInfoPage fails. See what causes the text/binary write.
        Hide
        Ufuk Altin added a comment -

        I put the breakpoints in where you said, but non of those first three methods has been called. Only the the sendRedirect as following:
        1st Call - url: ./wicket/page?1
        2nd Call - url: ../../
        3rd Call - url: ./org.apache.wicket.markup.html.pages.BrowserInfoPage?2
        and the 3rd time it crashes.
        at the thired time the calling stack trace looks like:

        BufferedWebResponse.sendRedirect(String) line: 559
        HeaderBufferingWebResponse.sendRedirect(String) line: 117
        WebPageRenderer.redirectTo(Url, RequestCycle) line: 158
        WebPageRenderer.respond(RequestCycle) line: 317
        RenderPageRequestHandler.respond(IRequestCycle) line: 165
        RequestCycle$HandlerExecutor.respond(IRequestHandler) line: 861
        RequestCycle$HandlerExecutor(RequestHandlerStack).execute(IRequestHandler) line: 64
        RequestCycle.execute(IRequestHandler) line: 261
        RequestCycle.processRequest() line: 218
        RequestCycle.processRequestAndDetach() line: 289
        WicketFilter.processRequestCycle(RequestCycle, WebResponse, HttpServletRequest, HttpServletResponse, FilterChain) line: 259
        WicketFilter.processRequest(ServletRequest, ServletResponse, FilterChain) line: 201
        WicketFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 282
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 243
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 210
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 330
        FilterSecurityInterceptor.invoke(FilterInvocation) line: 118
        FilterSecurityInterceptor.doFilter(ServletRequest, ServletResponse, FilterChain) line: 84
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        ExceptionTranslationFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 113
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        SessionManagementFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 103
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        AnonymousAuthenticationFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 113
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        SecurityContextHolderAwareRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 154
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        RequestCacheAwareFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 45
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        LSGTamRequestHeaderAuthenticationFilter(AbstractPreAuthenticatedProcessingFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 94
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        WebAsyncManagerIntegrationFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain) line: 50
        WebAsyncManagerIntegrationFilter(OncePerRequestFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 108
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        SecurityContextPersistenceFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 87
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342
        FilterChainProxy.doFilterInternal(ServletRequest, ServletResponse, FilterChain) line: 192
        FilterChainProxy.doFilter(ServletRequest, ServletResponse, FilterChain) line: 160
        DelegatingFilterProxy.invokeDelegate(Filter, ServletRequest, ServletResponse, FilterChain) line: 344
        DelegatingFilterProxy.doFilter(ServletRequest, ServletResponse, FilterChain) line: 261
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 243
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 210
        StandardWrapperValve.invoke(Request, Response) line: 222
        StandardContextValve.invoke(Request, Response) line: 123
        StandardHostValve.invoke(Request, Response) line: 168
        ErrorReportValve.invoke(Request, Response) line: 99
        AccessLogValve.invoke(Request, Response) line: 929
        StandardEngineValve.invoke(Request, Response) line: 118
        CoyoteAdapter.service(Request, Response) line: 407
        Http11Processor(AbstractHttp11Processor<S>).process(SocketWrapper<S>) line: 1002
        Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler<S,P>).process(SocketWrapper<S>, SocketStatus) line: 585
        JIoEndpoint$SocketProcessor.run() line: 312
        ThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1110
        ThreadPoolExecutor$Worker.run() line: 603
        TaskThread(Thread).run() line: 722

        Show
        Ufuk Altin added a comment - I put the breakpoints in where you said, but non of those first three methods has been called. Only the the sendRedirect as following: 1st Call - url: ./wicket/page?1 2nd Call - url: ../../ 3rd Call - url: ./org.apache.wicket.markup.html.pages.BrowserInfoPage?2 and the 3rd time it crashes. at the thired time the calling stack trace looks like: BufferedWebResponse.sendRedirect(String) line: 559 HeaderBufferingWebResponse.sendRedirect(String) line: 117 WebPageRenderer.redirectTo(Url, RequestCycle) line: 158 WebPageRenderer.respond(RequestCycle) line: 317 RenderPageRequestHandler.respond(IRequestCycle) line: 165 RequestCycle$HandlerExecutor.respond(IRequestHandler) line: 861 RequestCycle$HandlerExecutor(RequestHandlerStack).execute(IRequestHandler) line: 64 RequestCycle.execute(IRequestHandler) line: 261 RequestCycle.processRequest() line: 218 RequestCycle.processRequestAndDetach() line: 289 WicketFilter.processRequestCycle(RequestCycle, WebResponse, HttpServletRequest, HttpServletResponse, FilterChain) line: 259 WicketFilter.processRequest(ServletRequest, ServletResponse, FilterChain) line: 201 WicketFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 282 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 243 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 210 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 330 FilterSecurityInterceptor.invoke(FilterInvocation) line: 118 FilterSecurityInterceptor.doFilter(ServletRequest, ServletResponse, FilterChain) line: 84 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 ExceptionTranslationFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 113 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 SessionManagementFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 103 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 AnonymousAuthenticationFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 113 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 SecurityContextHolderAwareRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 154 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 RequestCacheAwareFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 45 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 LSGTamRequestHeaderAuthenticationFilter(AbstractPreAuthenticatedProcessingFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 94 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 WebAsyncManagerIntegrationFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain) line: 50 WebAsyncManagerIntegrationFilter(OncePerRequestFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 108 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 SecurityContextPersistenceFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 87 FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse) line: 342 FilterChainProxy.doFilterInternal(ServletRequest, ServletResponse, FilterChain) line: 192 FilterChainProxy.doFilter(ServletRequest, ServletResponse, FilterChain) line: 160 DelegatingFilterProxy.invokeDelegate(Filter, ServletRequest, ServletResponse, FilterChain) line: 344 DelegatingFilterProxy.doFilter(ServletRequest, ServletResponse, FilterChain) line: 261 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 243 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 210 StandardWrapperValve.invoke(Request, Response) line: 222 StandardContextValve.invoke(Request, Response) line: 123 StandardHostValve.invoke(Request, Response) line: 168 ErrorReportValve.invoke(Request, Response) line: 99 AccessLogValve.invoke(Request, Response) line: 929 StandardEngineValve.invoke(Request, Response) line: 118 CoyoteAdapter.service(Request, Response) line: 407 Http11Processor(AbstractHttp11Processor<S>).process(SocketWrapper<S>) line: 1002 Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler<S,P>).process(SocketWrapper<S>, SocketStatus) line: 585 JIoEndpoint$SocketProcessor.run() line: 312 ThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1110 ThreadPoolExecutor$Worker.run() line: 603 TaskThread(Thread).run() line: 722
        Hide
        Ufuk Altin added a comment - - edited

        What we further do and figured out is the following in WicketApplication.init()

        getRequestCycleListeners().add(new AbstractRequestCycleListener() {
        @Override
        public void onRequestHandlerResolved(final RequestCycle cycle, final RequestHandler handler) {
        super.onRequestHandlerResolved(cycle, handler);

        if (!("server".equals(environment)) && handler instanceof IPageRequestHandler)

        { // if the line below is outcommented no error... with this line error... IRequestablePage page = ((IPageRequestHandler) handler).getPage(); .. some more code .. }

        else

        { updateJob.validateIfUpdateIsActive(cycle.getRequest().getOriginalUrl().getHost()); }

        }
        });

        Show
        Ufuk Altin added a comment - - edited What we further do and figured out is the following in WicketApplication.init() getRequestCycleListeners().add(new AbstractRequestCycleListener() { @Override public void onRequestHandlerResolved(final RequestCycle cycle, final RequestHandler handler) { super.onRequestHandlerResolved(cycle, handler); if (!("server".equals(environment)) && handler instanceof IPageRequestHandler) { // if the line below is outcommented no error... with this line error... IRequestablePage page = ((IPageRequestHandler) handler).getPage(); .. some more code .. } else { updateJob.validateIfUpdateIsActive(cycle.getRequest().getOriginalUrl().getHost()); } } });
        Hide
        Martin Grigorov added a comment -

        There must be something writing to HttpServletResponse' output (either #getWriter().write() or #getOutputStream.write()) before the call to #sendRedirect().

        Show
        Martin Grigorov added a comment - There must be something writing to HttpServletResponse' output (either #getWriter().write() or #getOutputStream.write()) before the call to #sendRedirect().
        Hide
        Ufuk Altin added a comment -

        Hey Martin,

        I set the breakpoints in the above mentioned Methodods, non of those where called. There is a method write(CharSequence sequence) which is called. Do you mean this one as well?

        Show
        Ufuk Altin added a comment - Hey Martin, I set the breakpoints in the above mentioned Methodods, non of those where called. There is a method write(CharSequence sequence) which is called. Do you mean this one as well?
        Hide
        Martin Grigorov added a comment -

        Yes. Any #write() method for Servlet response's writer and outputStream.
        What is the stacktrace ?

        Show
        Martin Grigorov added a comment - Yes. Any #write() method for Servlet response's writer and outputStream. What is the stacktrace ?
        Hide
        Ufuk Altin added a comment -

        Hey Martin,

        http://temp-host.com/download.php?file=ky21ys

        I ziped three files together as pasting here seamd to be tooo much. first ist the html output which is written.

        The other two are stack traces from where the write command is comming.

        Show
        Ufuk Altin added a comment - Hey Martin, http://temp-host.com/download.php?file=ky21ys I ziped three files together as pasting here seamd to be tooo much. first ist the html output which is written. The other two are stack traces from where the write command is comming.
        Hide
        Martin Grigorov added a comment -

        This looks OK. With REDIRECT_TO_BUFFER strategy (the default one) Wicket renders the page (BrowserInfoPage) in BufferedWebResponse and then makes a redirect (to ?2) and then just writes the buffered response into the http servlet response.

        But in your case it seems there is a call to HttpServletResponse's getWriter().write() or getOutputStream().write() before the redirect. From the provided info so far I cannot find out what that could be.

        If you can reproduce it in a quickstart then it would be much easy to debug it.

        Show
        Martin Grigorov added a comment - This looks OK. With REDIRECT_TO_BUFFER strategy (the default one) Wicket renders the page (BrowserInfoPage) in BufferedWebResponse and then makes a redirect (to ?2) and then just writes the buffered response into the http servlet response. But in your case it seems there is a call to HttpServletResponse's getWriter().write() or getOutputStream().write() before the redirect. From the provided info so far I cannot find out what that could be. If you can reproduce it in a quickstart then it would be much easy to debug it.

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Maxim Solodovnik
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development