Open GoogleCodeExporter opened 8 years ago
Right, this is still hard-coded, see
https://github.com/krasserm/grails-jaxrs/blob/master/src/groovy/org/grails/jaxrs
/provider/DomainObjectNotFoundException.groovy#L49. Will try to fix that soon.
Thanks for reporting.
Original comment by krass...@googlemail.com
on 28 Jan 2013 at 6:25
Bliss!
Thanks very much - I would love to contrib a fix if you wouldn't mind.
Worked w Groovy and Grails since mid 2009 version 1.1
On Monday, January 28, 2013, wrote:
Original comment by alphat...@gmail.com
on 28 Jan 2013 at 7:31
Could the JSON version be something like this :
{
"message": "Domain object %s not found",
"error": "not_found",
"status": 404}
Original comment by alphat...@gmail.com
on 29 Jan 2013 at 7:23
It would be great if you can fix this and contribute. Thanks for offering help,
highly appreciate it. Regarding the JSON, I think
{
"message": "Domain object %s not found",
"status": 404
}
is enough because 404 implies "error":"not_found". WDYT?
Original comment by krass...@googlemail.com
on 29 Jan 2013 at 9:08
That works for me. Can the code (catching Domain at this layer simply
check the 'Accept' header and return the appropriately formatted message,
that is "<error>" or JSON error object ?
Another (related) issue is if the :id value is non-numeric, we get the
standard Tomcat 404.html. I believe this is a Grails-ism. For example :
$ curl -v -k -H "Content-Type: application/json" -H "Accept:
application/json" -X GET http://cobain:8080/hello/api/person/*10x*
* About to connect() to cobain port 8080 (#0)
* Trying 192.168.1.103... connected
* Connected to cobain (192.168.1.103) port 8080 (#0)
OpenSSL/0.9.8r zlib/1.2.3
< HTTP/1.1 404 Not Found
< Server: Apache-Coyote/1.1
< Content-Type: text/html;charset=utf-8
< Content-Length: 967
< Date: Sun, 27 Jan 2013 23:40:57 GMT
<
* Connection #0 to host cobain left intact
* Closing connection #0
<html><head><title>Apache Tomcat/7.0.30 - Error report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-s
ize:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-s
ize:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-s
ize:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px
;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head><body><h1>HTTP Status 404 - Not Found</h1><HR size="1"
noshade="noshade"><p>type Status report</p><p>message <u>Not
Found</u></p><p>description <u>The requested resource is not
available.</u></p><HR size="1" noshade="noshade"><h3>Apache
Tomcat/7.0.30</h3></body></html>austinmini-2:outbox saleram$
Original comment by alphat...@gmail.com
on 29 Jan 2013 at 9:18
I think checking the Accept header is the way to go.
Original comment by krass...@googlemail.com
on 29 Jan 2013 at 9:24
Original issue reported on code.google.com by
alphat...@gmail.com
on 27 Jan 2013 at 11:28