/**
   * @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
  @Override
  public List<Response> createResponses(
      org.glassfish.jersey.server.model.Resource r, ResourceMethod m) {
    final Response response = new Response();

    for (MediaType mediaType : m.getProducedTypes()) {
      if (!MediaType.WILDCARD_TYPE.equals(mediaType) || !hasEmptyProducibleMediaTypeSet(m)) {
        Representation wadlRepresentation = createResponseRepresentation(r, m, mediaType);
        response.getRepresentation().add(wadlRepresentation);
      }
    }

    List<Response> responses = new ArrayList<Response>();
    responses.add(response);
    return responses;
  }
Пример #3
0
  @Override
  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>();
    responses.add(response);
    return responses;
  }