Hornet-Q REST library not returning correct HTTP Error Code
rakshukla Mar 2, 2011 7:40 AMWe are using Hornet-Q REST 1.0 beta 3 library and tried to create a queue using
HTTP POST http://127.0.0.1:8080/api/hornet-q/queues
Content-Type:application/hornetq.jms.queues+xml
Body: <queue name="testq"><durable>true</durable></queue>
we are getting following HTTP Response
HTTP 500 Internal Server Error
Body:
<html><head><title>JBossWeb/2.0.1.GA - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size: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 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.jboss.resteasy.spi.UnsupportedMediaTypeException: Cannot consume content type
org.jboss.resteasy.core.registry.Segment.match(Segment.java:102)
org.jboss.resteasy.core.registry.SimpleSegment.matchSimple(SimpleSegment.java:33)
org.jboss.resteasy.core.registry.RootSegment.matchChildren(RootSegment.java:327)
org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:374)
org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:367)
org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:251)
org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:157)
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:136)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:211)
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the JBossWeb/2.0.1.GA logs.</u></p><HR size="1" noshade="noshade"><h3>JBossWeb/2.0.1.GA</h3></body></html>
We think that it should return HTTP Status Code as 415 Can not consume content type instead 500 Internal Server Error.