public BuiltResponse invoke(HttpRequest request, HttpResponse response, Object target) { request.setAttribute(ResourceMethod.class.getName(), this); incrementMethodCount(request.getHttpMethod()); ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri(); uriInfo.pushCurrentResource(target); try { BuiltResponse jaxrsResponse = invokeOnTarget(request, response, target); if (jaxrsResponse != null && jaxrsResponse.getEntity() != null) { // if the content type isn't set, then set it to be either most desired type from the Accept // header // or the first media type in the @Produces annotation // See RESTEASY-144 Object type = jaxrsResponse.getMetadata().getFirst(HttpHeaderNames.CONTENT_TYPE); if (type == null) jaxrsResponse .getMetadata() .putSingle( HttpHeaderNames.CONTENT_TYPE, resolveContentType(request, jaxrsResponse.getEntity())); } return jaxrsResponse; } finally { uriInfo.popCurrentResource(); } }
public BuiltResponse invoke(HttpRequest request, HttpResponse response, Object target) { request.setAttribute(ResourceMethodInvoker.class.getName(), this); incrementMethodCount(request.getHttpMethod()); ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri(); if (method.getPath() != null) { uriInfo.pushMatchedURI(uriInfo.getMatchingPath()); } uriInfo.pushCurrentResource(target); BuiltResponse rtn = invokeOnTarget(request, response, target); return rtn; }