protected Class<?> loadApplicationClass(String appClassName) throws ServletException { return loadClass(appClassName, "Application"); }
protected Class<?> loadApplicationClass(String appClassName) throws ServletException { return loadClass(appClassName, "Application"); }
protected Class<?> loadClass(String cName) throws ServletException { return loadClass(cName, "Resource"); }
protected Class<?> loadClass(String cName) throws ServletException { return loadClass(cName, "Resource"); }
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 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 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); } } }
if (!theValue.isEmpty()) { try { Class<?> intClass = loadClass(theValue, "Interceptor"); Object object = intClass.newInstance(); injectProperties(object, props);
if (theValue.length() != 0) { try { Class<?> intClass = loadClass(theValue, "Interceptor"); Object object = intClass.newInstance(); injectProperties(object, props);