Wicket
  1. Wicket
  2. WICKET-4334

Prevent Wicket from causing redundant download of stateless resources (.js, .css etc.,) on browser with cookies enabled

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.19, 1.5.4
    • Fix Version/s: 1.5.4, 6.0.0-beta1
    • Component/s: wicket
    • Environment:
      Client browser with cookies enabled.

      Description

      A jsessionid is added to package resource links of the first page visited, most of which are static and don't need session info for them to be rendered. For a new session in a browser with cookies enabled this causes a 'double load' of every package resource: once for the initial page (with jsessionid added) and again for the subsequent page (with no jsessionid added).

      Each time the user revisits the site with their previous session expired another (redundant) download of the package resources will occur (because they have a different jsessionid suffix)

      Examining the IE cache we can see that both the jsessionid suffixed version and the version without the jsessionid suffix have both been cached as it treats each as individual resources.

      This will cause a performance hit for users visiting a Wicket site for the first and subsequent times (after cookie expiration) on most average ADSL connections and might have an impact on bandwidth demand/cost on extremely busy Wicket powered web servers.

      Possible solution:

      Wicket always renders stateless resources without any jsessionid regardless of whether the page is stateful or stateless. When servicing a request for a resource without a jsessionid Wicket does not attempt to establish a session which avoids creating a Session on every stateless resource request.

        Issue Links

          Activity

          Hide
          Igor Vaynberg added a comment -

          packaged resources should not have a jsession id in 1.5.x. i thought we fixed this already...

          Show
          Igor Vaynberg added a comment - packaged resources should not have a jsession id in 1.5.x. i thought we fixed this already...
          Hide
          Chris Colman added a comment -

          I have an Open Persistence Provider in View filter (expojo) that attempts to retrieve or create a session on each request in order to make a persistence provider available but which can be told to ignore requests with a specified path pattern. I would like to tell it to ignore requests for wicket stateless package resources that don't need a session. Is it safe to say that all wicket requests starting with:

          /wicket/resource/

          are stateless package resources and therefore don't require a session?

          I trust Wicket itself won't attempt to establish a session for stateless wicket package resources.

          Show
          Chris Colman added a comment - I have an Open Persistence Provider in View filter (expojo) that attempts to retrieve or create a session on each request in order to make a persistence provider available but which can be told to ignore requests with a specified path pattern. I would like to tell it to ignore requests for wicket stateless package resources that don't need a session. Is it safe to say that all wicket requests starting with: /wicket/resource/ are stateless package resources and therefore don't require a session? I trust Wicket itself won't attempt to establish a session for stateless wicket package resources.
          Hide
          Martin Grigorov added a comment -

          No. /wicket/resource/... is used by all resources not mounted explicitly with webApp#mountResource().
          Only IStaticCachableResource doesn't require a session, all other impls may require...

          Show
          Martin Grigorov added a comment - No. /wicket/resource/... is used by all resources not mounted explicitly with webApp#mountResource(). Only IStaticCachableResource doesn't require a session, all other impls may require...
          Hide
          Chris Colman added a comment -

          It would be good if IStaticCacheableResource resources had a distinctive mount path so that we could easily configure filters to ignore them.

          For example if all IStaticCacheableResourceS were mounted under:

          /wicket/resource/cacheable

          we could easily configure a filter to ignore them.

          Show
          Chris Colman added a comment - It would be good if IStaticCacheableResource resources had a distinctive mount path so that we could easily configure filters to ignore them. For example if all IStaticCacheableResourceS were mounted under: /wicket/resource/cacheable we could easily configure a filter to ignore them.
          Hide
          Martin Grigorov added a comment -

          Let's move to the users@ list.

          Show
          Martin Grigorov added a comment - Let's move to the users@ list.
          Hide
          Chris Colman added a comment -

          While it's great wicket now renders static resource links without jsessionidS when such a resource is requested Wicket still attempts to establish a session when servicing requests for such a static resource according to the stack trace.

          I analyzed the stack trace and there is no direct attempt to explicitly establish a session but there is an implicit session establishment via a call to getSessionId. I doubt that call is needed to service a request for static resource.

          I wasn't sure if this should be entered as a separate issue or a continuance of this one.

          Show
          Chris Colman added a comment - While it's great wicket now renders static resource links without jsessionidS when such a resource is requested Wicket still attempts to establish a session when servicing requests for such a static resource according to the stack trace. I analyzed the stack trace and there is no direct attempt to explicitly establish a session but there is an implicit session establishment via a call to getSessionId. I doubt that call is needed to service a request for static resource. I wasn't sure if this should be entered as a separate issue or a continuance of this one.
          Hide
          Martin Grigorov added a comment -

          What's the stacktrace ?

          Show
          Martin Grigorov added a comment - What's the stacktrace ?
          Hide
          Chris Colman added a comment -

          Found the cause - Everything was working fine in our IDE but problem in deployment build meant it pulled old wicket jars!

          Show
          Chris Colman added a comment - Found the cause - Everything was working fine in our IDE but problem in deployment build meant it pulled old wicket jars!
          Hide
          Martin Grigorov added a comment -

          Please take a look at WICKET-4550 and comment your view.
          We may need to revert the change for this ticket...

          Show
          Martin Grigorov added a comment - Please take a look at WICKET-4550 and comment your view. We may need to revert the change for this ticket...

            People

            • Assignee:
              Martin Grigorov
              Reporter:
              Chris Colman
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development