Methods Summary |
---|
protected org.apache.lucene.gdata.data.ServerBaseFeed | createFeedFromRequest(javax.servlet.http.HttpServletRequest request)
GDataServerRegistry registry = GDataServerRegistry.getRegistry();
String providedService = request.getParameter(PARAMETER_SERVICE);
if(!registry.isServiceRegistered(providedService)){
setError(GDataResponse.NOT_FOUND,"no such service");
throw new FeedHandlerException("ProvicdedService is not registered -- Name: "+providedService);
}
ProvidedService provServiceInstance = registry.getProvidedService(providedService);
if(providedService == null){
setError(GDataResponse.BAD_REQUEST,"no such service");
throw new FeedHandlerException("no such service registered -- "+providedService);
}
try{
ServerBaseFeed retVal = new ServerBaseFeed(GDataEntityBuilder.buildFeed(request.getReader(),provServiceInstance));
retVal.setServiceConfig(provServiceInstance);
return retVal;
}catch (IOException e) {
if(LOG.isInfoEnabled())
LOG.info("Can not read from input stream - ",e);
setError(GDataResponse.BAD_REQUEST,"Can not read from input stream");
throw e;
}catch (ParseException e) {
if(LOG.isInfoEnabled())
LOG.info("feed can not be parsed - ",e);
setError(GDataResponse.BAD_REQUEST,"incoming feed can not be parsed");
throw e;
}
|
protected org.apache.lucene.gdata.data.GDataAccount | createRequestedAccount(javax.servlet.http.HttpServletRequest request)
GDataServerRegistry registry = GDataServerRegistry.getRegistry();
ServiceFactory serviceFactory = registry.lookup(ServiceFactory.class,ComponentType.SERVICEFACTORY);
if(serviceFactory == null){
setError(GDataResponse.SERVER_ERROR, "Required server component not available");
throw new FeedHandlerException("Required server component not available -- "+ServiceFactory.class.getName());
}
AdminService service = serviceFactory.getAdminService();
String account = request.getParameter(PARAMETER_ACCOUNT);
try{
return service.getAccount(account);
}catch (ServiceException e) {
if(LOG.isInfoEnabled())
LOG.info("no account for requested account - "+account,e);
setError(HttpServletResponse.SC_BAD_REQUEST,"no such account");
throw new FeedHandlerException(e.getMessage(),e);
}
|
protected int | getErrorCode()
return this.error;
|
protected java.lang.String | getErrorMessage()
return this.errorMessage;
|
public void | processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
this.authenticated = authenticateAccount(request,AccountRole.FEEDAMINISTRATOR);
if(!this.authenticated)
setError(GDataResponse.UNAUTHORIZED,"Authorization failed");
|
protected void | sendResponse(javax.servlet.http.HttpServletResponse response)
if(!this.isError)
return;
try{
response.sendError(this.error,this.errorMessage);
}catch (IOException e) {
LOG.warn("can send error in RequestHandler ",e);
}
|
protected void | setError(int error, java.lang.String message)
this.error = error;
this.errorMessage = message;
this.isError = true;
|