Hi David, I don't know the osgi-jax-rs-connector you're using but based on the issues I'd think it's using the HttpService (or Felix Whiteboard implementation). In that case you need to add a servlet context select filter to you servlet to make it use the same servlet context as the jax-rs connector. The required servlet context select filter value is mentioned in the Felix issue "(osgi.http.whiteboard.context.name=org.osgi.service.http)".
Regards, Bram On Mon, Apr 25, 2016 at 9:03 PM David Daniel <david.daniel.1...@gmail.com> wrote: > I seem to be bumping into a different problem. Similar to this > https://github.com/hstaudacher/osgi-jax-rs-connector/issues/99 where an > issue was opened here https://issues.apache.org/jira/browse/FELIX-4904 but > is closed for the version that I am using. My filter is getting called > when going to /test.html but not when going to /services/api which uses the > jersey library linked above. Is there a way to get my filter called for > either. Here is how I registered my filter > > @Component(service = {Filter.class}, > property = HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN + > "=/*") > > On Mon, Apr 25, 2016 at 1:08 PM, David Daniel <david.daniel.1...@gmail.com > > > wrote: > > > I found the issue. It was in the context name. It is working now. > Thank > > you so much for pointing me in the right direction. > > > > On Mon, Apr 25, 2016 at 12:56 PM, David Daniel < > > david.daniel.1...@gmail.com> wrote: > > > >> I think I see the pertinent error message. > >> > >> [main] DEBUG org.apache.felix.http.jetty - Ignoring unmatched Filter > >> service [javax.servlet.Filter] > >> > >> Is it because I try to pick up / on my filter pattern. > >> > >> On Mon, Apr 25, 2016 at 12:47 PM, David Daniel < > >> david.daniel.1...@gmail.com> wrote: > >> > >>> Carsten, > >>> > >>> I tried to register as a whiteboard service for the filter like this > >>> > >>> final HazelcastSessionFilter sessionFilter = new > >>> HazelcastSessionFilter(); > >>> final Dictionary<String, Object> filter1Props = new > >>> Hashtable<String, Object>(); > >>> > >>> > filter1Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, > >>> "/"); > >>> > >>> > filter1Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, > >>> "(" + > >>> HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + > "=sessionFilter)"); > >>> bc.registerService(Filter.class, sessionFilter, filter1Props); > >>> > >>> this comes from the example here > >>> > >>> > >>> > https://github.com/apache/felix/blob/trunk/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/Activator.java > >>> > >>> The init function is never called. Am I doing something wrong. Here > >>> are my log messages > >>> > >>> [INFO] Started Jetty 9.2.14.v20151106 at port(s) HTTP:8084 on context > >>> path / [minThreads=8,maxThreads=200,acceptors=1,selectors=4] > >>> [INFO] Detected extended HttpService. Filters enabled. > >>> [INFO] Http service whiteboard started > >>> > org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] > >>> : Enabling SLF4J API support. > >>> > org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] > >>> : Enabling Jakarta Commons Logging API support. > >>> > org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] > >>> : Enabling Log4J API support. > >>> > org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] > >>> : Enabling Avalon Logger API support. > >>> > org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] > >>> : Enabling JULI Logger API support. > >>> > org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] > >>> : Enabling Log4J v2 API support. Ignored FQCN: > >>> org.apache.logging.log4j.spi.AbstractLogger > >>> [WARNING] Deprecation warning: Filter registered through Apache Felix > >>> whiteboard service: [javax.servlet.Filter]. Please change your code to > the > >>> OSGi Http Whiteboard Service. > >>> [DEBUG] Reusing context with id [] > >>> > >>> I am not sure if that filter registered is the correct filter or my > cors > >>> filter but my assumption is that it is the session filter. > >>> > >>> On Sat, Apr 23, 2016 at 11:19 AM, Carsten Ziegeler < > cziege...@apache.org > >>> > wrote: > >>> > >>>> David Daniel wrote > >>>> > I noticed ExtHttpService is deprecated. Is there a better way to > >>>> register > >>>> > a filter now than the example here > >>>> > > >>>> > http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html > >>>> > > >>>> > >>>> Yes, the documentation is totally outdated. There is the Http > Whiteboard > >>>> Specification - it's part of the OSGi Compendium R6 and this is how > you > >>>> should do these things today. > >>>> > >>>> I think the examples in svn are updated. I'll probably update the docs > >>>> in some weeks if no one beats me to it. > >>>> > >>>> Regards > >>>> Carsten > >>>> -- > >>>> Carsten Ziegeler > >>>> Adobe Research Switzerland > >>>> cziege...@apache.org > >>>> > >>>> --------------------------------------------------------------------- > >>>> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org > >>>> For additional commands, e-mail: users-h...@felix.apache.org > >>>> > >>>> > >>> > >> > > >