Hi

perhaps you might want to do

Response.status(resultStatus).type("text/plain").entity("error
message").build();

rather than expecting primitive types being wrapped ? It can be done but I
haven't really had a chance to look into it - I do not see what real
benefits it will bring

cheers, Sergey

On Mon, Mar 8, 2010 at 5:14 PM, DmitryM <[email protected]> wrote:

>
> Hello, all
>
> Can anyone advise me on the following issue:
>
> - I have 2 methods in the web interface:
>  String addX() throws E;
>  void updateX(String x) throws E;
>
> - I also have an ExceptionMapper which maps server-side exceptions onto the
> '500' response with a marshalled object using the call like this:
>
> Response result = Response.status(resultStatus).entity(z).build();
>
> where z is an instance of the
>
> @XmlRootElement(name="z")
> public class Z { public String z1; public String z2; }
>
> The matter is everything works perfectly fine on the updateX() call even in
> case of E or a RuntimeException thrown inside it.
> But when it comes to addX() (which returns java.lang.String type - not
> annotated with @XmlRootElement) then I get a bizarre
>
> Error creating a JAXBContext using ObjectFactory ... package
> 'Z.package.goes.here' contain ObjectFactory.class or jaxb.index ...
>
> When I change
> String addX() to
> StringWrapper addX()
>
> where StringWrapper is the following
>
> @XmlRootElement(name="s")
> StringWrapper { public String value; }
>
> then everything works okay.
> But this wrapping of standard Java types to make marshaller work properly
> seems kinda lame.
>
> Any help on how to use standard Java classes without extra wrapper classes
> with ExceptionMapper using standard marshalers?
>
> Thanks,
> Dmitry
> --
> View this message in context:
> http://old.nabble.com/Jax-RS-ExceptionMapper-and-data-marshalling-tp27824429p27824429.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Reply via email to