You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Steve.V." <st...@sas.com> on 2012/08/06 21:30:51 UTC

Does v5.6.0 MessageServlet(REST interface) support a Content-Type of "text/plain"?

I can use the RESTful HTTP protocol to POST and GET messages as long as I
POST using either "text/xml" or "application/x-www-form-urlencoded" as the
Content-Type.  If I try to POST via "text/plain", messages are put on the
queue, but have no content.  When I attempt to GET those messages off of the
queue, the broker encounters a  NullPointerException at line 269 of
MessageServlet.java:

java.lang.NullPointerException
	at
org.apache.activemq.web.MessageServlet.writeMessageResponse(MessageServlet.java:269)
	at
org.apache.activemq.web.MessageServlet.writeResponse(MessageServlet.java:256)
	at
org.apache.activemq.web.MessageServlet.doMessages(MessageServlet.java:229)
	at org.apache.activemq.web.MessageServlet.doGet(MessageServlet.java:165)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
	at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1360)
	at org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
	at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
	at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
	at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499)
	at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
	at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
	at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
	at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
	at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
	at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499)
	at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
	at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
	at org.eclipse.jetty.server.Server.handle(Server.java:349)
	at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
	at
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
	at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
	at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
	at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
	at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
	at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
	at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
	at java.lang.Thread.run(Thread.java:619)

Thanks,
Stephen Vincent




-----
Stephen Vincent
--
View this message in context: http://activemq.2283324.n4.nabble.com/Does-v5-6-0-MessageServlet-REST-interface-support-a-Content-Type-of-text-plain-tp4654825.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Does v5.6.0 MessageServlet(REST interface) support a Content-Type of "text/plain"?

Posted by Gary Tully <ga...@gmail.com>.
for this sort of question, the best source of information is the source:

https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java?r=1364560&r=1201054&r=1364560&r=1201054#to341

for 1) note the use of startsWith for the content type match.

and:

https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java?r=1364560&r=1201054&r=1364560&r=1201054&r=1364560#to111

On 7 August 2012 16:28, Steve.V. <st...@sas.com> wrote:
>    Thanks Gary.  I do appreciate the help.
>
>    I assume it is ok to specify a charset= sub-option following "text/xml".
> For example, I have a test case where I specify "text/xml;charset=UTF-8",
> and it seems to work.  Is the list of supported encodings restricted?
>
>    The only way I have been able to figure out how to set the correlation ID
> on a per message basis is to use  a content-type of
> "application/x-www-form-urlencoded", and precede the &body= parameter with a
> &JMSCorrelationID= parameter.  Is it safe for me to continue doing that?
>
>    I realize I can add a &JMSCorrelationID= parameter to the URL, but that
> is in affect for all messages posted over that client connection.  It would
> be nice to be able to vary the correlation ID on a per message basis on the
> same connection.  Is that possible with "text/xml"?
>
>    Speaking of correlation ID, I seem to remember a post to the forum that
> mentioned an issue regarding message properties not being sent by way of
> HTTP headers in response to a GET.  Is there a jira entry on that?
>
> Thanks again for you assistance.
>
> Cheers,
> Stephen Vincent
>
>
>
> -----
> Stephen Vincent
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Does-v5-6-0-MessageServlet-REST-interface-support-a-Content-Type-of-text-plain-tp4654825p4654854.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com

Re: Does v5.6.0 MessageServlet(REST interface) support a Content-Type of "text/plain"?

Posted by "Steve.V." <st...@sas.com>.
   Thanks Gary.  I do appreciate the help.

   I assume it is ok to specify a charset= sub-option following "text/xml".  
For example, I have a test case where I specify "text/xml;charset=UTF-8",
and it seems to work.  Is the list of supported encodings restricted?

   The only way I have been able to figure out how to set the correlation ID
on a per message basis is to use  a content-type of
"application/x-www-form-urlencoded", and precede the &body= parameter with a
&JMSCorrelationID= parameter.  Is it safe for me to continue doing that? 

   I realize I can add a &JMSCorrelationID= parameter to the URL, but that
is in affect for all messages posted over that client connection.  It would
be nice to be able to vary the correlation ID on a per message basis on the
same connection.  Is that possible with "text/xml"?

   Speaking of correlation ID, I seem to remember a post to the forum that
mentioned an issue regarding message properties not being sent by way of
HTTP headers in response to a GET.  Is there a jira entry on that?

Thanks again for you assistance.

Cheers,
Stephen Vincent



-----
Stephen Vincent
--
View this message in context: http://activemq.2283324.n4.nabble.com/Does-v5-6-0-MessageServlet-REST-interface-support-a-Content-Type-of-text-plain-tp4654825p4654854.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Does v5.6.0 MessageServlet(REST interface) support a Content-Type of "text/plain"?

Posted by Gary Tully <ga...@gmail.com>.
it has got to be 'text/xml' at the moment.

On 6 August 2012 20:30, Steve.V. <st...@sas.com> wrote:
> I can use the RESTful HTTP protocol to POST and GET messages as long as I
> POST using either "text/xml" or "application/x-www-form-urlencoded" as the
> Content-Type.  If I try to POST via "text/plain", messages are put on the
> queue, but have no content.  When I attempt to GET those messages off of the
> queue, the broker encounters a  NullPointerException at line 269 of
> MessageServlet.java:
>
> java.lang.NullPointerException
>         at
> org.apache.activemq.web.MessageServlet.writeMessageResponse(MessageServlet.java:269)
>         at
> org.apache.activemq.web.MessageServlet.writeResponse(MessageServlet.java:256)
>         at
> org.apache.activemq.web.MessageServlet.doMessages(MessageServlet.java:229)
>         at org.apache.activemq.web.MessageServlet.doGet(MessageServlet.java:165)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>         at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
>         at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1360)
>         at org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
>         at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
>         at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
>         at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
>         at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499)
>         at
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
>         at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
>         at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
>         at
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
>         at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
>         at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
>         at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
>         at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499)
>         at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
>         at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
>         at org.eclipse.jetty.server.Server.handle(Server.java:349)
>         at
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
>         at
> org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
>         at
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
>         at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
>         at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
>         at
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
>         at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
>         at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
>         at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
>         at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
>         at java.lang.Thread.run(Thread.java:619)
>
> Thanks,
> Stephen Vincent
>
>
>
>
> -----
> Stephen Vincent
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Does-v5-6-0-MessageServlet-REST-interface-support-a-Content-Type-of-text-plain-tp4654825.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com