net.rim.pushsdk.pap.web
Class BasicNotificationServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by net.rim.pushsdk.pap.web.BasicNotificationServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
NotificationServlet

public abstract class BasicNotificationServlet
extends javax.servlet.http.HttpServlet

Abstract servlet responsible for handling notifications.

The servlet calls the receiveNotificiation method of the PapService implementation returned by the getPapService method. The default implementation provided of the PapService (i.e. PapServiceImpl) unmarshals the result notification message and calls the onNotification method to hand over the ResultNotification object for further processing. The servlet sends a response to the PPG to confirm acceptance of the result notification.

In order to perform custom actions on result notifications, extend this servlet and implement the getPapService method such that it returns a PapService which implements onNotification. The servlet must then be deployed in a servlet container and be reachable at the result notification URL provided in a push request.

It is recommended that the implementation of PapService returned by getPapService extend the provided PapServiceImpl default implementation and simply implement the onNotification method.

Author:
dstrelbytsky
See Also:
Serialized Form

Constructor Summary
BasicNotificationServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Delegates to doPost().
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Accepts a result notification from the body of the request, converts it to a PAP XML and makes the PAP XML response call to the Push Proxy Gateway (PPG).
protected abstract  PapService getPapService()
          In order to perform custom actions on result notifications, implement the getPapService method such that it returns a PapService which implements onNotification.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
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
 

Constructor Detail

BasicNotificationServlet

public BasicNotificationServlet()
Method Detail

getPapService

protected abstract PapService getPapService()
In order to perform custom actions on result notifications, implement the getPapService method such that it returns a PapService which implements onNotification. It is recommended that the PapServiceImpl class simply be extended and the onNotification method be implemented.

Returns:
a PapService implementation

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse resp)
            throws javax.servlet.ServletException,
                   IOException
Accepts a result notification from the body of the request, converts it to a PAP XML and makes the PAP XML response call to the Push Proxy Gateway (PPG).

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
req - the request sent by the client to the server
resp - the response sent by the server to the client
Throws:
javax.servlet.ServletException - if an error occurred
IOException - if an error occurred

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  IOException
Delegates to doPost().

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - the request sent by the client to the server
response - the response sent by the server to the client
Throws:
javax.servlet.ServletException - if an error occurred
IOException - if an error occurred


Copyright © 2011 Research In Motion. All Rights Reserved.