public class MessageListenerServlet extends MessageServletSupport
Constructor and Description |
---|
MessageListenerServlet() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
protected void |
doGet(HttpServletRequest request,
HttpServletResponse response)
Supports a HTTP DELETE to be equivlanent of consuming a singe message
from a queue
|
protected void |
doMessages(AjaxWebClient client,
HttpServletRequest request,
HttpServletResponse response)
Reads a message from a destination up to some specific timeout period
|
protected void |
doPost(HttpServletRequest request,
HttpServletResponse response)
Sends a message to a destination or manage subscriptions.
|
protected AjaxWebClient |
getAjaxWebClient(HttpServletRequest request) |
protected long |
getReadTimeout(HttpServletRequest request) |
void |
init() |
protected void |
writeMessageResponse(PrintWriter writer,
Message message,
String id,
String destinationName) |
appendParametersToMessage, asBoolean, asBoolean, asDestination, asInt, asInteger, asLong, asLong, asString, getDestination, getDestination, getDestinationFromURI, getPostedMessageBody, getSelector, getSendPriority, getSendTimeToLive, init, isSendPersistent, isSync, isTopic
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
public MessageListenerServlet()
public void init() throws ServletException
init
in class GenericServlet
ServletException
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
application/x-www-form-urlencoded
, then the form
parameters "destination", "message" and "type" are used to pass a message
or a subscription. If multiple messages or subscriptions are passed in a
single post, then additional parameters are shortened to "dN", "mN" and
"tN" where N is an index starting from 1. The type is either "send",
"listen" or "unlisten". For send types, the message is the text of the
TextMessage, otherwise it is the ID to be used for the subscription. If
the content type is not application/x-www-form-urlencoded
,
then the body of the post is sent as the message to a destination that is
derived from a query parameter, the URL or the default destination.doPost
in class HttpServlet
request
- response
- ServletException
IOException
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doGet
in class HttpServlet
ServletException
IOException
protected void doMessages(AjaxWebClient client, HttpServletRequest request, HttpServletResponse response) throws JMSException, IOException
client
- The webclientrequest
- response
- ServletException
IOException
JMSException
protected void writeMessageResponse(PrintWriter writer, Message message, String id, String destinationName) throws JMSException, IOException
JMSException
IOException
protected AjaxWebClient getAjaxWebClient(HttpServletRequest request)
protected long getReadTimeout(HttpServletRequest request)
public void destroy()
destroy
in interface Servlet
destroy
in class GenericServlet
Copyright © 2005–2016 FuseSource, Corp.. All rights reserved.