org.eclipse.jetty.example.asyncrest
Class AbstractRestServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.eclipse.jetty.example.asyncrest.AbstractRestServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig
Direct Known Subclasses:
AsyncRestServlet, SerialRestServlet

public class AbstractRestServlet
extends HttpServlet

Abstract Servlet implementation class AsyncRESTServlet. Enquires ebay REST service for auctions by key word. May be configured with init parameters:

appid
The eBay application ID to use
Each request examines the following request parameters:
items
The keyword to search for

See Also:
Serialized Form

Field Summary
protected static String __DEFAULT_APPID
           
protected  String _appid
           
protected static String APPID_PARAM
           
protected static String ITEMS_PARAM
           
protected static String STYLE
           
 
Constructor Summary
AbstractRestServlet()
           
 
Method Summary
protected  void doPost(HttpServletRequest request, HttpServletResponse response)
           
protected  String generateThumbs(Queue<Map<String,String>> results)
           
 void init(ServletConfig servletConfig)
           
protected  String ms(long nano)
           
protected  String restURL(String item)
           
protected  int width(long nano)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, 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
 

Field Detail

__DEFAULT_APPID

protected static final String __DEFAULT_APPID
See Also:
Constant Field Values

STYLE

protected static final String STYLE
See Also:
Constant Field Values

ITEMS_PARAM

protected static final String ITEMS_PARAM
See Also:
Constant Field Values

APPID_PARAM

protected static final String APPID_PARAM
See Also:
Constant Field Values

_appid

protected String _appid
Constructor Detail

AbstractRestServlet

public AbstractRestServlet()
Method Detail

init

public void init(ServletConfig servletConfig)
          throws ServletException
Specified by:
init in interface Servlet
Overrides:
init in class GenericServlet
Throws:
ServletException

restURL

protected String restURL(String item)

generateThumbs

protected String generateThumbs(Queue<Map<String,String>> results)

ms

protected String ms(long nano)

width

protected int width(long nano)

doPost

protected void doPost(HttpServletRequest request,
                      HttpServletResponse response)
               throws ServletException,
                      IOException
Overrides:
doPost in class HttpServlet
Throws:
ServletException
IOException


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.