/*
* jaxrs 1.1 spec section 2.3.2 If an Application subclass is present and there is already a servlet defined that has a servlet initialization
* ...
*/
Class<? extends Application> applicationClass;
BundleClassLoader bundleClassLoader = new BundleClassLoader(bundle);
for (Servlet servlet : webApp.getServlet()) {
List<ParamValue> params = servlet.getInitParam();
for (ParamValue parm : params) {
if (!parm.getParamName().trim().equals("javax.ws.rs.Application")) {
continue;
}
for (Class<? extends Application> clazz : applicationClasses) {
if (clazz.getName().equalsIgnoreCase(parm.getParamValue().trim())) {
applicationClass = clazz;
Class<?> servletClass = null;
try {
servletClass = bundleClassLoader.loadClass(servlet.getServletClass());
} catch (ClassNotFoundException e) {
log.warn("failed to load servlet class:" + servlet.getServletClass());
}
if ((servletClass == null) || !servletClass.isAssignableFrom(HttpServlet.class)) {
servlet.setServletClass(REST_SERVLET_NAME);