My apologies, this seems indeed to match behavior on a deployed jetty servlet _if_ we assume that the deployment URL is / http://old.nabble.com/file/p30110490/my-webapp.zip my-webapp.zip this uses same exact HelloWorld.java, do: mvn clean install jetty:run when you see: [INFO] Started Jetty Server do, in another terminal: wget http://localhost:8080/my-webapp/hello -q and you will indeed see: !!! [/my-webapp] !!! [/home/misha/tmp/my-webapp/src/main/webapp/] rather than /my-webapp/hello
Fyi, here is a version with Eclipse Equinox, unfortunately, same results :( except Eclipse Equinox does not support Servlet 2.5: http://old.nabble.com/file/p30110490/test.equinox.zip test.equinox.zip For reference: to compile and run http://old.nabble.com/file/p30101499/test.zip test.zip use mvn clean install pax:provision. Thank you misha680 wrote: > > http://old.nabble.com/file/p30101499/test.zip test.zip > > Sorry to reply so quickly, but as promised, here is a quick test case. > > I don't know how to wait for the HttpService to become ready. Thus, once > started, you will have to do: > > stop 3 > > Then wait for the message: > > [INFO] Started jetty 6.1.x at port 8080 > > Then do > > start 3 > > You will then see the following output: > > STARTING org.example.pkg > REGISTER org.example.pkg.ExampleService > !!! [] > !!! [/] > REGISTER hello servlet > > Thank you > > Yours > Misha > > > misha680 wrote: >> >> Dear All: >> >> My apologies I do not currently have a simple test case (I tried to get >> one ready but it does not seem to be provisioning properly at the >> moment). Please bear with me if possible. >> >> I am tackling http://tickets.openmrs.org/browse/TRUNK-1596 (OSGi >> conversion of a Spring/Hibernate/etc/etc project). >> >> I have made some progress using Spring DM extender, but am not trying to >> generalize to the OSGI http service. >> >> Specifically, Felix HTTP service seems like a great match as: >> * it allows easy embedding as shown in >> org.apache.felix.http-2.0.4/samples/bridge/ >> * per http://felix.apache.org/site/apache-felix-http-service.html, >> "org.apache.felix.http.proxy - Proxy that is needed inside WAR when >> deployed inside an application server." >> it seems that (please correct me if I am wrong) we can then use Felix >> HTTP Service (and unmodified code) in a traditional WAR - an important >> intermediate step in deploying OpenMRS inside a traditional container, >> and something that would be a plus and the main devs seem to want as well >> at the moment. >> >> In any case, I have run into a slight problem, and was wondering if you >> might be able to help. >> >> It seems, even for a Servlet registered under the path "/openmrs", both >> >> ServletContext.getContextPath() >> >> and >> >> ServletContext.getResource("/").getPath() >> >> return simply an empty string, rather than "openmrs" >> >> I have also tested with Equinox HTTP Service and Pax Web, which makes me >> suspect I am doing something wrong. >> >> Unfortunately, I am not actually able to deduce some wronghood from my >> code and would appreciate any quick hints/suggestions. >> >> I have posted the relevant code snippets here: >> http://gist.github.com/657551 >> >> My apologies, they are somewhat over-wrought with extensions etc at the >> moment (I want to use a listener and also a filter, but I have commented >> the non-relevant parts out). >> >> In any case, the code uses registerServlet, and then the servlet, in its >> init method, calls both: >> ServletContext.getContextPath() >> ServletContext.getResource("/").getPath() >> both seems to give empty strings (the part inside the [] parentheses): >> !!! [] >> !!! [/] >> >> If there is something simple I am missing, please let me know. >> >> Thank you so much. Sorry to bother with what is probably a trivial >> question/mistake. >> >> Thank you again >> >> Yours >> Misha >> > > -- View this message in context: http://old.nabble.com/ServletContext.getContextPath%28%29-returning-%22-%22-in-in-org.apache.felix.http.jetty-2.0.4-tp30101270p30110490.html Sent from the Apache Felix - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

