|
WebLogic Server 7.0 Code Examples, BEA Systems, Inc. | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--examples.jms.sender.SenderServlet
This example shows how to send JMS messages from a Java servlet.
The following sections describe how to:
The script will compile the SenderServlet as shown in this example for a Windows system:
prompt> javac -d %EX_WEBAPP_CLASSES% SenderServlet.java
Note: If you have configured the server to run the examples.jms.queue and examples.jms.topic examples, then no additional configuration changes are required to run the SenderServlet example, and you can skip to the section Run the Example.
To configure the server:
http://hostname:port/examplesWebApp/jmssenderwhere:
| Field Summary | |
static java.lang.String |
JMS_FACTORY
Defines the JMS connection factory. |
static java.lang.String |
QUEUE
Defines the queue. |
static java.lang.String |
TOPIC
Defines the topic. |
| Constructor Summary | |
SenderServlet()
|
|
| Method Summary | |
void |
printForm(java.io.PrintWriter pw)
Displays the web page for message input. |
void |
sendQueueMessage(boolean persistent,
int priority,
long ttl,
java.lang.String correlate,
java.lang.String replyto,
java.lang.String topicMessage)
Sends a message to the queue. |
void |
sendTopicMessage(boolean persistent,
int priority,
long ttl,
java.lang.String correlate,
java.lang.String replyto,
java.lang.String topicMessage)
Sends message to the topic. |
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Processes HTTP requests. |
| Methods inherited from class javax.servlet.http.HttpServlet |
|
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String JMS_FACTORY
public static final java.lang.String QUEUE
public static final java.lang.String TOPIC
| Constructor Detail |
public SenderServlet()
| Method Detail |
public void printForm(java.io.PrintWriter pw)
throws java.lang.Exception
pw - print writerjava.lang.Exception - if problem with printing form
public void sendQueueMessage(boolean persistent,
int priority,
long ttl,
java.lang.String correlate,
java.lang.String replyto,
java.lang.String topicMessage)
throws javax.naming.NamingException,
javax.jms.JMSException
persistent - persistency settingpriority - priority settingttl - time-to-live settingcorrelate - correlation ID settingreplyto - reply-to settingtopicMessage - messagejavax.naming.NamingException - if problem with JNDI context interfacejavax.jms.JMSException - if JMS fails send message due to internal error
public void sendTopicMessage(boolean persistent,
int priority,
long ttl,
java.lang.String correlate,
java.lang.String replyto,
java.lang.String topicMessage)
throws javax.naming.NamingException,
javax.jms.JMSException
persistent - persistency settingpriority - priority settingttl - time-to-live settingcorrelate - correlation ID settingreplyto - reply-to settingtopicMessage - messagejavax.naming.NamingException - if problem with JNDI context interfacejavax.jms.JMSException - if JMS fails send message due to internal error
public void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
service in class javax.servlet.http.HttpServletreq - HTTP servlet requestres - HTTP servlet responsejava.io.IOException - if problem with I/O operationjavax.servlet.ServletException - if problem with servlet
|
Documentation is available at http://e-docs.bea.com/wls/docs70 |
|||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||