cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Margulies <bimargul...@gmail.com>
Subject JAX-RS surprise with a 404 response
Date Sun, 13 Jan 2013 02:28:53 GMT
In a JAX-RS method, I returned a response with a 404 status code.

org.apache.cxf.jaxrs.JAXRSInvoker#invoke proceeded to treat this as if
there was a missing subresource, instead of just treating it as the
definitive response.  I quote the code below. I still get a 404, but
not with the payload I asked for, which is sort of unfortunate. Is
there a right way to do this?


        ClassResourceInfo subCri = null;
        if (ori.isSubResourceLocator()) {
            try {
                Message msg = exchange.getInMessage();
                MultivaluedMap<String, String> values = getTemplateValues(msg);
                String subResourcePath =
values.getFirst(URITemplate.FINAL_MATCH_GROUP);
                String httpMethod =
(String)msg.get(Message.HTTP_REQUEST_METHOD);
                String contentType = (String)msg.get(Message.CONTENT_TYPE);
                if (contentType == null) {
                    contentType = "*/*";
                }
                List<MediaType> acceptContentType =

(List<MediaType>)msg.getExchange().get(Message.ACCEPT_CONTENT_TYPE);

                result = checkResultObject(result, subResourcePath);

                subCri = cri.getSubResource(
                     methodToInvoke.getReturnType(),
                     ClassHelper.getRealClass(result));
                if (subCri == null) {
                    org.apache.cxf.common.i18n.Message errorM =
                        new
org.apache.cxf.common.i18n.Message("NO_SUBRESOURCE_FOUND",
                                                               BUNDLE,
                                                               subResourcePath);

Mime
View raw message