users@jersey.java.net

Re: [Jersey] Problem using the JerseyTest class

From: tarjei <tarjei_at_nu.no>
Date: Tue, 14 Jul 2009 15:32:00 +0200

Hi, please disregard this last question, I got tricked by an attribute I
thought was an int but was an Integer...

kind regards,
Tarjei
On 07/14/2009 03:29 PM, tarjei wrote:
> Hi,
>
> Naresh, hero of the day, wrote:
>> super();
>> Map<String, String> contextParams = new HashMap<String, String>();
>> contextParams.put("contextConfigLocation",
>> "classpath:applicationContext-HSQLdb.xml");
>> ApplicationDescriptor appDescriptor = new ApplicationDescriptor()
>> .setContextPath(your-context-path)
>>
>> .setRootResourcePackageName(your-root-resource-package-name)
>>
>> .setServletClass(com.sun.jersey.spi.spring.container.servlet.SpringServlet.class)
>>
>>
>>
>> .setContextListenerClassName("org.springframework.web.context.ContextLoaderListener")
>>
>>
>> .setContextParams(contextParams);
>> super.setupTestEnvironment(appDescriptor);
> Great!
> That worked. I guess this should go into the docs?
>
> Now I got another problem.
>
> I use the Webresource to do a request like this:
> SourceView sv = new SourceView();
> .. set some sv attributes ..
> SourceView sv2 = webResource.path("source").put(SourceView.class, sv);
>
> and according to the logging, a request containing the correct XML is
> generated and PUT to the server, but in my method I get a null instead
> of the expected object.
>
> Any tips to why?
>
> The method signature looks like this:
> @PUT
> @Path("/")
> @Consumes({
> "application/xml",
> "text/xml"})
> public SourceView create(SourceView s) {
> ...
> }
>
>
>
> Kind regards,
> Tarjei
>
>
>
>


-- 
Tarjei Huse
Mobil: 920 63 413