Package com.sun.research.ws.wadl

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


            this.lastBaseUri = uriInfo.getBaseUri();
            this.lastModified = new SimpleDateFormat(HTTPDATEFORMAT).format(new Date());

            ApplicationDescription applicationDescription =
                    wadlContext.getApplication(uriInfo);
            Application application = applicationDescription.getApplication();

            try {
                final Marshaller marshaller = wadlContext.getJAXBContext().createMarshaller();
                marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
                final ByteArrayOutputStream os = new ByteArrayOutputStream();
View Full Code Here


    /**
     * @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

//    }

    @Override
    public ApplicationDescription getApplication(UriInfo uriInfo) {
        ApplicationDescription a = getWadlBuilder().generate(rootResources);
        final Application application = a.getApplication();
        for(Resources resources : application.getResources()) {
            if (resources.getBase() == null) {
                resources.setBase(uriInfo.getBaseUri().toString());
            }
        }
        attachExternalGrammar(application,a, uriInfo.getRequestUri());
View Full Code Here

        //

        ApplicationDescription description = getApplication(info);

        WadlGenerator wadlGenerator = wadlGeneratorConfig.createWadlGenerator();
        Application a = path == null ? new WadlBuilder( wadlGenerator ).generate(description,resource) :
                new WadlBuilder( wadlGenerator ).generate(description, resource, path);

        for(Resources resources : a.getResources())
            resources.setBase(info.getBaseUri().toString());

        // Attach any grammar we may have

        attachExternalGrammar(a, description,
                info.getRequestUri());

        for(Resources resources : a.getResources()) {
            final Resource r = resources.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

     * Generate WADL for a set of resources.
     * @param resources the set of resources
     * @return the JAXB WADL application bean
     */
    public ApplicationDescription 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.getResources().add(wadlResources);

        addVersion(wadlApplication);
       
        // Build any external grammars
       
View Full Code Here

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

        addVersion(wadlApplication);
       
        // Attach the data to the parts of the model
       
View Full Code Here

     * @return the JAXB WADL application bean
     */
    public Application generate(
            ApplicationDescription description,
            AbstractResource resource, String path) {
        Application wadlApplication = _wadlGenerator.createApplication();
        Resources wadlResources = _wadlGenerator.createResources();
        Resource wadlResource = generateSubResource(resource, path);
        wadlResources.getResource().add(wadlResource);
        wadlApplication.getResources().add(wadlResources);

        addVersion(wadlApplication);
       
        // Attach the data to the parts of the model
       
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

            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

        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

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.