views:

782

answers:

4

I'm working on an OSGi-based application that uses org.osgi.service.http.HttpService which does not support the use of Servlet Filters.

Before I realised that I wouldn't be able to use Servlet Filters I was planning to apply a couple of existing Filters. These Filters set the appropriate HTTP headers to:

  • prevent caching of responses
  • control rendering in IE8 with the X-UA-Compatible header

What are my options here? I don't want to use meta elements to control caching since that technique is unreliable. Using a meta element to set the X-UA-Compatible header is probably acceptable, but I'd still be interested in alternative approaches.

+1  A: 

This issue for adding servlet filter support offers some potential workarounds.

Also:

Pax Web [extends] OSGi Http Service with better servlet support, filters, listeners, error pages and JSPs and some others in order to meet the latest versions of Servlet specs.

Simon Lieschke
+2  A: 

You can use dm Server to deploy WAR files directly into an OSGi environment. WARs that run in dm Server are fully WARs and fully bundles.

There is work underway to standardize what it means to be a WAR on OSGi. This spec is called the OSGi Web Container. Work is progressing very nicely and I'm a good way along with the reference implementation for it. I'll be making the alpha code of the RI available in 4-5 days along with a blog entry detailing the usage. Keep an eye on the SpringSource blog at blog.springsource.com.

I unfortunately can't link to dm Server because I'm a new user :(

Rob Harrop
[SpringSource.org dmServer site](http://www.springsource.org/dmserver) is the link Rob means.
Steve Powell
Strange -- the markup is different in a comment.
Steve Powell
A: 

Regarding Pax Web:

Examples on the paxweb/Examples page don't work.

For example, I enter this command:

pax-run scan-file:jar:mvn:org.ops4j.pax.web.samples/provision!/sample-helloworld-wc.bundles

than point my browser to:

http://localhost:8080/helloworld/wc

result:

Error 404 NOT_FOUND

Also, it is not clear for me from the documentation, if Pax Web would work inside of non-OSGI servlet engine, e.g. WebLogic, WebSphere.

Valery Tydykov
A: 

Pax web will not yet work inside a non-OSGI servlet engine (bridged mode). Apache Felix has a good solution for this at http://felix.apache.org.

Sten Roger