AbstractGdataServletpublic abstract class AbstractGdataServlet extends HttpServlet Provides an abstract class to be subclassed to create an GDATA servlet
suitable for a GDATA serverside implementation. |
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 |
Methods Summary |
---|
public void | init(javax.servlet.ServletConfig arg0)
HANDLER_FACTORY = GDataServerRegistry.getRegistry().lookup(RequestHandlerFactory.class,ComponentType.REQUESTHANDLERFACTORY);
if(HANDLER_FACTORY == null)
throw new ServletException("service not available");
| private void | overrideMethod(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 void | service(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
do Xxx methods defined in this class. This method
is an GDATA-specific version of the {@link javax.servlet.Servlet#service}
method.
if (arg0.getHeader(METHOD_HEADER_NAME) == null) {
super.service(arg0, arg1);
return;
}
overrideMethod(arg0, arg1);
|
|