下面列出了怎么用org.springframework.web.servlet.mvc.Controller的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
protected HandlerAdapter getHandlerAdapter(Object handler) throws ServletException {
if (handler instanceof HttpRequestHandler) {
return new HttpRequestHandlerAdapter();
} else if (handler instanceof Controller) {
Object unwrappedHandler = ClassLoaderUtils.unwrapFromProxy(handler);
if (unwrappedHandler instanceof CXFServletControllerAdapter) {
// TODO this just seems weird as this controller is initially null when it's created, does there need to be some synchronization here?
((CXFServletControllerAdapter)unwrappedHandler).setController(cxfServletController);
}
return new SimpleControllerHandlerAdapter();
}
throw new RiceRuntimeException("handler of type " + handler.getClass().getName() + " is not known and can't be used by " + KSBDispatcherServlet.class.getName());
}
public boolean isControllerType(Class<?> beanClass) {
return Controller.class.isAssignableFrom(beanClass);
}
public boolean isControllerType(Class<?> beanClass) {
return Controller.class.isAssignableFrom(beanClass);
}
public HttpProxyFilter(boolean enabled, Controller proxyController) {
this.enabled = enabled;
this.proxyController = proxyController;
}