Package com.sun.research.ws.wadl

Examples of com.sun.research.ws.wadl.Application


    /**
     * @return the application
     * @see com.sun.jersey.server.wadl.WadlGenerator#createApplication()
     */
    public Application createApplication() {
        final Application result = _delegate.createApplication();
        if (_applicationDocs != null && _applicationDocs.getDocs() != null &&
                !_applicationDocs.getDocs().isEmpty()) {
            result.getDoc().addAll(_applicationDocs.getDocs());
        }
        return result;
    }
View Full Code Here


    /**
     * @return application
     * @see com.sun.jersey.server.wadl.WadlGenerator#createApplication()
     */
    public Application createApplication() {
        final Application result = _delegate.createApplication();
        if ( result.getGrammars() != null ) {
            LOG.info( "The wadl application created by the delegate ("+ _delegate +") already contains a grammars element," +
                " we're adding elements of the provided grammars file." );
            if ( !_grammars.getAny().isEmpty() ) {
                result.getGrammars().getAny().addAll( _grammars.getAny() );
            }
            if ( !_grammars.getDoc().isEmpty() ) {
                result.getGrammars().getDoc().addAll( _grammars.getDoc() );
            }
            if ( !_grammars.getInclude().isEmpty() ) {
                result.getGrammars().getInclude().addAll( _grammars.getInclude() );
            }
        }
        else {
            result.setGrammars( _grammars );
        }
        return result;
    }
View Full Code Here

     * Generate WADL for a set of resources.
     * @param resources the set of resources
     * @return the JAXB WADL application bean
     */
    public Application generate(Set<AbstractResource> resources) {
        Application wadlApplication = _wadlGenerator.createApplication();
        Resources wadlResources = _wadlGenerator.createResources();

        // for each resource
        for (AbstractResource r : resources) {
            Resource wadlResource = generateResource(r, null);
            wadlResources.getResource().add(wadlResource);
        }
        wadlApplication.setResources(wadlResources);

        addVersion(wadlApplication);
        return wadlApplication;
    }
View Full Code Here

        if (baseUri == null || baseUri.length() == 0) {
            throw new BuildException("baseUri attribute required", getLocation());
        }
       
        try {
            Application a = createApplication(classpath.list());
            a.getResources().setBase(baseUri);
            JAXBContext c = JAXBContext.newInstance("com.sun.research.ws.wadl",
                    this.getClass().getClassLoader());
            Marshaller m = c.createMarshaller();
            OutputStream out = new BufferedOutputStream(new FileOutputStream(wadlFile));
            m.marshal(a, out);
View Full Code Here

     * Generate WADL for a resource.
     * @param resource the resource
     * @return the JAXB WADL application bean
     */
    public Application generate(AbstractResource resource) {
        Application wadlApplication = _wadlGenerator.createApplication();
        Resources wadlResources = _wadlGenerator.createResources();
        Resource wadlResource = generateResource(resource, null);
        wadlResources.getResource().add(wadlResource);
        wadlApplication.setResources(wadlResources);

        addVersion(wadlApplication);
        return wadlApplication;
    }
View Full Code Here

     * @param resource the parent resource
     * @param path the value of the methods path annotations
     * @return the JAXB WADL application bean
     */
    public Application generate(AbstractResource resource, String path) {
        Application wadlApplication = _wadlGenerator.createApplication();
        Resources wadlResources = _wadlGenerator.createResources();
        Resource wadlResource = generateSubResource(resource, path);
        wadlResources.getResource().add(wadlResource);
        wadlApplication.setResources(wadlResources);

        addVersion(wadlApplication);
        return wadlApplication;
    }
View Full Code Here

        }
    }
   
    private static Application generateApplication(UriInfo info,
            AbstractResource resource, String path, WadlGenerator wadlGenerator) {  
        Application a = path == null ? new WadlBuilder( wadlGenerator ).generate(resource) :
            new WadlBuilder( wadlGenerator ).generate(resource, path);
       
        a.getResources().setBase(info.getBaseUri().toString());
               
        final Resource r = a.getResources().getResource().get(0);
        r.setPath(info.getBaseUri().relativize(
                info.getAbsolutePath()).toString());
       
        // remove path params since path is fixed at this point
        r.getParam().clear();
View Full Code Here

    public Resources createResources() {
        return new Resources();
    }

    public Application createApplication() {
        return new Application();
    }
View Full Code Here

            this.wadlGenerator = wadlGenerator;
        }
           
        @Override
        public void dispatch(final Object o, final HttpContext context) {           
            final Application a = generateApplication(context.getUriInfo(),
                    resource, path, wadlGenerator);
           
            context.getResponse().setResponse(
                    Response.ok(a, MediaTypes.WADL).header("Allow", allow).build());
        }
View Full Code Here

    public Application getApplication() {
        return getWadlBuilder().generate(rootResources);
    }

    public Application getApplication(UriInfo ui) {
        Application a = getWadlBuilder().generate(rootResources);
        a.getResources().setBase(ui.getBaseUri().toString());
        return a;
    }
View Full Code Here

TOP

Related Classes of com.sun.research.ws.wadl.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.