org.apache.activemq.web
Class MessageServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.activemq.web.MessageServletSupport
org.apache.activemq.web.MessageServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class MessageServlet
- extends MessageServletSupport
A servlet for sending and receiving messages to/from JMS destinations using
HTTP POST for sending and HTTP GET for receiving.
You can specify the
destination and whether it is a topic or queue via configuration details on
the servlet or as request parameters. For reading messages you can
specify a readTimeout parameter to determine how long the servlet should
block for.
- Version:
- $Revision: 1.1.1.1 $
- See Also:
- Serialized Form
|
Method Summary |
protected void |
doDelete(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Supports a HTTP DELETE to be equivlanent of consuming a singe message
from a queue |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Supports a HTTP DELETE to be equivlanent of consuming a singe message
from a queue |
protected void |
doMessages(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Reads a message from a destination up to some specific timeout period |
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sends a message to a destination |
protected java.lang.String |
getContentType(javax.servlet.http.HttpServletRequest request)
|
protected long |
getReadTimeout(javax.servlet.http.HttpServletRequest request)
|
WebClient |
getWebClient(javax.servlet.http.HttpServletRequest request)
|
void |
init()
|
protected boolean |
isRicoAjax(javax.servlet.http.HttpServletRequest request)
|
protected void |
setResponseHeaders(javax.servlet.http.HttpServletResponse response,
javax.jms.Message message)
|
protected void |
writeMessageResponse(java.io.PrintWriter writer,
javax.jms.Message message)
|
protected void |
writeResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.jms.Message message)
|
| Methods inherited from class org.apache.activemq.web.MessageServletSupport |
appendParametersToMessage, asBoolean, asBoolean, asDestination, asInt, asInteger, asLong, asLong, asString, getDestination, getDestination, getDestinationFromURI, getPostedMessageBody, getSelector, getSendPriority, getSendTimeToLive, init, isSendPersistent, isSync, isTopic |
| Methods inherited from class javax.servlet.http.HttpServlet |
doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessageServlet
public MessageServlet()
init
public void init()
throws javax.servlet.ServletException
- Overrides:
init in class javax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Sends a message to a destination
- Overrides:
doPost in class javax.servlet.http.HttpServlet
- Parameters:
request - response -
- Throws:
javax.servlet.ServletException
java.io.IOException
doDelete
protected void doDelete(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Supports a HTTP DELETE to be equivlanent of consuming a singe message
from a queue
- Overrides:
doDelete in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Supports a HTTP DELETE to be equivlanent of consuming a singe message
from a queue
- Overrides:
doGet in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
doMessages
protected void doMessages(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Reads a message from a destination up to some specific timeout period
- Parameters:
request - response -
- Throws:
javax.servlet.ServletException
java.io.IOException
writeResponse
protected void writeResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.jms.Message message)
throws java.io.IOException,
javax.jms.JMSException
- Throws:
java.io.IOException
javax.jms.JMSException
writeMessageResponse
protected void writeMessageResponse(java.io.PrintWriter writer,
javax.jms.Message message)
throws javax.jms.JMSException,
java.io.IOException
- Throws:
javax.jms.JMSException
java.io.IOException
isRicoAjax
protected boolean isRicoAjax(javax.servlet.http.HttpServletRequest request)
getWebClient
public WebClient getWebClient(javax.servlet.http.HttpServletRequest request)
getContentType
protected java.lang.String getContentType(javax.servlet.http.HttpServletRequest request)
setResponseHeaders
protected void setResponseHeaders(javax.servlet.http.HttpServletResponse response,
javax.jms.Message message)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
getReadTimeout
protected long getReadTimeout(javax.servlet.http.HttpServletRequest request)
- Returns:
- the timeout value for read requests which is always >= 0 and <=
maximumReadTimeout to avoid DoS attacks
Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.