Thanks Tim.  That was the problem. I noticed that just after I sent the email 
but hadn’t had a chance to try it yet.  I pulled that from a YouTube video Ray 
Auge did way back in 2014 and sort of blindly regurgitated what I saw.

There’s something else I noticed though.  It would seem that it’s still 
necessary to define
Web-ContextPath .bnd file as it doesn’t appear to work without that.  Is that 
right?

From: Tim Ward <[email protected]>
Sent: Monday, October 22, 2018 4:28 PM
To: [email protected]
Subject: Re: Http Whiteboard

I’m pretty sure that your ServletContextHelper isn’t advertised as a service 
and is therefore invisible to the whiteboard. ServletContextHelper is not an 
interface so you need to be explicit.

Tim
Sent from my iPhone

On 22 Oct 2018, at 23:04, Leschke, Scott 
<[email protected]<mailto:[email protected]>> wrote:

I’ve in the process of trying to convert a couple of servlets over to user 
HttpWhiteboard. I looked online for an example and it seemed pretty straight 
forward.
Based on my understanding, I came up with the following but it doesn’t work. 
Jetty doesn’t have a myApp context. I assume there is something missing?

Help?

Scott


@Component(
       property  = {
              HTTP_WHITEBOARD_CONTEXT_NAME + '=' + ContextHelper.CTX_NAME,
              HTTP_WHITEBOARD_CONTEXT_PATH + '=' + ContextHelper.CTX_PATH
       }
)
public class ContextHelper
       extends org.osgi.service.http.context.ServletContextHelper
{
       public static final String CTX_NAME = "myApp";
       public static final String CTX_PATH = '/' + CTX_NAME;
}


@Component(
       name      = “myApp.listings",
       property  = {
              HTTP_WHITEBOARD_CONTEXT_SELECT  + "=(" + 
HTTP_WHITEBOARD_CONTEXT_NAME + '=' + ContextHelper.CTX_NAME + ')',
              HTTP_WHITEBOARD_SERVLET_NAME    + '=' + "MyApp Listings",
              HTTP_WHITEBOARD_SERVLET_PATTERN + '=' + "/list/*"
       },
       service   = Servlet.class,
       immediate = true)
@Designate(
       ocd = AppConfig.class)
public class Listings
       implements HttpServlet
{…}

Reply via email to