Hello,

basically, just set the Application's statusService with your own instance:
        setStatusService(new StatusService() {
            @Override
            public Representation getRepresentation(Status status,
                    Request request, Response response) {
                return new StringRepresentation(status.getDescription(),
MediaType.TEXT_PLAIN);
            }
        });

The description set in the ResourceException is available via the
Status#getDescription method.

Best regards,
Thierry Boileau


Hi,
> I would like to customize the message in case of error status.
> I have read  this can me made in a subclass of StatusService by overriding
> the getRepresentation method.
> But what have I to do in this method ?
> I would like to send in the response the descritpion set in the
> ResourceException.
>
> Thanks for your help.
>
> --
> View this message in context:
> http://restlet-discuss.1400322.n2.nabble.com/How-to-override-the-method-getRepresentation-in-a-subclass-of-StatusService-tp6312255p6312255.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2725407
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2730111

Reply via email to