Hi Steinar,

you have to decide if you want to do the Whiteboard approach, or Servlet 3
annotations.
If you want to use Whiteboard do as you alsready did.
If you want to use Servlet 3.0 annotations, make shure to define your
application to be a WebApplicationBundle (WAB).
In this case it needs a WebApplication-Context header in the manifest.
After that it's treated as any other WAR and all Servlet 3.0 annotations
are used.
The WAB makes sure it does have it's own context.
Similar to what the Whiteboard approach does.

regards, Achim

Am So., 28. Okt. 2018 um 20:10 Uhr schrieb Steinar Bang <[email protected]>:

> Is it possible to use servlet 3.0 api annotations with pax web whiteboard?
> Is it possible to define the whiteboard context in a simple manner?
>
> I'm currently using pax web whiteboard in apache karaf 4.1.5 (pax web
> 6.0.3, I think).
>
> But the current annotations are a bit cumbersome and clumsy, and example:
>
> https://github.com/steinarb/ukelonn/blob/8442f5df62bc973902085705c637e65c3bc00f8c/ukelonn.web.frontend/src/main/java/no/priv/bang/ukelonn/web/frontend/UkelonnServlet.java#L36
>  @Component(
>      property= {
>          HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN+"=/*",
>          HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT + "=(" +
> HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME +"=ukelonn)",
>          HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME+"=ukelonn"},
>      service=Servlet.class,
>      immediate=true
>  )
>  public class UkelonnServlet extends HttpServlet {
>      ...
>  }
>
> I've defined the whiteboard context using a ServletContextHelper
>
> https://github.com/steinarb/ukelonn/blob/8442f5df62bc973902085705c637e65c3bc00f8c/ukelonn.web.security/src/main/java/no/priv/bang/ukelonn/web/security/UkelonnServletContextHelper.java#L7
>
> From google searches I've seen indicated that servelet 3.0 api
> annotations will be picket up and used
>  https://nierbeck.de/2014/12/pax-web-4-1-whats-next/
>
> However, I can't figure out how to configure the servlet to use a
> whiteboard context?  The servlet 3.0 API doesn't seem to have a context
> as a concept.
>
> And I don't know if the resulting syntax will be nicer than the above
> example?  (if the syntax isn't nicer there isn't any point in
> switching...)
>
> Thanks!
>
>
> - Steinar
>
> --
> --
> ------------------
> 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.
>


-- 

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/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

-- 
-- 
------------------
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