コード例 #1
0
    @Override
    public Response apply(ContainerRequestContext containerRequestContext) {
      Set<String> allowedMethods =
          ModelProcessorUtil.getAllowedMethods(extendedUriInfo.getMatchedRuntimeResources().get(0));

      final String allowedList = allowedMethods.toString();
      final String optionsBody = allowedList.substring(1, allowedList.length() - 1);

      return Response.ok(optionsBody, MediaType.TEXT_PLAIN_TYPE).allow(allowedMethods).build();
    }
コード例 #2
0
 @Override
 public Response apply(ContainerRequestContext containerRequestContext) {
   final Set<String> allowedMethods =
       ModelProcessorUtil.getAllowedMethods(
           (extendedUriInfo.getMatchedRuntimeResources().get(0)));
   return Response.ok()
       .allow(allowedMethods)
       .header(HttpHeaders.CONTENT_LENGTH, "0")
       .type(containerRequestContext.getAcceptableMediaTypes().get(0))
       .build();
 }