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

DeleteFeedHandler

public class DeleteFeedHandler extends AbstractFeedHandler
author
Simon Willnauer

Fields Summary
private static final Log
LOG
Constructors Summary
Methods Summary
private org.apache.lucene.gdata.data.ServerBaseFeedcreateDeleteFeed(javax.servlet.http.HttpServletRequest request)

        String feedId = request.getParameter("feedid");
        if(feedId == null){
            setError(GDataResponse.BAD_REQUEST,"No feed id specified");
            throw new FeedHandlerException("no feed Id specified");
        }
        ServerBaseFeed retVal = new ServerBaseFeed();
        retVal.setId(feedId);
        return retVal;
    
public voidprocessRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

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


               
    
             
            super.processRequest(request,response);
            if(this.authenticated){
                AdminService service = null;
            try {
                ServerBaseFeed feed = createDeleteFeed(request);
                
                GDataServerRegistry registry = GDataServerRegistry.getRegistry();
                ServiceFactory serviceFactory = registry.lookup(ServiceFactory.class,ComponentType.SERVICEFACTORY);
                if(serviceFactory == null){
                    setError(GDataResponse.SERVER_ERROR,"required component is not available");
                    throw new FeedHandlerException("Can't save feed - ServiceFactory is null");
                }
                service = serviceFactory.getAdminService();
                service.deleteFeed(feed);
            } catch (FeedHandlerException e) {
                LOG.error("Can not delete feed -- "+e.getMessage(),e);
            }catch (ServiceException e) {
                LOG.error("Can not delete feed -- "+e.getMessage(),e);
                setError(e.getErrorCode(),"can not create feed");
            }finally{
                if(service != null)
                    service.close();
            }
            }
            sendResponse(response);