コード例 #1
0
  /**
   * @param resource abstract resource
   * @param resourceMethod abstract resource method
   * @return response
   * @see
   *     org.glassfish.jersey.server.wadl.WadlGenerator#createResponses(org.glassfish.jersey.server.model.Resource,
   *     org.glassfish.jersey.server.model.ResourceMethod)
   */
  public List<Response> createResponses(
      org.glassfish.jersey.server.model.Resource resource,
      final org.glassfish.jersey.server.model.ResourceMethod resourceMethod) {
    final List<Response> responses =
        wadlGeneratorDelegate.createResponses(resource, resourceMethod);
    if (responses != null) {

      for (Response response : responses) {
        for (final Representation representation : response.getRepresentation()) {

          // Process each representation
          nameCallbacks.add(
              new TypeCallbackPair(
                  new GenericType(resourceMethod.getInvocable().getResponseType()),
                  new NameCallbackSetter() {

                    public void setName(QName name) {
                      representation.setElement(name);
                    }
                  }));
        }
      }
    }
    return responses;
  }
コード例 #2
0
  public void init() throws Exception {
    wadlGeneratorDelegate.init();
    //
    seeAlsoClasses = new HashSet<Class>();

    // A matched list of Parm, Parameter to list the relavent
    // entity objects that we might like to transform.
    nameCallbacks = new ArrayList<TypeCallbackPair>();
  }
コード例 #3
0
  /**
   * @param ar abstract resource
   * @param path resources path
   * @return resource
   * @see
   *     org.glassfish.jersey.server.wadl.WadlGenerator#createResource(org.glassfish.jersey.server.model.Resource,
   *     String)
   */
  public Resource createResource(org.glassfish.jersey.server.model.Resource ar, String path) {
    for (Class<?> resClass : ar.getHandlerClasses()) {
      XmlSeeAlso seeAlso = (XmlSeeAlso) resClass.getAnnotation(XmlSeeAlso.class);
      if (seeAlso != null) {
        Collections.addAll(seeAlsoClasses, seeAlso.value());
      }
    }

    return wadlGeneratorDelegate.createResource(ar, path);
  }
コード例 #4
0
  public ExternalGrammarDefinition createExternalGrammar() {

    // Right now lets generate some external metadata

    Map<String, ApplicationDescription.ExternalGrammar> extraFiles =
        new HashMap<String, ApplicationDescription.ExternalGrammar>();

    // Build the model as required
    Resolver resolver = buildModelAndSchemas(extraFiles);

    // Pass onto the next delegate
    ExternalGrammarDefinition previous = wadlGeneratorDelegate.createExternalGrammar();
    previous.map.putAll(extraFiles);
    if (resolver != null) {
      previous.addResolver(resolver);
    }

    return previous;
  }
コード例 #5
0
  /**
   * @param ar abstract resource
   * @param am abstract method
   * @param p parameter
   * @return parameter
   * @see
   *     org.glassfish.jersey.server.wadl.WadlGenerator#createParam(org.glassfish.jersey.server.model.Resource,
   *     org.glassfish.jersey.server.model.ResourceMethod,
   *     org.glassfish.jersey.server.model.Parameter)
   */
  public Param createParam(
      org.glassfish.jersey.server.model.Resource ar,
      org.glassfish.jersey.server.model.ResourceMethod am,
      Parameter p) {
    final Param param = wadlGeneratorDelegate.createParam(ar, am, p);

    // If the paramter is an entity we probably want to convert this to XML
    //
    if (p.getSource() == Parameter.Source.ENTITY) {
      nameCallbacks.add(
          new TypeCallbackPair(
              new GenericType(p.getType()),
              new NameCallbackSetter() {
                public void setName(QName name) {
                  param.setType(name);
                }
              }));
    }

    return param;
  }
コード例 #6
0
  /**
   * @param ar abstract resource
   * @param arm abstract resource method
   * @param mt media type
   * @return respresentation type
   * @see org.glassfish.jersey.server.wadl.WadlGenerator# createRequestRepresentation
   *     (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);
                  }
                }));
      }
    }

    return rt;
  }
コード例 #7
0
 /**
  * @return resources
  * @see org.glassfish.jersey.server.wadl.WadlGenerator#createResources()
  */
 public Resources createResources() {
   return wadlGeneratorDelegate.createResources();
 }
コード例 #8
0
  /**
   * @param ar abstract resource
   * @param arm abstract resource method
   * @return request
   * @see
   *     org.glassfish.jersey.server.wadl.WadlGenerator#createRequest(org.glassfish.jersey.server.model.Resource,
   *     org.glassfish.jersey.server.model.ResourceMethod)
   */
  public Request createRequest(
      org.glassfish.jersey.server.model.Resource ar,
      org.glassfish.jersey.server.model.ResourceMethod arm) {

    return wadlGeneratorDelegate.createRequest(ar, arm);
  }
コード例 #9
0
 /**
  * @return application
  * @see org.glassfish.jersey.server.wadl.WadlGenerator#createApplication()
  */
 public Application createApplication() {
   return wadlGeneratorDelegate.createApplication();
 }
コード例 #10
0
 public String getRequiredJaxbContextPath() {
   return wadlGeneratorDelegate.getRequiredJaxbContextPath();
 }