protected <T extends Handler> T createHandler(Class<T> cls) { try { T handler = cls.newInstance(); logger.trace("Calling {}.init(Properties)", cls); //$NON-NLS-1$ handler.init(getProperties()); return handler; } catch (InstantiationException e) { throw new WebApplicationException(e); } catch (IllegalAccessException e) { throw new WebApplicationException(e); } }
public Properties getProperties() { return getDeploymentConfiguration().getProperties(); }
private void registerDefaultApplication() { try { String loadWinkApplicationsProperty = configuration.getProperties().getProperty(PROPERTY_LOAD_WINK_APPLICATIONS, Boolean.toString(true)); logger.trace("{} property is set to: {}", //$NON-NLS-1$ PROPERTY_LOAD_WINK_APPLICATIONS, loadWinkApplicationsProperty); final Set<Class<?>> classes = new ServletApplicationFileLoader(Boolean.parseBoolean(loadWinkApplicationsProperty)) .getClasses(); RegistrationUtils.InnerApplication application = new RegistrationUtils.InnerApplication(classes); application.setPriority(WinkApplication.SYSTEM_PRIORITY); configuration.addApplication(application, true); } catch (FileNotFoundException e) { throw new WebApplicationException(e); } }
private void registerRootResources() { Properties properties = configuration.getProperties(); String registerRootResource = properties.getProperty(PROPERTY_ROOT_RESOURCE, PROPERTY_ROOT_RESOURCE_DEFAULT); logger.trace("{} property is set to: {}", PROPERTY_ROOT_RESOURCE, registerRootResource); //$NON-NLS-1$ if (registerRootResource.equals(PROPERTY_ROOT_RESOURCE_ATOM)) { RegistrationUtils.InnerApplication application = new RegistrationUtils.InnerApplication(RootResource.class); application.setPriority(WinkApplication.SYSTEM_PRIORITY); configuration.addApplication(application, true); } else if (registerRootResource.equals(PROPERTY_ROOT_RESOURCE_NONE)) { // do nothing } else { String css = properties.getProperty(PROPERTY_ROOT_RESOURCE_CSS); logger.trace("{} property is set to: {}", PROPERTY_ROOT_RESOURCE_CSS, css); //$NON-NLS-1$ HtmlServiceDocumentResource instance = new HtmlServiceDocumentResource(); if (css != null) { instance.setServiceDocumentCssPath(css); } RegistrationUtils.InnerApplication application = new RegistrationUtils.InnerApplication(instance); application.setPriority(WinkApplication.SYSTEM_PRIORITY); configuration.addApplication(application, true); } }