Package org.glassfish.jersey.server.wadl

Examples of org.glassfish.jersey.server.wadl.WadlGenerator


        this.serviceLocator = serviceLocator;
        this.wadlGeneratorConfig = WadlGeneratorConfigLoader.loadWadlGeneratorsFromConfig(configuration.getProperties());

        // TODO perhaps this should be done another way for the moment
        // create a temporary generator just to do this one task
        final WadlGenerator wadlGenerator = wadlGeneratorConfig.createWadlGenerator(serviceLocator);
        JAXBContext jaxb;
        try {
            // Nasty ClassLoader magic. JAXB-API has some strange limitation about what classloader can
            // be used in OSGi environment - it must be same as context ClassLoader. Following code just
            // workarounds this limitation
            // see JERSEY-1818
            // see JSR222-46

            final ClassLoader contextClassLoader = ReflectionHelper.getContextClassLoader();
            final ClassLoader jerseyModuleClassLoader = wadlGenerator.getClass().getClassLoader();
            ReflectionHelper.setContextClassLoader(jerseyModuleClassLoader);

            jaxb = JAXBContext.newInstance(wadlGenerator.getRequiredJaxbContextPath(),
                    jerseyModuleClassLoader);

            ReflectionHelper.setContextClassLoader(contextClassLoader);
        } catch (JAXBException ex) {
            try {
                // fallback for glassfish
                LOGGER.log(Level.FINE, LocalizationMessages.WADL_JAXB_CONTEXT_FALLBACK(), ex);
                jaxb = JAXBContext.newInstance(wadlGenerator.getRequiredJaxbContextPath());
            } catch (JAXBException innerEx) {
                throw new ProcessingException(LocalizationMessages.ERROR_WADL_JAXB_CONTEXT(), ex);
            }
        }
        jaxbContext = jaxb;
View Full Code Here


        // Get the root application description
        //

        ApplicationDescription description = getApplication(info);

        WadlGenerator wadlGenerator = wadlGeneratorConfig.createWadlGenerator(serviceLocator);
        Application application = new WadlBuilder(wadlGenerator).generate(description, resource);

        for (Resources resources : application.getResources()) {
            resources.setBase(info.getBaseUri().toString());
        }
View Full Code Here

    private static final Logger LOGGER = Logger.getLogger(WadlGeneratorLoader.class.getName());

    static WadlGenerator loadWadlGenerators(
            List<WadlGenerator> wadlGenerators) throws Exception {
        WadlGenerator wadlGenerator = new WadlGeneratorJAXBGrammarGenerator();
        if (wadlGenerators != null && !wadlGenerators.isEmpty()) {
            for (WadlGenerator generator : wadlGenerators) {
                generator.setWadlGeneratorDelegate(wadlGenerator);
                wadlGenerator = generator;
            }
        }
        wadlGenerator.init();
        return wadlGenerator;
    }
View Full Code Here

        return loadWadlGeneratorDescriptions(serviceLocator, list);
    }

    static WadlGenerator loadWadlGeneratorDescriptions(ServiceLocator serviceLocator,
                                                       List<WadlGeneratorDescription> wadlGeneratorDescriptions) throws Exception {
        WadlGenerator wadlGenerator = new WadlGeneratorJAXBGrammarGenerator();

        final CallbackList callbacks = new CallbackList();
        try {
            if (wadlGeneratorDescriptions != null && !wadlGeneratorDescriptions.isEmpty()) {
                for (WadlGeneratorDescription wadlGeneratorDescription : wadlGeneratorDescriptions) {
                    final WadlGeneratorControl control = loadWadlGenerator(serviceLocator, wadlGeneratorDescription, wadlGenerator);
                    wadlGenerator = control.wadlGenerator;
                    callbacks.add(control.callback);
                }
            }
            wadlGenerator.init();
        } finally {
            callbacks.callback();
        }

        return wadlGenerator;
View Full Code Here

    private static WadlGeneratorControl loadWadlGenerator(ServiceLocator serviceLocator,
            WadlGeneratorDescription wadlGeneratorDescription,
            WadlGenerator wadlGeneratorDelegate) throws Exception {
        LOGGER.info("Loading wadlGenerator " + wadlGeneratorDescription.getGeneratorClass().getName());
        final WadlGenerator generator = Injections.getOrCreate(serviceLocator, wadlGeneratorDescription.getGeneratorClass());
        generator.setWadlGeneratorDelegate(wadlGeneratorDelegate);
        CallbackList callbacks = null;
        if (wadlGeneratorDescription.getProperties() != null
                && !wadlGeneratorDescription.getProperties().isEmpty()) {
            callbacks = new CallbackList();
            final Properties wadlGeneratorProperties = wadlGeneratorDescription.getProperties();
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.server.wadl.WadlGenerator

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.