Package javax.ws.rs.core

Examples of javax.ws.rs.core.Application


         String application = bootstrap.getInitParameter("javax.ws.rs.Application");
         if (application != null)
         {
            try
            {
               Application app = ResteasyDeployment.createApplication(application.trim(), providerFactory);
               dispatcher.getDefaultContextObjects().put(Application.class, app);
               // push context data so we can inject it
               Map contextDataMap = ResteasyProviderFactory.getContextDataMap();
               contextDataMap.putAll(dispatcher.getDefaultContextObjects());
               processApplication(app);
View Full Code Here


        assertEquals("test/foo", c.getProduceMime().get(0).toString());
    }
   
    @Test
    public void testNameBindings() {
        Application app = new TestApplication();
        JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, true, true);
        ClassResourceInfo cri = bean.getServiceFactory().getClassResourceInfo().get(0);
        List<String> names = cri.getNameBindings();
        assertEquals(Collections.singletonList(CustomNameBinding.class.getName()), names);
    }
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

    private RestClient createRestClient() {
        ClientConfig config = new ClientConfig();

        // configureBasicAuth(config, userName, password);

        config.applications(new Application() {

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

            appPrefix = webApp.contextRoot; // if multiple application classes reinit it
            if (!appPrefix.endsWith("/")) {
                appPrefix += "/";
            }

            Application appInstance;
            Class<?> appClazz;
            try {
                appClazz = classLoader.loadClass(app);
                appInstance = Application.class.cast(appClazz.newInstance());
            } catch (Exception e) {
                throw new OpenEJBRestRuntimeException("can't create class " + app, e);
            }

            ApplicationPath path = appClazz.getAnnotation(ApplicationPath.class);
            if (path != null) {
                String appPath = path.value();
                if (appPath.startsWith("/")) {
                    appPrefix += appPath.substring(1);
                } else {
                    appPrefix += appPath;
                }
            }

            Set<Object> singletons = appInstance.getSingletons();
            for (Object o : singletons) {
                if (o == null) {
                    continue;
                }

                if (restEjbs.containsKey(o.getClass().getName())) {
                    // no more a singleton if the ejb i not a singleton...but it is a weird case
                    deployEJB(appPrefix, restEjbs.get(o.getClass().getName()).context);
                } else {
                    deploySingleton(appPrefix, o, appInstance, classLoader);
                }
            }
            Set<Class<?>> classes = appInstance.getClasses();
            for (Class<?> clazz : classes) {
                if (restEjbs.containsKey(clazz.getName())) {
                    deployEJB(appPrefix, restEjbs.get(clazz.getName()).context);
                } else {
                    deployPojo(appPrefix, clazz, appInstance, classLoader, injections, context, owbCtx);
View Full Code Here

                            classes.add(clazz);
                        } catch (ClassNotFoundException e) {
                            throw new OpenEJBException("Unable to load Application class: " + application, e);
                        }
                        try {
                            Application app = Application.class.cast(clazz.newInstance());
                            classes.addAll(app.getClasses());
                        } catch (InstantiationException e) {
                            throw new OpenEJBException("Unable to instantiate Application class: " + application, e);
                        } catch (IllegalAccessException e) {
                            throw new OpenEJBException("Unable to access Application class: " + application, e);
                        }
View Full Code Here

            return tg;
        }
    }

    private RestClient getRestClient() {
        return new RestClient(new ClientConfig().applications(new Application() {
            @Override
            public Set<Class<?>> getClasses() {
                Set<Class<?>> set = new HashSet<Class<?>>();
                set.add(TestGenericsProvider.class);
                return set;
View Full Code Here

    @Override
    public void setUp() throws Exception {
        super.setUp();
        client =
            new RestClient(new ClientConfig().acceptHeaderAutoSet(false)
                .applications(new Application() {

                    @Override
                    public Set<Class<?>> getClasses() {
                        Set<Class<?>> classes = new HashSet<Class<?>>();
                        classes.add(JsonProvider.class);
View Full Code Here

                                               String splitChar)
        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),
                                            getStaticSubResolutionValue(servletConfig));
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

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.