FileDocCategorySizeDatePackage
AbstractGdataRequestHandler.javaAPI DocApache Lucene 2.1.04064Wed Feb 14 10:46:04 GMT 2007org.apache.lucene.gdata.servlet.handler

AbstractGdataRequestHandler

public abstract class AbstractGdataRequestHandler extends RequestAuthenticator implements GDataRequestHandler
author
Simon Willnauer

Fields Summary
private static final Log
LOG
private static final String
ENCODING
protected org.apache.lucene.gdata.server.Service
service
protected org.apache.lucene.gdata.server.GDataRequest
feedRequest
protected org.apache.lucene.gdata.server.GDataResponse
feedResponse
Constructors Summary
Methods Summary
protected voidcloseService()

        this.service.close();
    
private voidgetService(org.apache.lucene.gdata.server.GDataRequest request)

        GDataServerRegistry registry = GDataServerRegistry.getRegistry();
        ServiceFactory serviceFactory = registry.lookup(ServiceFactory.class,ComponentType.SERVICEFACTORY);
        this.service = serviceFactory.getService(request);
        if(this.service == null)
            throw new ServletException("Service not available"); 
        
    
protected voidinitializeRequestHandler(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.lucene.gdata.server.GDataRequest.GDataRequestType type)


                 
        
                

              
               
        this.feedRequest = new GDataRequest(request, type);
        this.feedResponse = new GDataResponse(response);
        this.feedResponse.setEncoding(ENCODING);
        
        try {       
            this.feedRequest.initializeRequest();
        } catch (GDataRequestException e) {
            setError(e.getErrorCode());
            LOG.warn("Couldn't initialize FeedRequest - " + e.getMessage(), e);
            throw e;
        }
        getService(this.feedRequest);
    
public abstract voidprocessRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

see
org.apache.lucene.gdata.servlet.handler.GDataRequestHandler#processRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

protected voidsendError()

        this.feedResponse.sendError();
        
    
protected voidsetError(int error)

		this.feedResponse.setError(error);
	
protected voidsetFeedResponseFormat()

		this.feedResponse.setOutputFormat(this.feedRequest.getRequestedResponseFormat());
	
protected voidsetFeedResponseStatus(int status)

		this.feedResponse.setResponseCode(status);