net.rim.pushsdk.subscription.web
Class SubscribeServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by net.rim.pushsdk.subscription.web.SubscriptionServlet
              extended by net.rim.pushsdk.subscription.web.SubscribeServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class SubscribeServlet
extends SubscriptionServlet

Servlet responsible for handling a subscribe operation.

The following HTTP request parameters are needed for a subscribe: appid, address, osversion, model, and type.
Note: If not using container-managed authentication, the following two HTTP request parameters will also be needed: username, and password.
Note: The type HTTP request parameter is only required if the appid request parameter corresponds to a push application with a type of Public+Enterprise Push.

The following return codes can come back from this servlet: SUCCESS, INVALID_ADDRESS, INVALID_PARAMETERS, INVALID_PUSH_APPLICATION, INVALID_SUBSCRIBER_ID, INVALID_USERNAME, INVALID_PASSWORD, INVALID_TYPE, SUBSCRIPTION_NOT_SUPPORTED, SUBSCRIBER_AUTHENTICATION_FAILED, CONTENT_PROVIDER_SUBSCRIPTION_FAILED, SYSTEM_ERROR

Author:
mdandrea
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.rim.pushsdk.subscription.web.SubscriptionServlet
CACHE_CONTROL, contentProviderAuthenticationService, NO_CACHE, PRAGMA, SUBSCRIBER_USERNAME, subscriptionRequestParser, subscriptionService
 
Constructor Summary
SubscribeServlet()
           
 
Method Summary
 BaseRequest getRequest(javax.servlet.http.HttpServletRequest req)
          Returns the subscription operation details parsed out of the HTTP request.
 SubscriptionType getSubscriptionType()
          Returns the type of subscription operation being performed.
 void init()
          Initializes the subscribe servlet by loading an instance of the PushApplicationService from the spring context.
 void performSubscriptionOperation(BaseRequest baseRequest, javax.servlet.http.HttpServletResponse resp)
          Subscribes a user to a push application.
protected  void setPushApplicationService(PushApplicationService pushApplicationService)
          Sets the instance of PushApplicationService to use.
 
Methods inherited from class net.rim.pushsdk.subscription.web.SubscriptionServlet
addAuthenticationCredentials, authenticateSubscriber, authenticateSubscriber, checkEncoding, doGet, doPost, getAuthenticationRequest, setContentProviderAuthenticationService, setResponse, setSubscriptionRequestParser, setSubscriptionService
 
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, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubscribeServlet

public SubscribeServlet()
Method Detail

setPushApplicationService

protected void setPushApplicationService(PushApplicationService pushApplicationService)
Sets the instance of PushApplicationService to use.

Parameters:
pushApplicationService - an instance of PushApplicationService

init

public void init()
          throws javax.servlet.ServletException
Initializes the subscribe servlet by loading an instance of the PushApplicationService from the spring context.

Overrides:
init in class SubscriptionServlet
Throws:
javax.servlet.ServletException

performSubscriptionOperation

public void performSubscriptionOperation(BaseRequest baseRequest,
                                         javax.servlet.http.HttpServletResponse resp)
                                  throws IOException
Subscribes a user to a push application.

Specified by:
performSubscriptionOperation in class SubscriptionServlet
Parameters:
baseRequest - the subscribe request details
resp - the HTTP response
Throws:
IOException - if any IO errors occurred

getRequest

public BaseRequest getRequest(javax.servlet.http.HttpServletRequest req)
Description copied from class: SubscriptionServlet
Returns the subscription operation details parsed out of the HTTP request.

Specified by:
getRequest in class SubscriptionServlet
Parameters:
req - the HTTP request
Returns:
the subscription operation request details

getSubscriptionType

public SubscriptionType getSubscriptionType()
Description copied from class: SubscriptionServlet
Returns the type of subscription operation being performed.

Specified by:
getSubscriptionType in class SubscriptionServlet
Returns:
the subscription type


Copyright © 2011 Research In Motion. All Rights Reserved.