I mischaracterized the problem.
@Path("docView")
@Consumes("application/json")
@Produces("application/json")
@GZIP
public class DocumentViewService extends JugServiceWithSession {
private static final Logger LOG =
LoggerFactory.getLogger(DocumentViewService.class);
private QueryService queryService;
public DocumentViewService() {
}
@Path("/{docId}/html")
public Response documentHtml(@PathParam("docId") String docId)
throws Exception {
,,,
}
No matter what my function returns, CXF goes and tries to locate a
subresource, fails, and makes a 404.
I'm sure I'm missing something simple here.
Note that my function *is invoked*, so I'm quite confused about why
CXF is looking for subresources after i it returns.
Hmm, Notice the lack of @GET or the like up there? Adding it fixed
things right up.
On Sat, Jan 12, 2013 at 9:28 PM, Benson Margulies <[email protected]> wrote:
> 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);