Package javax.ws.rs.core

Examples of javax.ws.rs.core.Application


    testWebServer.stop();
  }
 
 
  private TestWebServer createTestWebServer(final Object resource) {
    return new TestWebServer(new Application() {

      @Override
      public Set<Class<?>> getClasses() {
        Set<Class<?>> result = new HashSet<Class<?>>();
        return result;
View Full Code Here


    public void setStart(boolean start) {
        this.start = start;
    }

    private void injectContexts() {
        Application application = appProvider == null ? null : appProvider.getProvider();
        for (ClassResourceInfo cri : serviceFactory.getClassResourceInfo()) {
            if (cri.isSingleton()) {
                InjectionUtils.injectContextProxiesAndApplication(cri,
                                                    cri.getResourceProvider().getInstance(null),
                                                    application);
View Full Code Here

    public void setStart(boolean start) {
        this.start = start;
    }

    private void injectContexts() {
        Application application = appProvider == null ? null : appProvider.getProvider();
        for (ClassResourceInfo cri : serviceFactory.getClassResourceInfo()) {
            if (cri.isSingleton()) {
                InjectionUtils.injectContextProxiesAndApplication(cri,
                                                    cri.getResourceProvider().getInstance(null),
                                                    application);
View Full Code Here

    protected void createServerFromApplication(String cName, ServletConfig servletConfig)
        throws ServletException {
        Map<String, String> props = new HashMap<String, String>();
        cName = getClassNameAndProperties(cName, props);
        Class<?> appClass = loadClass(cName, "Application");
        Application app = (Application)createSingletonInstance(appClass, props, servletConfig);
       
        String ignoreParam = servletConfig.getInitParameter(IGNORE_APP_PATH_PARAM);
        JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, MessageUtils.isTrue(ignoreParam));
        setAllInterceptors(bean, servletConfig);
        setExtensions(bean, servletConfig);
View Full Code Here

    }
   
    protected void createServerFromApplication(String cName, ServletConfig servletConfig)
        throws ServletException {
        Class<?> appClass = loadClass(cName, "Application");
        Application app = (Application)createSingletonInstance(appClass, servletConfig);
       
        String ignoreParam = servletConfig.getInitParameter(IGNORE_APP_PATH_PARAM);
        JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, MessageUtils.isTrue(ignoreParam));
        setAllInterceptors(bean, servletConfig);
        bean.setBus(getBus());
View Full Code Here

    protected void createServerFromApplication(String cName, ServletConfig servletConfig)
        throws ServletException {
        Map<String, String> props = new HashMap<String, String>();
        cName = getClassNameAndProperties(cName, props);
        Class<?> appClass = loadClass(cName, "Application");
        Application app = (Application)createSingletonInstance(appClass, props, servletConfig);
       
        String ignoreParam = servletConfig.getInitParameter(IGNORE_APP_PATH_PARAM);
        JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, MessageUtils.isTrue(ignoreParam));
        setAllInterceptors(bean, servletConfig);
        setExtensions(bean, servletConfig);
View Full Code Here

    }
   
    protected void createServerFromApplication(String cName, ServletConfig servletConfig)
        throws ServletException {
        Class<?> appClass = loadClass(cName, "Application");
        Application app = null;
        try {
            app = (Application)appClass.newInstance();
        } catch (InstantiationException ex) {
            ex.printStackTrace();
            throw new ServletException("Application class " + cName
                                       + " can not be instantiated");
        } catch (IllegalAccessException ex) {
            ex.printStackTrace();
            throw new ServletException("Application class " + cName
                                       + " can not be instantiated due to IllegalAccessException");
        }
       
        verifySingletons(app.getSingletons());
       
        List<Class> resourceClasses = new ArrayList<Class>();
        List<Object> providers = new ArrayList<Object>();
        Map<Class, ResourceProvider> map = new HashMap<Class, ResourceProvider>();
       
        // at the moment we don't support per-request providers, only resource classes
        // Note, app.getClasse() returns a list of per-resource classes
        for (Class<?> c : app.getClasses()) {
            if (isValidPerRequestResourceClass(c, app.getSingletons())) {
                resourceClasses.add(c);
                map.put(c, new PerRequestResourceProvider(c));
            }
        }
       
        // we can get either a provider or resource class here       
        for (Object o : app.getSingletons()) {
            boolean isProvider = o.getClass().getAnnotation(Provider.class) != null;
            if (isProvider) {
                providers.add(o);
            } else {
                resourceClasses.add(o.getClass());
View Full Code Here

    private RestClient createRestClient(HttpClient httpClient) {
        ClientConfig config = new ApacheHttpClientConfig(httpClient);

        // configureBasicAuth(config, userName, password);

        config.applications(new Application() {

            @Override
            public Set<Class<?>> getClasses() {
                return Collections.emptySet();
            }
View Full Code Here

        ClassReference classReference = new ClassReference(implementation.getApplication());
        classReference = resolver.resolveModel(ClassReference.class, classReference, context);
        implementation.setApplicationClass(classReference.getJavaClass());
        implementation.setUnresolved(false);
       
        Application application;
        try {
            application = (Application) implementation.getApplicationClass().newInstance();
        } catch (Exception e) {
            throw new ContributionResolveException(e);
        }
       
        for(Class<?> rootResourceClass: application.getClasses()) {
            addService(implementation, rootResourceClass);
        }
        for(Object rootResource: application.getSingletons()) {
            addService(implementation, rootResource.getClass());
        }
       
    }
View Full Code Here

    }
   
    protected void createServerFromApplication(String cName, ServletConfig servletConfig)
        throws ServletException {
        Class<?> appClass = loadClass(cName, "Application");
        Application app = null;
        try {
            app = (Application)appClass.newInstance();
        } catch (InstantiationException ex) {
            ex.printStackTrace();
            throw new ServletException("Application class " + cName
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.Application

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.