}
public boolean invoke(HttpServletRequest request, HttpServletResponse res, boolean returnErrors)
throws ServletException {
try {
String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
AbstractHTTPDestination d = destinationRegistry.getDestinationForPath(pathInfo, true);
if (d == null) {
if (!isHideServiceList && (request.getRequestURI().endsWith(serviceListRelativePath)
|| request.getRequestURI().endsWith(serviceListRelativePath + "/")
|| StringUtils.isEmpty(pathInfo)
|| "/".equals(pathInfo))) {
if (isAuthServiceListPage) {
setAuthServiceListPageAttribute(request);
}
setBaseURLAttribute(request);
serviceListGenerator.service(request, res);
} else {
d = destinationRegistry.checkRestfulRequest(pathInfo);
if (d == null || d.getMessageObserver() == null) {
if (returnErrors) {
LOG.warning("Can't find the the request for "
+ request.getRequestURL() + "'s Observer ");
generateNotFound(request, res);
}
return false;
}
}
}
if (d != null) {
Bus bus = d.getBus();
ClassLoaderHolder orig = null;
try {
if (bus != null) {
ClassLoader loader = bus.getExtension(ClassLoader.class);
if (loader == null) {
ResourceManager manager = bus.getExtension(ResourceManager.class);
if (manager != null) {
loader = manager.resolveResource("", ClassLoader.class);
}
}
if (loader != null) {
//need to set the context classloader to the loader of the bundle
orig = ClassLoaderUtils.setThreadContextClassloader(loader);
}
}
updateDestination(request, d);
if (bus != null) {
QueryHandlerRegistry queryHandlerRegistry = bus.getExtension(QueryHandlerRegistry.class);
if ("GET".equals(request.getMethod())
&& !StringUtils.isEmpty(request.getQueryString())
&& queryHandlerRegistry != null) {
EndpointInfo ei = d.getEndpointInfo();
String ctxUri = request.getPathInfo();
String baseUri = request.getRequestURL().toString()
+ "?" + request.getQueryString();
QueryHandler selectedHandler =