Pax Web parses @WebServlet and @WebFilter annotations, but a little buggy
(ignore "name" property of @WebServlet, so if you need a filter on it, use
whiteboard constant for it).
In your case, to declare multiple values for property just add two
properties with same key:
@Component(
property= {"osgi.http.whiteboard.servlet.pattern=/ukelonn /*",
  "osgi.http.whiteboard.servlet.pattern=/VAADIN /*"},
service=Servlet.class
)
or with constans of OSGI Annotations:
@Component(
property= { HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN+"=/
ukelonn /*",
  HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN+"=/VAADIN /*"},
service=Servlet.class
)
For webfilter do not
use HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_SERVLET
("osgi.http.whiteboard.filter.servlet") because of bug (pax web ignore it)
use "servletNames" service property for workaround, or @WebFilter
annotation with specified "servletNames" property.


2018-03-17 1:17 GMT+03:00 Steinar Bang <[email protected]>:

> >>>>> Steinar Bang <[email protected]>:
> >>>>> Steinar Bang <[email protected]>:
>
> >> I'm in the process of replacing my own home brewed "mini dependency
> >> injection"[1] with Declarative Services (DS).
>
> >> I'm wondering how to replace what I was doing here:
> >> https://github.com/steinarb/ukelonn/blob/b369b5768c08a1c6bb6fb422e2f462
> ca797c253f/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/
> UkelonnServletProvider.java#L57
>
> >> I can't quite remember what I was thinking about, half a year ago, but
> >> what @ServiceProperties contains, is added as service properties when
> >> registering the OSGi service:
> >> https://github.com/sbang/jsr330activator/blob/master/jsr330activator.
> implementation/src/main/java/no/steria/osgi/jsr330activator/
> implementation/ProviderAdapter.java#L161
>
> > I guess I was trying to do something like the activator in the sample
> > does:
> >  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#L67
>
> > I also think there may be no way of doing this with DS, where the docs
> > for the property argument of @Component, say:
> [snip!]
> >  String[] property() default {};
>
> > Ie. it's limited to what a .properties file can represent, which is a
> > list of name=value pairs, and no name=multiple-values.
>
> > But I will be happy to be proved wrong...:-)
>
> Looking at the pax whiteboard code, it looks like I might be able to use
> a @WebServlet annotation on a Servlet @Component...?
>  https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-
> web-extender-whiteboard/src/main/java/org/ops4j/pax/web/
> extender/whiteboard/internal/tracker/ServletTracker.java#L114
>  https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-
> web-api/src/main/java/org/ops4j/pax/web/utils/
> ServletAnnotationScanner.java#L40
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to