Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Be sure to place your web resources in your bundle under /OSGI-INF/webapp/my-web-app, because the static DefaultHttpContext of http-util-1.5.0 look in "/OSGI-INF/webapp/" + relativeUrl for resources ,which is especially needed for correctly serializing GWT RPC requests.

Warning: Never ever instantiate your own HttpContext, e.g. through org.clazzes.util.http.BasicHttpContext, if you want to share your HttpSession among bundles. clazzes.org's single-sign-on strategy builds heavily on session sharing, so in most cases, do not use your own HttpContext except you have a profound reason for doing so. The httpContext argument of the HttpServiceRegistrationListener is then intentionally left out, so the static DefaultHttpContext instance is used.

ResourceServlet's resourceClassLoaderHint is a bean of your choice, which consists of an instance of a class in your webapp bundle. The resource class loader hint will tell the ResourceServlet to deliver resources from the class loader deduced form this hint. The resource class loader should almost ever point to your webapp bundle's class loader, hence take a bean, which lives in your bundles class loader. Once said, I mean it!

Migrating projects from http-util versions prior to http-util-1.5.0

  1. Upgrade dependencies to http-util-1.5.0 and gwt-osgi-2.4.0.2, if applicable.
  2. Move all your deployed resources in the bundle from /WEB-INF to /OSGI-INF/webapp
    This might incur checking your service.xml and your pom.xml , maybe you have to move resources inside src/main/resources; especially check Include-Resources of maven bundle plugin configuration (e.g. in gwt project)
  3. Remove instances of BasicHttpContext
    This includes removing the httpContext property from your HttpServiceRegistrationListener bean.
  4. Prepend /OSGI-INF/webapp to the resourcePath property of your ResourceServlet bean
  5. Add an appropriate resourceClassLoaderHint to your ResourceServlet bean. (See the hints above for more explanations)

...