com.commsen.jwebthumb
Class WebThumbNotificationServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.commsen.jwebthumb.WebThumbNotificationServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

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

An abstract sevlet responsible for receiving notifications from webthumb. All extending classes need to implement processThumb(String, String) method in order to react on received notification.

This servlet will handle notifications via both GET and POST methods. To prevent fake calls to your servlet set key parameter to some hard to guess value:

 <init-param>
   <param-name>key</param-name>
   <param-value>my_hard_to_guess_secure_key</param-value>
 </init-param>
 
and make sure to provide the parameter in WebThumbRequest.setNotify(String) method:
 webThumbRequest.setNotify("http://YOUR.WEB.SITE/WebThumbNotifications?key=my_hard_to_guess_secure_key");
 

Author:
Milen Dyankov
See Also:
http://webthumb.bluga.net/apidoc#notify, Serialized Form

Constructor Summary
WebThumbNotificationServlet()
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 void init()
           
protected  void processRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
abstract  void processThumb(java.lang.String id, java.lang.String url)
          Method called when notification is received.
 
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

WebThumbNotificationServlet

public WebThumbNotificationServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

doGet

protected void doGet(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              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 req,
                      javax.servlet.http.HttpServletResponse resp)
               throws javax.servlet.ServletException,
                      java.io.IOException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

processRequest

protected void processRequest(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)

processThumb

public abstract void processThumb(java.lang.String id,
                                  java.lang.String url)
Method called when notification is received. Extending classes should implement this method and handle notifications as desired.

Parameters:
id - the job identifier
url - the url of the requested site


Copyright © 2010 COMMSEN International. All Rights Reserved.