Package com.sun.research.ws.wadl

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


    }

    @Override
    public Representation createRequestRepresentation(org.glassfish.jersey.server.model.Resource r,
                                                      ResourceMethod m, MediaType mediaType) {
        Representation wadlRepresentation = new Representation();
        wadlRepresentation.setMediaType(mediaType.toString());
        return wadlRepresentation;
    }
View Full Code Here


    public List<Response> createResponses(org.glassfish.jersey.server.model.Resource r, ResourceMethod m) {
        final Response response = new Response();

        // add mediaType="*/*" in case that no mediaType was specified
        if (hasEmptyProducibleMediaTypeSet(m)) {
            Representation wadlRepresentation = createResponseRepresentation(r, m, MediaType.WILDCARD_TYPE);
            response.getRepresentation().add(wadlRepresentation);
        } else {
            for (MediaType mediaType : m.getProducedTypes()) {
                Representation wadlRepresentation = createResponseRepresentation(r, m, mediaType);
                response.getRepresentation().add(wadlRepresentation);
            }
        }

        List<Response> responses = new ArrayList<Response>();
View Full Code Here

        return method.getProducedTypes().isEmpty();
    }

    public Representation createResponseRepresentation(org.glassfish.jersey.server.model.Resource r, ResourceMethod m,
                                                       MediaType mediaType) {
        Representation wadlRepresentation = new Representation();
        wadlRepresentation.setMediaType(mediaType.toString());
        return wadlRepresentation;
    }
View Full Code Here

     *      (org.glassfish.jersey.server.model.Resource, org.glassfish.jersey.server.model.ResourceMethod, javax.ws.rs.core.MediaType)
     */
    public Representation createRequestRepresentation(
            org.glassfish.jersey.server.model.Resource ar, org.glassfish.jersey.server.model.ResourceMethod arm, MediaType mt) {

        final Representation rt = wadlGeneratorDelegate.createRequestRepresentation(ar, arm, mt);

        for (Parameter p : arm.getInvocable().getParameters()) {
            if (p.getSource() == Parameter.Source.ENTITY) {
                nameCallbacks.add(new TypeCallbackPair(
                        new GenericType(p.getType()),
                        new NameCallbackSetter() {
                            @Override
                            public void setName(QName name) {
                                rt.setElement(name);
                            }
                        }));
            }
        }

View Full Code Here

                            || (supportedInputTypes.size() == 1 && supportedInputTypes.get(0).isWildcardType())) {
                        supportedInputTypes = Collections.singletonList(MediaType.APPLICATION_FORM_URLENCODED_TYPE);
                    }

                    for (MediaType mediaType : supportedInputTypes) {
                        final Representation wadlRepresentation = setRepresentationForMediaType(r, m, mediaType, wadlRequest);
                        if (getParamByName(wadlRepresentation.getParam(), p.getSourceName()) == null) {
                            final Param wadlParam = generateParam(r, m, p);
                            if (wadlParam != null) {
                                wadlRepresentation.getParam().add(wadlParam);
                            }
                        }
                    }
                } else if (p.getSourceAnnotation().annotationType().getName().equals("org.glassfish.jersey.media.multipart" +
                        ".FormDataParam")) { // jersey-multipart support
                    // Use multipart/form-data if no @Consumes
                    List<MediaType> supportedInputTypes = m.getConsumedTypes();
                    if (supportedInputTypes.isEmpty()
                            || (supportedInputTypes.size() == 1 && supportedInputTypes.get(0).isWildcardType())) {
                        supportedInputTypes = Collections.singletonList(MediaType.MULTIPART_FORM_DATA_TYPE);
                    }

                    for (MediaType mediaType : supportedInputTypes) {
                        final Representation wadlRepresentation = setRepresentationForMediaType(r, m, mediaType, wadlRequest);
                        if (getParamByName(wadlRepresentation.getParam(), p.getSourceName()) == null) {
                            final Param wadlParam = generateParam(r, m, p);
                            if (wadlParam != null) {
                                wadlRepresentation.getParam().add(wadlParam);
                            }
                        }
                    }
                } else {
                    Param wadlParam = generateParam(r, m, p);
View Full Code Here

    private Representation setRepresentationForMediaType(org.glassfish.jersey.server.model.Resource r,
                                                         final org.glassfish.jersey.server.model.ResourceMethod m,
                                                         MediaType mediaType,
                                                         Request wadlRequest) {
        try {
            Representation wadlRepresentation = getRepresentationByMediaType(wadlRequest.getRepresentation(), mediaType);
            if (wadlRepresentation == null) {
                wadlRepresentation = _wadlGenerator.createRequestRepresentation(r, m, mediaType);
                wadlRequest.getRepresentation().add(wadlRepresentation);
            }
            return wadlRepresentation;
View Full Code Here

     * @see com.sun.jersey.server.wadl.WadlGenerator#createRequestRepresentation(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod, javax.ws.rs.core.MediaType)
     */
    public Representation createRequestRepresentation(
            AbstractResource ar, AbstractResourceMethod arm, MediaType mt ) {

        final Representation rt = _delegate.createRequestRepresentation( ar, arm, mt );

        for (Parameter p : arm.getParameters()) {
            if (p.getSource() == Parameter.Source.ENTITY) {
                _hasTypeWantsName.add( new Pair(
                        parameter(p),
                        new WantsName() {
                            @Override
                            public void setName(QName name) {
                                rt.setElement(name);
                            }
                        }));
            }
        }

View Full Code Here

        return wadlMethod;
    }

    @Override
    public Representation createRequestRepresentation( AbstractResource r, AbstractResourceMethod m, MediaType mediaType ) {
        Representation wadlRepresentation = new Representation();
        wadlRepresentation.setMediaType(mediaType.toString());
        return wadlRepresentation;
    }
View Full Code Here

    @Override
    public List<Response> createResponses( AbstractResource r, AbstractResourceMethod m ) {
        final Response response = new Response();

        for (MediaType mediaType: m.getSupportedOutputTypes()) {
            Representation wadlRepresentation = createResponseRepresentation( r, m, mediaType );
//            JAXBElement<Representation> element = new JAXBElement<Representation>(
//                    new QName("http://wadl.dev.java.net/2009/02","representation"),
//                    Representation.class,
//                    wadlRepresentation);
            response.getRepresentation().add(wadlRepresentation);
View Full Code Here

        responses.add(response);
        return responses;
    }

    public Representation createResponseRepresentation( AbstractResource r, AbstractResourceMethod m, MediaType mediaType ) {
        Representation wadlRepresentation = new Representation();
        wadlRepresentation.setMediaType(mediaType.toString());
        return wadlRepresentation;
    }
View Full Code Here

TOP

Related Classes of com.sun.research.ws.wadl.Representation

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.