Package com.sun.jersey.server.wadl

Examples of com.sun.jersey.server.wadl.ApplicationDescription


        if (baseUri == null || baseUri.length() == 0) {
            throw new BuildException("baseUri attribute required", getLocation());
        }
       
        try {
            ApplicationDescription ad = createApplication(classpath.list());
           
            WRITE_OUT_WADL : {
                Application a = ad.getApplication();
                for(Resources resources : a.getResources())
                        resources.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));
                try {
                    m.marshal(a, out);
                }
                finally {
                    out.close();
                }
            }
           
            WRITE_OUT_EXTERNAL_DATA : {
                // TODO work out how to reconsile the different paths
                File wadlChildren = new File(wadlFile.getPath() + "-/");
                wadlChildren.mkdirs();
                for (String key : ad.getExternalMetadataKeys()) {
                   
                    // Create the next file based on the key
                    //
                    File nextFile = new File(wadlChildren, "key");
                    ApplicationDescription.ExternalGrammar em = ad.getExternalGrammar( key );

                    // Write a copy to disk
                    //
                    OutputStream out = new BufferedOutputStream(new FileOutputStream(nextFile));
                    try {
View Full Code Here


        /* Generate WADL for that class */
        WadlGenerator wg = new WadlGeneratorResourceDocSupport(new WadlGeneratorImpl(), rdt);

        WadlBuilder wb = new WadlBuilder(wg);
        AbstractResource resource = IntrospectionModeller.createResource(TestResource.class);
        ApplicationDescription app = wb.generate(null, Collections.singleton(resource));


        /* Confirm that it can be marshalled without error */
        StringWriter sw = new StringWriter();

        JAXBContext context = JAXBContext.newInstance(Application.class);
        Marshaller m = context.createMarshaller();
        m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);

        m.marshal(app.getApplication(), sw);
    }
View Full Code Here

        // Fail if wadl generation is disabled
        if(!wadlContext.isWadlGenerationEnabled()) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }

        ApplicationDescription applicationDescription =
            wadlContext.getApplication(uriInfo);

        // Fail is we don't have any metadata for this path
        ApplicationDescription.ExternalGrammar externalMetadata = applicationDescription.getExternalGrammar( path );

        if( externalMetadata==null ) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }
View Full Code Here

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

            String path) {

        // Get the root application description
        //

        ApplicationDescription description = getApplication(info);

        WadlGenerator wadlGenerator = wadlGeneratorConfig.createWadlGenerator();

        Application a = path == null ? new WadlBuilder( wadlGenerator ).generate(info, description,resource) :
                new WadlBuilder( wadlGenerator ).generate(info, description, resource, path);
View Full Code Here

                    wadlGenerator = loadWadlGenerator( wadlGeneratorDescription, wadlGenerator );
                }
            }
            wadlGenerator.init();

            final ApplicationDescription ad = this.createApplicationDescription(this._packagesResourceConfig, wadlGenerator);
            final Application a = ad.getApplication();
            for(Resources resources : a.getResources())
                resources.setBase(_baseUri);

            this.writeExternalGrammars(ad);
View Full Code Here

        if ((wadlXmlRepresentation == null) || ((lastBaseUri != null) && !lastBaseUri.equals(uriInfo.getBaseUri())) ) {
            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

        // Fail if wadl generation is disabled
        if(!wadlContext.isWadlGenerationEnabled()) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }

        ApplicationDescription applicationDescription =
            wadlContext.getApplication(uriInfo);

        // Fail is we don't have any metadata for this path
        ApplicationDescription.ExternalGrammar externalMetadata = applicationDescription.getExternalGrammar( path );

        if( externalMetadata==null ) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }
View Full Code Here

//        return getWadlBuilder().generate(rootResources);
//    }

    @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());
            }
        }
View Full Code Here

                                      String path) {

        // Get the root application description
        //

        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);
View Full Code Here

TOP

Related Classes of com.sun.jersey.server.wadl.ApplicationDescription

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.