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:

  1. Register the servlet in your weblogic.properties file by adding this property:
      weblogic.httpd.register.jmssender=examples.jms.sender.SenderServlet
  2. 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.
  3. 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:
  1. Set up your development shell, as described in Setting up your environment.
  2. Compile the files in this directory as shown in this examples for Windows NT:
      $ javac -d %SERVLET_CLASSES% SenderServlet.java
Run the example:
  1. Start the WebLogic Server in a new shell.
  2. 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).
  3. Enter a message to send and click the Send Message button.

Author:
Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.

Variable Index

 o JMS_FACTORY
 o QUEUE
 o TOPIC

Constructor Index

 o SenderServlet()

Method Index

 o printForm(PrintWriter)
Display the web page for message input.
 o sendQueueMessage(boolean, int, long, String, String, String)
Send a message to the Queue.
 o sendTopicMessage(boolean, int, long, String, String, String)
Send message to the Topic.
 o service(HttpServletRequest, HttpServletResponse)
Process HTTP requests.

Variables

 o JMS_FACTORY
 public static final String JMS_FACTORY
 o TOPIC
 public static final String TOPIC
 o QUEUE
 public static final String QUEUE

Constructors

 o SenderServlet
 public SenderServlet()

Methods

 o service
 public void service(HttpServletRequest req,
                     HttpServletResponse res) throws IOException, ServletException
Process HTTP requests.

 o printForm
 public void printForm(PrintWriter pw) throws Exception
Display the web page for message input.

 o sendTopicMessage
 public void sendTopicMessage(boolean persistent,
                              int priority,
                              long ttl,
                              String correlate,
                              String replyto,
                              String topicMessage) throws NamingException, JMSException
Send message to the Topic.

 o 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