But maybe it would not be wise to do this? I'm not actually aware of
any API-s that send error messages in the Reason Phrase.
You can specify custom text there, but you may have to sidestep the usual response classes, depending on which one. The one you gave, not found, can have the message customized though, just do new NotFoundResponse("the message").
-Ross
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
And last but perhaps not least, for debugging purposes, the HTTP
Reason Code should show up better in web developer tools (for example
FireBug, Chrome's tools). My web UI also goes through the REST API so
it would be nice to read error messages right in the listing in
firebug's net panel.
So I'm suggesting that perhaps Lift would like to provide only the
possibility of changing that value in user code. But I completely
understand if it doesn't. Currently it doesn't seem to be supported in
Lift's http.provider package and even in javax.servlet the
setStatus(int, String) method is deprecated (I'm not sure if
sendError(int, String) uses the reason phrase).
Erkki L
Moreover, its not the wrong thing to return a plain text response if the request mime was text/plain... indeed, it would be even less helpful if it returned JSON or such. IMHO, the response type should match what was asked for by the caller - i.e. its an implementation issue not a framework level issue.
Tim
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
Examples:
HTTP/1.1 200 OK
HTTP/1.1 404 The user with id 8 does not exist
The only way of setting this in Java Servlets as far as I know is
through HttpServletResponse.setStatus(int, String), which
unfortunately is deprecated. A non-deprecated possibility is
sendError(int, String), but that goes to the container's default error
page (or the one defined in web.xml, I think) so it's not exactly what
I would like.
Also, I checked that FireBug actually does display the custom reason
phrase, but Chrome displays the standard one instead.
Erkki L
-Ross
Cheers, Tim
Erkki L
Erkky would you please open a defect (https://www.assembla.com/spaces/
liftweb/tickets) and assign it to me ?
Br's,
Marius
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > .
> > > >>>>>> For more options, visit this group athttp://
> > groups.google.com/group/liftweb?hl=en.
>
> > > >>>> --
> > > >>>> You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > > >>>> To post to this group, send email to lif...@googlegroups.com.
> > > >>>> To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > .
> > > >>>> For more options, visit this group athttp://
> > groups.google.com/group/liftweb?hl=en.
>
> > > >> --
> > > >> You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > > >> To post to this group, send email to lif...@googlegroups.com.
> > > >> To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > .
> > > >> For more options, visit this group athttp://
> > groups.google.com/group/liftweb?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > > > To post to this group, send email to lif...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > .
> > > > For more options, visit this group athttp://
> > groups.google.com/group/liftweb?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
Interested to see what you come up with Marius
Cheers, Tim
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
In case you are busy with other things, I might have time this weekend
to create a patch.
Erkki L