protected List<?> getProviders(ServletConfig servletConfig, String splitChar) throws ServletException { String providersList = servletConfig.getInitParameter(PROVIDERS_PARAM); if (providersList == null) { return Collections.emptyList(); } String[] classNames = providersList.split(splitChar); List<Object> providers = new ArrayList<>(); for (String cName : classNames) { Map<String, List<String>> props = new HashMap<>(); String theName = getClassNameAndProperties(cName, props); if (!theName.isEmpty()) { Class<?> cls = loadClass(theName); providers.add(createSingletonInstance(cls, props, servletConfig)); } } return providers; }
protected List<? extends Feature> getFeatures(ServletConfig servletConfig, String splitChar) throws ServletException { String featuresList = servletConfig.getInitParameter(FEATURES_PARAM); if (featuresList == null) { return Collections.< Feature >emptyList(); } String[] classNames = featuresList.split(splitChar); List< Feature > features = new ArrayList<>(); for (String cName : classNames) { Map<String, List<String>> props = new HashMap<>(); String theName = getClassNameAndProperties(cName, props); if (!theName.isEmpty()) { Class<?> cls = loadClass(theName); if (Feature.class.isAssignableFrom(cls)) { features.add((Feature)createSingletonInstance(cls, props, servletConfig)); } } } return features; }
protected Application createApplicationInstance(String appClassName, ServletConfig servletConfig) throws ServletException { Map<String, List<String>> props = new HashMap<String, List<String>>(); appClassName = getClassNameAndProperties(appClassName, props); Class<?> appClass = loadApplicationClass(appClassName); return (Application)createSingletonInstance(appClass, props, servletConfig); }
protected Map<Class<?>, Map<String, List<String>>> getServiceClasses(ServletConfig servletConfig, boolean modelAvailable, String splitChar) throws ServletException { String serviceBeans = servletConfig.getInitParameter(SERVICE_CLASSES_PARAM); if (serviceBeans == null) { if (modelAvailable) { return Collections.emptyMap(); } throw new ServletException("At least one resource class should be specified"); } String[] classNames = serviceBeans.split(splitChar); Map<Class<?>, Map<String, List<String>>> map = new HashMap<>(); for (String cName : classNames) { Map<String, List<String>> props = new HashMap<>(); String theName = getClassNameAndProperties(cName, props); if (!theName.isEmpty()) { Class<?> cls = loadClass(theName); map.put(cls, props); } } if (map.isEmpty()) { throw new ServletException("At least one resource class should be specified"); } return map; }
protected Map<Class<?>, Map<String, List<String>>> getServiceClasses(ServletConfig servletConfig, boolean modelAvailable, String splitChar) throws ServletException { String serviceBeans = servletConfig.getInitParameter(SERVICE_CLASSES_PARAM); if (serviceBeans == null) { if (modelAvailable) { return Collections.emptyMap(); } throw new ServletException("At least one resource class should be specified"); } String[] classNames = StringUtils.split(serviceBeans, splitChar); Map<Class<?>, Map<String, List<String>>> map = new HashMap<Class<?>, Map<String, List<String>>>(); for (String cName : classNames) { Map<String, List<String>> props = new HashMap<String, List<String>>(); String theName = getClassNameAndProperties(cName, props); if (theName.length() != 0) { Class<?> cls = loadClass(theName); map.put(cls, props); } } if (map.isEmpty()) { throw new ServletException("At least one resource class should be specified"); } return map; }
protected List<?> getProviders(ServletConfig servletConfig, String splitChar) throws ServletException { String providersList = servletConfig.getInitParameter(PROVIDERS_PARAM); if (providersList == null) { return Collections.EMPTY_LIST; } String[] classNames = StringUtils.split(providersList, splitChar); List<Object> providers = new ArrayList<Object>(); for (String cName : classNames) { Map<String, List<String>> props = new HashMap<String, List<String>>(); String theName = getClassNameAndProperties(cName, props); if (theName.length() != 0) { Class<?> cls = loadClass(theName); providers.add(createSingletonInstance(cls, props, servletConfig)); } } return providers; }
protected void setInvoker(JAXRSServerFactoryBean bean, ServletConfig servletConfig) throws ServletException { String value = servletConfig.getInitParameter(INVOKER_PARAM); if (value == null) { return; } Map<String, List<String>> props = new HashMap<>(); String theValue = getClassNameAndProperties(value, props); if (!theValue.isEmpty()) { try { Class<?> intClass = loadClass(theValue, "Invoker"); Object object = intClass.newInstance(); injectProperties(object, props); bean.setInvoker((Invoker)object); } catch (ServletException ex) { throw ex; } catch (Exception ex) { LOG.warning("Invoker class " + theValue + " can not be created"); throw new ServletException(ex); } } }
protected List<? extends Feature> getFeatures(ServletConfig servletConfig, String splitChar) throws ServletException { String featuresList = servletConfig.getInitParameter(FEATURES_PARAM); if (featuresList == null) { return Collections.< Feature >emptyList(); } String[] classNames = StringUtils.split(featuresList, splitChar); List< Feature > features = new ArrayList< Feature >(); for (String cName : classNames) { Map<String, List<String>> props = new HashMap<String, List<String>>(); String theName = getClassNameAndProperties(cName, props); if (theName.length() != 0) { Class<?> cls = loadClass(theName); if (Feature.class.isAssignableFrom(cls)) { features.add((Feature)createSingletonInstance(cls, props, servletConfig)); } } } return features; } protected String getParameterSplitChar(ServletConfig servletConfig) {
protected void setInvoker(JAXRSServerFactoryBean bean, ServletConfig servletConfig) throws ServletException { String value = servletConfig.getInitParameter(INVOKER_PARAM); if (value == null) { return; } Map<String, List<String>> props = new HashMap<String, List<String>>(); String theValue = getClassNameAndProperties(value, props); if (theValue.length() != 0) { try { Class<?> intClass = loadClass(theValue, "Invoker"); Object object = intClass.newInstance(); injectProperties(object, props); bean.setInvoker((Invoker)object); } catch (ServletException ex) { throw ex; } catch (Exception ex) { LOG.warning("Invoker class " + theValue + " can not be created"); throw new ServletException(ex); } } }
protected ApplicationInfo createApplicationInfo(String appClassName, ServletConfig servletConfig) throws ServletException { Application customApp = createApplicationInstance(appClassName, servletConfig); if (customApp != null) { return new ApplicationInfo(customApp, getBus()); } Map<String, List<String>> props = new HashMap<>(); appClassName = getClassNameAndProperties(appClassName, props); Class<?> appClass = loadApplicationClass(appClassName); ApplicationInfo appInfo = (ApplicationInfo)createSingletonInstance(appClass, props, servletConfig); Map<String, Object> servletProps = new HashMap<>(); ServletContext servletContext = servletConfig.getServletContext(); for (Enumeration<String> names = servletContext.getInitParameterNames(); names.hasMoreElements();) { String name = names.nextElement(); servletProps.put(name, servletContext.getInitParameter(name)); } for (Enumeration<String> names = servletConfig.getInitParameterNames(); names.hasMoreElements();) { String name = names.nextElement(); servletProps.put(name, servletConfig.getInitParameter(name)); } appInfo.setOverridingProps(servletProps); return appInfo; }
for (String interceptorVal : values) { Map<String, List<String>> props = new HashMap<>(); String theValue = getClassNameAndProperties(interceptorVal, props); if (!theValue.isEmpty()) { try {
for (String interceptorVal : values) { Map<String, List<String>> props = new HashMap<String, List<String>>(); String theValue = getClassNameAndProperties(interceptorVal, props); if (theValue.length() != 0) { try {