All Examples This Package JMS Examples
Class examples.jms.sender.SenderServlet
examples.jms.sender.SenderServlet
- public class SenderServlet
This example shows how to submit a JMS message from a Java servlet.
Configure the server:
-
Register the servlet in your weblogic.properties file
by adding this property:
weblogic.httpd.register.jmssender=examples.jms.sender.SenderServlet
-
Set the servlet classpath and reload properties in your weblogic.properties file
by adding the following properties:
weblogic.httpd.servlet.classpath=weblogic/myserver/servletclasses
weblogic.httpd.servlet.reloadCheckSecs=1
where weblogic is the directory where WebLogic is installed.
-
If you want to try the persistent and durable subscriber features,
make sure you have defined a JMS connection pool in your
weblogic.properties file. See
JMS Examples for instruction on setting up a connection pool.
Build the example:
-
Set up your development shell, as described in
Setting up
your environment.
-
Compile the files in this directory as shown in this examples for Windows NT:
$ javac -d %SERVLET_CLASSES% SenderServlet.java
Run the example:
-
Start the WebLogic Server in a new shell.
-
Load the servlet in a browser with a URL like this:
http://hostname:port/jmssender
where:
- hostname
- Host name of the WebLogic Server
- port
- Port where the WebLogic Server is listening for connections
(weblogic.system.ListenPort).
-
Enter a message to send and click the Send Message button.
- Author:
- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
-
JMS_FACTORY
-
-
QUEUE
-
-
TOPIC
-
-
SenderServlet()
-
-
printForm(PrintWriter)
- Display the web page for message input.
-
sendQueueMessage(boolean, int, long, String, String, String)
- Send a message to the Queue.
-
sendTopicMessage(boolean, int, long, String, String, String)
- Send message to the Topic.
-
service(HttpServletRequest, HttpServletResponse)
- Process HTTP requests.
JMS_FACTORY
public static final String JMS_FACTORY
TOPIC
public static final String TOPIC
QUEUE
public static final String QUEUE
SenderServlet
public SenderServlet()
service
public void service(HttpServletRequest req,
HttpServletResponse res) throws IOException, ServletException
- Process HTTP requests.
printForm
public void printForm(PrintWriter pw) throws Exception
- Display the web page for message input.
sendTopicMessage
public void sendTopicMessage(boolean persistent,
int priority,
long ttl,
String correlate,
String replyto,
String topicMessage) throws NamingException, JMSException
- Send message to the Topic.
sendQueueMessage
public void sendQueueMessage(boolean persistent,
int priority,
long ttl,
String correlate,
String replyto,
String topicMessage) throws NamingException, JMSException
- Send a message to the Queue.
All Examples This Package JMS Examples