users@jersey.java.net

Re: [Jersey] Re: Jersey, Jetty and web.xml

From: Lars Tackmann <lars_at_randompage.org>
Date: Tue, 20 May 2008 16:10:09 +0200

On Tue, May 20, 2008 at 3:24 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
> Havw you tried adding the following to your web.xml:
>
> <init-param>
> <param-name>
> com.sun.ws.rest.config.property.resourceConfigClass
> </param-name>
> <param-value>
> com.sun.ws.rest.api.core.PackagesResourceConfig
> </param-value>
> <param-name>
> com.sun.ws.rest.config.property.packages
> </param-name>
> <param-value>
> org.randompage.samples.jaxrs.bookmarking.resources
> </param-value>
> </init-param>
>
> (note if using the latest bits change "com.sun.ws.rest" to
> "com.sun.jersey").

Achh stupid me, the above hint of cause worked. So now I can fire off
my unit test with:

--
private Server server;
        @BeforeClass
	protected void setUp() throws Exception {
		server = new Server(port);
		WebAppContext webAppContext = new WebAppContext("src/main/webapp", "/");
		webAppContext.setConfigurationClasses(new String[] {
				"org.mortbay.jetty.webapp.WebInfConfiguration",
				"org.mortbay.jetty.webapp.WebXmlConfiguration", });
		server.addHandler(webAppContext);
		server.start();
	}
	@AfterClass
	protected void tearDown() throws Exception {
		if (server != null)
			server.stop();
	}
--
> Do you have any idea how Seam and Struts work in such cases locating the
> classes? is there some extra config information in the web.xml for Struts?
Not that I can see. I have a complete maven'ised seam/spring example here
http://svn.randompage.org/java/samples/seam/wiki/ which has the
following fairly
standard web.xml:
http://svn.randompage.org/java/samples/seam/wiki/src/main/webapp/WEB-INF/web.xml
and this simple base class for web tests (completly similar to the
above jetty code):
http://svn.randompage.org/java/samples/seam/wiki/src/test/java/org/randompage/samples/seam/wiki/test/utils/WebTester.java
anyway, I am glad I got this working. Since I have allot of other
stuff in my web.xml (Quartz...) it is nice not having to duplicate it
in Java code.
Thanks for the help.
-- 
Yours sincerely
Lars Tackmann