Class WadlBuilder


  • public class WadlBuilder
    extends java.lang.Object
    This class implements the algorithm how the wadl is built for one or more Resource classes. Wadl artifacts are created by a WadlGenerator. Created on: Jun 18, 2008
    • Field Detail

      • uriInfo

        private final javax.ws.rs.core.UriInfo uriInfo
      • detailedWadl

        private final boolean detailedWadl
    • Constructor Detail

      • WadlBuilder

        public WadlBuilder​(WadlGenerator wadlGenerator,
                           boolean detailedWadl,
                           javax.ws.rs.core.UriInfo uriInfo)
    • Method Detail

      • generate

        public ApplicationDescription generate​(java.util.List<Resource> resources)
        Generate WADL for a set of resources.
        Parameters:
        resources - the set of resources.
        Returns:
        the JAXB WADL application bean.
      • generate

        public Application generate​(ApplicationDescription description,
                                    Resource resource)
        Generate WADL for a resource.
        Parameters:
        resource - the resource
        description - the overall application description so we can
        Returns:
        the JAXB WADL application bean
      • addVersion

        private void addVersion​(Application wadlApplication)
      • addHint

        private void addHint​(Application wadlApplication)
      • generateMethod

        private Method generateMethod​(Resource parentResource,
                                      java.util.Map<java.lang.String,​Param> wadlResourceParams,
                                      ResourceMethod resourceMethod)
      • generateRequest

        private Request generateRequest​(Resource parentResource,
                                        ResourceMethod resourceMethod,
                                        java.util.Map<java.lang.String,​Param> wadlResourceParams)
      • processRequestParameters

        private void processRequestParameters​(Resource parentResource,
                                              ResourceMethod resourceMethod,
                                              java.util.Map<java.lang.String,​Param> wadlResourceParams,
                                              java.util.Collection<Parameter> requestParameters,
                                              Request wadlRequest)
        Recursively processes provided request parameters and adds the resulting WADL information into the WADL request.
      • getParamByName

        private Param getParamByName​(java.util.List<Param> params,
                                     java.lang.String name)
      • setRepresentationForMediaType

        private Representation setRepresentationForMediaType​(Resource r,
                                                             ResourceMethod m,
                                                             javax.ws.rs.core.MediaType mediaType,
                                                             Request wadlRequest)
        Create the wadl Representation for the specified MediaType if not yet existing for the wadl Request and return it.
        Parameters:
        r - the resource
        m - the resource method
        mediaType - an accepted media type of the resource method
        wadlRequest - the wadl request the wadl representation is to be created for (if not yet existing).
        Returns:
        the wadl request representation for the specified MediaType.
      • getRepresentationByMediaType

        private Representation getRepresentationByMediaType​(java.util.List<Representation> representations,
                                                            javax.ws.rs.core.MediaType mediaType)
      • generateResource

        private Resource generateResource​(Resource r,
                                          java.lang.String path)
      • generateResource

        private Resource generateResource​(Resource resource,
                                          java.lang.String path,
                                          java.util.Set<Resource> visitedResources)