I'm trying to replace alias with web context for a whiteboard servlet
started with DS.  I tried to copy-paste an example that works and edit
it as needed.

However the end result didn't work (I just got 404 on the path), and I
wonder where I went wrong...?

I have this servlet that works, ie. I get the expected results on
"/ukelonn/*":
@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=VaadinServlet.class,
    immediate=true
)
public class UkelonnServlet extends TouchKitServlet {
  ...
}

(it sort of works if the service is Servlet.class as well, just not as
well)

So I have this:
@Component(service={Servlet.class}, property={"alias=/frontend-karaf-demo"} )
public class ReactServlet extends HttpServlet {
   ...
}

and tried replacing this with:
@Component(
    property= {
        HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN+"=/*",
        HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT + "=(" + 
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME +"=frontend-karaf-demo)",
        
HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME+"=frontend-karaf-demo"},
    service=Servlet.class,
    immediate=true
)
public class ReactServlet extends HttpServlet {
   ...
}

But that just gave me 404 on /frontend-karaf-demo and
/frontend-karaf-demo/

So where did I go wrong?

Thanks!

Reply via email to