FileDocCategorySizeDatePackage
AbstractGdataServlet.javaAPI DocApache Lucene 2.1.04326Wed Feb 14 10:46:04 GMT 2007org.apache.lucene.gdata.servlet

AbstractGdataServlet

public abstract class AbstractGdataServlet extends HttpServlet
Provides an abstract class to be subclassed to create an GDATA servlet suitable for a GDATA serverside implementation.
see
javax.servlet.http.HttpServlet
author
Simon Willnauer

Fields Summary
private static final String
METHOD_HEADER_NAME
private static final String
METHOD_DELETE
private static final String
METHOD_GET
private static final String
METHOD_POST
private static final String
METHOD_PUT
protected static org.apache.lucene.gdata.servlet.handler.RequestHandlerFactory
HANDLER_FACTORY
Constructors Summary
Methods Summary
public voidinit(javax.servlet.ServletConfig arg0)

see
javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)

        HANDLER_FACTORY = GDataServerRegistry.getRegistry().lookup(RequestHandlerFactory.class,ComponentType.REQUESTHANDLERFACTORY);
        if(HANDLER_FACTORY == null)
            throw new ServletException("service not available");
        
    
private voidoverrideMethod(javax.servlet.http.HttpServletRequest arg0, javax.servlet.http.HttpServletResponse arg1)

 
        final String method = arg0.getMethod(); 
        final String overrideHeaderMethod = arg0.getHeader(METHOD_HEADER_NAME); 
        if (overrideHeaderMethod.equals(method)) { 
            super.service(arg0, arg1); 
            return; 
        } 
        // These methodes are use by GDATA Client APIs 
        if (overrideHeaderMethod.equals(METHOD_DELETE)) { 
            doDelete(arg0, arg1); 
        } else if (overrideHeaderMethod.equals(METHOD_GET)) { 
            doGet(arg0, arg1); 
        } else if (overrideHeaderMethod.equals(METHOD_POST)) { 
            doPost(arg0, arg1); 
        } else if (overrideHeaderMethod.equals(METHOD_PUT)) { 
            doPut(arg0, arg1); 
        } else { 
            // if another method has been overwritten follow the HttpServlet 
            // implementation 
            super.service(arg0, arg1); 
        } 
 
    
protected voidservice(javax.servlet.http.HttpServletRequest arg0, javax.servlet.http.HttpServletResponse arg1)
This overwrites the protected service method to dispatch the request to the correponding do method. There is ususaly no need for overwriting this method. The GData protool and the Google GData API uses the x-http-method-override header to get through firewalls. The http method will be overritten by the x-http-method-override and dispatched to the doXxx methods defined in this class. This method is an GDATA-specific version of the {@link javax.servlet.Servlet#service} method.

see
HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

 
 
                                                                                                      
     
          
                
        if (arg0.getHeader(METHOD_HEADER_NAME) == null) { 
            super.service(arg0, arg1); 
            return; 
        } 
        overrideMethod(arg0, arg1);