Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2778

Set Application ThreadLocal in WicketSessionFilter

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.4.5
    • 1.4.8, 1.5-M1
    • wicket
    • None

    Description

      WicketSessionFilter currently only sets the Session ThreadLocal, but not the Application ThreadLocale.
      This leads to WicketRuntimeException when trying to get the Application using Application#get or Session#getApplication.
      It would be handy if the Application ThreadLocal would also be set in WicketSessionFilter.

      see also:
      http://old.nabble.com/Application-get-in-WicketSessionFilter-ts27862681.html#a27862681

      Attachments

        1. WICKET-2778.patch
          2 kB
          Jonas

        Activity

          jonas Jonas added a comment -

          I also attached a patch against
          https://svn.eu.apache.org/repos/asf/wicket/branches/wicket-1.4.x/wicket
          hoping that this will make it into the next release...?

          jonas Jonas added a comment - I also attached a patch against https://svn.eu.apache.org/repos/asf/wicket/branches/wicket-1.4.x/wicket hoping that this will make it into the next release...?

          Looks to me like you just broke WicketSessionFilter. Every request after the first, application is null (because the local application variable it is only set when looking up the sessionKey, which is the first time) and Application.set(application); fails:

          2010-05-21 15:54:39.706::WARN: /img
          java.lang.IllegalArgumentException: Argument application can not be null
          at org.apache.wicket.Application.set(Application.java:222)
          at org.apache.wicket.protocol.http.servlet.WicketSessionFilter.doFilter(WicketSessionFilter.java:197)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
          at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:363)

          lhunath Maarten Billemont added a comment - Looks to me like you just broke WicketSessionFilter. Every request after the first, application is null (because the local application variable it is only set when looking up the sessionKey, which is the first time) and Application.set(application); fails: 2010-05-21 15:54:39.706::WARN: /img java.lang.IllegalArgumentException: Argument application can not be null at org.apache.wicket.Application.set(Application.java:222) at org.apache.wicket.protocol.http.servlet.WicketSessionFilter.doFilter(WicketSessionFilter.java:197) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:363)

          People

            ivaynberg Igor Vaynberg
            jonas Jonas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: