Hi Chris,

there are plenty of different ways on how to register a Filter.
Take a look on all the different samples available at the Pax Web project
[1].
The integration tests use those samples and can be found here [2].
I regard a working sample much better then a documentation that you have to
adapt ever 1/2 year because the underlying documentation system changed the
way they interpret the wiki style.
Documentation is unfortunately the first to loose when you only have a
spare amount of time.

You have different ways of registering a filter, either the classical way
via Activator and the WebContainer service (an extended HttpService) [3].
Or you might want to register it the Whiteboard-Extender type style [4].
Another way of using the Whiteboard extender mechanism is to combine it
with blueprint. [5]


regards, Achim

[1] - https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples
[2] -
https://github.com/ops4j/org.ops4j.pax.web/tree/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty
[3] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/Activator.java#L73
[4] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/whiteboard/src/main/java/org/ops4j/pax/web/extender/samples/whiteboard/internal/Activator.java#L108
[5] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/whiteboard-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml#L67



2014-08-09 10:27 GMT+02:00 <[email protected]>:

> Talking about web services, has anyone succeeded in getting a
> javax.servlet.Filter to work, outside of a WAB?  According to the only
> usable documentation I have found[1] the magic property is "urlPatterns",
> and indeed this causes PAX Web to stop muttering that my servlet "did not
> contain a valid alias or url patterns property" and to announce that it
> was binding my bundle to "http service", but no joy. Even my init() method
> doesn't get called, never mind doFilter(). I've tried setting urlPatterns
> to a single String and to an array of Strings, using an exact path or a
> wildcard ("/*") or a regexp ("/.*"), without success.
>
> Thanks,
>
> Chris
>
>
> [1]
> https://ops4j1.jira.com/wiki/display/ops4j/Pax+Web+Extender+-+Whiteboard
> Yes, it's from 2009; but the more recent docs are even more broken, and in
> particular the links to the examples are dead.
>
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Reply via email to