}
protected void register(Class<?> applicationClass, Set<Class<?>> providers, Set<Class<?>> resources, ServletContext servletContext)
{
ApplicationPath path = applicationClass.getAnnotation(ApplicationPath.class);
if (path == null)
{
// todo we don't support this yet, i'm not sure if partial deployments are supported in all servlet containers
return;
}
ServletRegistration.Dynamic reg = servletContext.addServlet(applicationClass.getName(), HttpServlet30Dispatcher.class);
reg.setLoadOnStartup(1);
reg.setAsyncSupported(true);
reg.setInitParameter("javax.ws.rs.Application", applicationClass.getName());
if (path != null)
{
String mapping = path.value();
if (!mapping.startsWith("/")) mapping = "/" + mapping;
String prefix = mapping;
if (!prefix.equals("/") && prefix.endsWith("/")) prefix = prefix.substring(0, prefix.length() - 1);
if (mapping.endsWith("/")) mapping += "*";
else mapping += "/*";