*
* @see initRequestUserHandlers
*/
@SuppressWarnings("unchecked")
protected RequestHandlersChain initRequestHandlersChain() {
RequestHandlersChain handlersChain = new RequestHandlersChain();
handlersChain.addHandler(createHandler(Requests.class));
handlersChain.addHandler(createHandler(ResourceInvocation.class));
handlersChain.addHandler(createHandler(SearchResultHandler.class));
String optionsHandler =
properties.getProperty("org.apache.wink.server.options.handler",
OptionsMethodHandler.class.getName());
if ("none".equals(optionsHandler)) {
optionsHandler = OptionsMethodHandler.class.getName();
}
logger.trace("org.apache.wink.server.options.handler value is {}", optionsHandler);
try {
handlersChain.addHandler(createHandler((Class<? extends RequestHandler>)Class
.forName(optionsHandler)));
} catch (Exception e) {
logger.trace("Could not load handlers class so adding default");
handlersChain.addHandler(createHandler(OptionsMethodHandler.class));
}
handlersChain.addHandler(createHandler(HeadMethodHandler.class));
handlersChain.addHandler(createHandler(FindRootResourceHandler.class));
handlersChain.addHandler(createHandler(FindResourceMethodHandler.class));
handlersChain.addHandler(createHandler(CreateInvocationParametersHandler.class));
if (requestUserHandlers != null) {
for (RequestHandler h : requestUserHandlers) {
h.init(properties);
handlersChain.addHandler(h);
}
}
handlersChain.addHandler(createHandler(InvokeMethodHandler.class));
logger.trace("Request handlers chain is: {}", handlersChain); //$NON-NLS-1$
return handlersChain;
}