My ServerResource now has:
org.restlet.Request r = this.getRequest();
r.setEntity( CompanyId required, org.restlet.data.MediaType.TEXT_PLAIN );
throw new org.restlet.resource.ResourceException(
org.restlet.data.Status.CLIENT_ERROR_BAD_REQUEST );
catch(
Not exactly sure if this is what you're after but I would still set your
message string in the setStatus method and and then use
Status#getDescription in your catch block or wherever…
--
Paul Morris, Software Developer
Northwestern Memorial Physicians Group http://www.nmpg.com
773.469.4330 |
Server side code:
String errorMessage = CompanyId required;
org.restlet.Request r = this.getRequest();
r.setEntity( errorMessage, org.restlet.data.MediaType.TEXT_PLAIN );
org.restlet.data.Status status = new org.restlet.data.Status(
org.restlet.data.Status.CLIENT_ERROR_BAD_REQUEST, errorMessage
Why set the request entity rather than the response entity?
On Sun, Sep 2, 2012 at 9:46 AM, Stephen More stephen.m...@gmail.com wrote:
Server side code:
String errorMessage = CompanyId required;
org.restlet.Request r = this.getRequest();
r.setEntity( errorMessage,
Thanks Tim. Yes Stephen I missed that in your snippet... Use getResponse()
Paul Morris
On Sep 2, 2012, at 12:32 PM, Tim Peierls
t...@peierls.netmailto:t...@peierls.net wrote:
Why set the request entity rather than the response entity?
On Sun, Sep 2, 2012 at 9:46 AM, Stephen More
Working server side code:
this.getResponse().setEntity( errorMessage,
org.restlet.data.MediaType.TEXT_PLAIN );
org.restlet.data.Status status = new org.restlet.data.Status(
org.restlet.data.Status.CLIENT_ERROR_BAD_REQUEST, errorMessage );
throw new org.restlet.resource.ResourceException( status
I have a ServerResource that has:
throw new org.restlet.resource.ResourceException(
org.restlet.data.Status.CLIENT_ERROR_BAD_REQUEST, CompanyId required );
My client will:
catch( org.restlet.resource.ResourceException re )
{
org.restlet.data.Status status = re.getStatus();
log.error(
void
setEntityhttp://www.restlet.org/documentation/2.0/jse/api/org/restlet/Message.html#setEntity(java.lang.String,%20org.restlet.data.MediaType)(Stringhttp://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true
value,
8 matches
Mail list logo