com.ibm.workflow.servlet.sample
Class EmailHandler

java.lang.Object
  |
  +--com.ibm.workflow.servlet.client.GenericCommandHandler
        |
        +--com.ibm.workflow.servlet.sample.EmailHandler
All Implemented Interfaces:
CommandHandler

public class EmailHandler
extends GenericCommandHandler

A custom handler which will send a notification email to the receiver of a transferred item. The handler (which has to be registered as one of the active custom handlers) is activated when an SMTP host is configured. The ListViewer.jsp will then direct item transfer requests to this handler instead of the BuiltinHandler. The EmailHandler performs the same task as the BuiltinHandler (i.e. transfers the item), but in addition -- if an email-address was specified in the transfer dialog -- it sends a notification email. This email (which can be formatted as HTML) by the EmailViewer.jsp can contains a href-link so that the receiver can start the item immediately from his (HTML-aware) email client.

Motivation

The MIBM WebSphere MQ Workflow Web Client provides a means that a user can participate in workflows where all he needs is a web browser and the knowledge of some 'logon' web page to point it to. While this usage pattern is adequate for users which participate in workflows on a regular basis, it is cumbersome to those users which are involved in a workflow infrequently. In particular, users who will receive items only as a result of an explicit item transfer (e.g. initiated by an administrator or by some other user who is authorized to perform such a transfer) will need to be notified that work has been assigned to them.

email is a much more appropriate means of delivering items in a push-style fashion. To that end a custom handler for the Web Client was developed which enhances the built-in "Transfer Item" function so that it will optionally send an email notification to the recipient of a item. The content of the notification is generated by a Java Server Page (EmailViewer.jsp) which -- since the source code for it is available to customers -- can be easily customized. As provided, the JSP will generate an email which allows the receiver to launch the item directly from his email application.


Constructor Summary
EmailHandler()
           
 
Method Summary
 java.lang.String getHandlerInfo()
          Returns information about the handler, such as author, version, and copyright.
 void init(Config cfg)
          Initializes the handler and caches the SMTP host, if configured.
 ResponsePage transferItem(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Service entry point to which the 'x-transferItem' requests issued by the ListViewer.jsp are dispatched.
 
Methods inherited from class com.ibm.workflow.servlet.client.GenericCommandHandler
destroy, execute, getConfig, getContext, getCredentials, getSessionContext, getTriggerTagFor, onLogoff, onLogon
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmailHandler

public EmailHandler()
Method Detail

getHandlerInfo

public java.lang.String getHandlerInfo()
Returns information about the handler, such as author, version, and copyright.
Overrides:
getHandlerInfo in class GenericCommandHandler
Returns:
a String containing handler information

init

public void init(Config cfg)
Initializes the handler and caches the SMTP host, if configured. This is only done if the prerequisite packages (javax.mail.* and javax.activation.*) could be found.
Overrides:
init in class GenericCommandHandler
Parameters:
config - The servlet's configuration and initialization parameters

transferItem

public ResponsePage transferItem(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
                          throws ClientException
Service entry point to which the 'x-transferItem' requests issued by the ListViewer.jsp are dispatched.
Parameters:
request - The request the client has made of the servlet
response - The response the servlet sends to the client
Returns:
The result page to be sent to the client


© Copyright IBM Corporation 1999, 2008. All Rights Reserved.