use of com.sun.research.ws.wadl.Request in project jersey by jersey.
the class WadlBuilder method generateMethod.
private com.sun.research.ws.wadl.Method generateMethod(final org.glassfish.jersey.server.model.Resource parentResource, final Map<String, Param> wadlResourceParams, final org.glassfish.jersey.server.model.ResourceMethod resourceMethod) {
try {
if (!detailedWadl && resourceMethod.isExtended()) {
return null;
}
com.sun.research.ws.wadl.Method wadlMethod = _wadlGenerator.createMethod(parentResource, resourceMethod);
// generate the request part
Request wadlRequest = generateRequest(parentResource, resourceMethod, wadlResourceParams);
if (wadlRequest != null) {
wadlMethod.setRequest(wadlRequest);
}
// generate the response part
final List<Response> responses = generateResponses(parentResource, resourceMethod);
if (responses != null) {
wadlMethod.getResponse().addAll(responses);
}
return wadlMethod;
} catch (Exception e) {
throw new ProcessingException(LocalizationMessages.ERROR_WADL_BUILDER_GENERATION_METHOD(resourceMethod, parentResource), e);
}
}
use of com.sun.research.ws.wadl.Request in project jersey by jersey.
the class WadlBuilder method generateRequest.
private Request generateRequest(org.glassfish.jersey.server.model.Resource parentResource, final org.glassfish.jersey.server.model.ResourceMethod resourceMethod, Map<String, Param> wadlResourceParams) {
try {
final List<Parameter> requestParams = new LinkedList<>(resourceMethod.getInvocable().getParameters());
// Adding handler instance parameters to the list of potential request parameters.
requestParams.addAll(resourceMethod.getInvocable().getHandler().getParameters());
if (requestParams.isEmpty()) {
return null;
}
Request wadlRequest = _wadlGenerator.createRequest(parentResource, resourceMethod);
processRequestParameters(parentResource, resourceMethod, wadlResourceParams, requestParams, wadlRequest);
if (wadlRequest.getRepresentation().size() + wadlRequest.getParam().size() == 0) {
return null;
} else {
return wadlRequest;
}
} catch (Exception e) {
throw new ProcessingException(LocalizationMessages.ERROR_WADL_BUILDER_GENERATION_REQUEST(resourceMethod, parentResource), e);
}
}
Aggregations