On Nov 10, 2008, at 9:35 PM, Robertson, Jeff wrote:
> Re: Josh's gripes, I ended up wriging myself a class like this:
>
+1, i was just in the process of writing an example like that :-)
An alternative is to use the exception mapper:
https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/ext/ExceptionMapper.html
Paul.
>
> public class RestException extends WebApplicationException {
>
> public RestException(Throwable cause, int status, String message) {
> super(cause,
> Response
> .status(status)
> .entity(message)
> .type("text/plain")
> .build()
> );
> }
>
> public RestException(int status, String message) {
> super(
> Response
> .status(status)
> .entity(message)
> .type("text/plain")
> .build()
> );
> }
>
> }
>
>
>
>
>> -----Original Message-----
>> From: Eduardo Pérez Ureta [mailto:edpeur_at_gmail.com]
>> Sent: Monday, November 10, 2008 3:26 PM
>> To: users_at_jersey.dev.java.net
>> Subject: Re: [Jersey] Web applications using XMLHttpRequest
>> and JAX-RS REST/JSON Web Services
>>
>> Like Josh:
>> http://joshdevins.blogspot.com/2008/10/jax-rs-woes-continue.html
>> I would like to send a text/plain response with a message
>> when I output a 401 Unauthorized response. Is there a way to
>> do that with JAX-RS ?
>>
>> Craig McClanahan wrote:
>>> Are there particular aspects of CSRF that you are concerned about?
>> No, I just wanted to know if there is a defacto standard way
>> to do that using JAX-RS
>>
>> Eduardo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>