I'm in the process of transforming my sample webapp from an OSGi-fied
war to a plain OSGi bundle(*).
 https://github.com/steinarb/ukelonn/tree/using-vaadin/ukelonn.bundle

What I've done so far has the webapp working on "/", but I've lost the
"/ukelonn" web-contextpath.

Ie. it used to be http://localhost:8181/ukelonn but is now 
http://localhost:8181/

Is there a way to bring the web-context path back? Or will the
web-context path only work when using an OSGi-war?

This is what I've done so far:
 - Changed the packaging in the POM from "war" to "bundle"
 - Removed the following from the bundle config in the POM
  - The <_wab> element
  - The <Bundle-Classpath> element
  - The <Web-ContextPath> element (this is the element that contained
    the string I would like to get back)
  - Removed bundle:bundle from packaging
 - In the bundle activator
  - Wait for a WebContainer service, and then:
   - create a default HTTP context
   - register a Shiro event listener
   - register a Shiro filter
   - register the VAADIN servlet

For the VAADIN servlet to work, it has to be registered with the path
"/*" (if not it can't fetch its CSS and .js files and images).  Ie. I
can't register the servlet as "/ukelonn/*".

This is what I've tried to get the web-contextpath back, and that has
had no effect:
 - Create the httpcontext with the ID "ukelonn", ie.
            httpContext = webContainer.createDefaultHttpContext("ukelonne");
 - Add a context parameter (I have tried "path" as well as
   "context-path"):
            httpContext = webContainer.createDefaultHttpContext();
            Dictionary<String, Object> contextParams = new Hashtable<String, 
Object>();
            contextParams.put("context-path", "ukelonn");
            webContainer.setContextParam(contextParams, httpContext);
 - Putting the <Web-ContextPath> element back into the bundle config in
   the POM


(*) The next step after this will be to invert things and use the
    whiteboard pattern.  But I would like the registration-by-code way
    to work first

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