Class AbstractMOServlet

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.vonage.client.sms.callback.AbstractMOServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class AbstractMOServlet
extends javax.servlet.http.HttpServlet
An abstract Servlet that receives and parses an incoming callback request for an MO message. This class parses and validates the request, optionally checks any provided signature or credentials, and constructs an MO object for your subclass to consume.

Note: This servlet will immediately ack the callback as soon as it is validated. Your subclass will consume the callback object asynchronously. This is because it is important to keep latency of the acknowledgement to a minimum in order to maintain throughput when operating at any sort of volume. You are responsible for persisting this object in the event of any failure whilst processing

See Also:
Serialized Form
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.concurrent.Executor consumer  
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractMOServlet​(boolean validateSignature, java.lang.String signatureSharedSecret, boolean validateUsernamePassword, java.lang.String expectedUsername, java.lang.String expectedPassword)  
  • Method Summary

    Modifier and Type Method Description
    abstract void consume​(MO mo)
    This method is asynchronously passed a complete MO instance to be dealt with by your application logic
    protected void doGet​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
    protected void doPost​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  

    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
  • Field Details

  • Constructor Details

    • AbstractMOServlet

      public AbstractMOServlet​(boolean validateSignature, java.lang.String signatureSharedSecret, boolean validateUsernamePassword, java.lang.String expectedUsername, java.lang.String expectedPassword)
  • Method Details

    • doGet

      protected void doGet​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
      Overrides:
      doGet in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      java.io.IOException
    • doPost

      protected void doPost​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
      Overrides:
      doPost in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      java.io.IOException
    • consume

      public abstract void consume​(MO mo)
      This method is asynchronously passed a complete MO instance to be dealt with by your application logic
      Parameters:
      mo - The message object that was provided in the HTTP request.