Hello list,

I have a ServerResource that checks parameters in
@Post/@Get/@WhateverMethod and does the following if required
parameters are not set:

throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Required
parameter XXX is missing or empty");

This works fine, gives me the HTTP 400... except that in the default
HTML representation the "Required parameter..." message is not
present, anywhere I can see. So I was wondering what's the idea of
ResourceException(Status status, String description) if one cannot see
'description' anywhere on the outputted representation when that
exception is thrown.

Should I be getting the description error message somewhere else?
Where? Is this a (long standing, I'm using Restlet 2.0.0, but seen
this behaviour since I've started using 2.0*) bug?

This is an example of a request missing parameter XXX:

~$ curl -i http://localhost:9999/myresource
HTTP/1.1 400 Bad Request
Content-Length: 316
Content-Type: text/html; charset=UTF-8
Date: Tue, 07 Sep 2010 13:29:04 GMT
Accept-Ranges: bytes
Server: Restlet-Framework/2.0.0

<html>
<head>
   <title>Status page</title>
</head>
<body style="font-family: sans-serif;">
<h3>Bad Request</h3><p>You can get technical details <a
href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1";>here</a>.<br>
Please continue your visit at our <a href="/">home page</a>.
</p>
</body>
</html>
~$

I was expecting a <p> after <h3>Bad Request</h3> with the value of
description in it, something like:

<h3>Bad Request</h3><p class="description">Required parameter XXX is
missing or empty</p><p>You can get technical details...</p>

BTW, <h3> without <h1>, nor <h2>, is not good HTML practice. I do
understand that since there's no CSS linked/present, you've choosen it
for rendering reasons, but the HTML professor in me couldn't resist
the temptation to remark this ;-)

Maybe I could take a look at the code generating that HTML piece and
improve it a bit? where I can find it? (not a lot of time to dig the
java files myself, sorry)

Thanks in advance for your answers.

-- 
Fabián Mandelbaum
IS Engineer

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

Reply via email to