mappingSet = true;
} else {
log.warn("No Servlet mappings found for JAX-RS application: " + servletName + " either annotate it with @ApplicationPath or add a servlet-mapping in web.xml");
return;
}
ServletMappingMetaData mapping = new ServletMappingMetaData();
mapping.setServletName(servletName);
mapping.setUrlPatterns(patterns);
if (webdata.getServletMappings() == null) {
webdata.setServletMappings(new ArrayList<ServletMappingMetaData>());
}
webdata.getServletMappings().add(mapping);
}
//add a servlet named after the application class
JBossServletMetaData servlet = new JBossServletMetaData();
servlet.setName(servletName);
servlet.setServletClass(HttpServlet30Dispatcher.class.getName());
addServlet(webdata, servlet);
}
if (!mappingSet) {
//now we need tell resteasy it's relative path
final List<ServletMappingMetaData> mappings = webdata.getServletMappings();
if (mappings != null) {
for (final ServletMappingMetaData mapping : mappings) {
if (mapping.getServletName().equals(servletName)) {
if (mapping.getUrlPatterns() != null) {
for (String pattern : mapping.getUrlPatterns()) {
if (mappingSet) {
log.errorf("More than one mapping found for JAX-RS servlet: %s the second mapping %s will not work", servletName, pattern);
} else {
mappingSet = true;
String realPattern = pattern;