问题
I'm getting a 404 on a JAX-RS request, but am running out of things to try out of my bag of tricks.
Simplified code where service is defined:
package mypackage;
@Path("/")
public class SavedQueriesService {
...
@POST
@Path("saved_queries")
@Consumes(MediaType.APPLICATION_JSON)
@Produces({ MediaType.APPLICATION_JSON + AppConstants.COMMA + MediaType.CHARSET_PARAMETER + AppConstants.UTF_8 })
public Response saveNewSavedQuery(@Context HttpServletRequest httpServletRequest,
SavedQueryRequest savedQueryRequest, @QueryParam("saved_query_context_name") String savedQueryContextName,
@QueryParam("saved_query_context_id") Integer savedQueryContextId) {
...
}
}
@ApplicationPath("/report")
class SavedQueriesServiceConfig extends ResourceConfig {
public SavedQueriesServiceConfig() {
register(JacksonFeatures.class);
register(CORSResponseFilter.class);
register(JsonParseExceptionMapper.class);
packages("mypackage");
}
}
URL Request:
URL request:
POST localhost:8090/ROOT/report/saved_queries
Accept-Encoding: application/json
Content-Type: application/json
So I made sure to specify the correct mime type (though I think an incorrect one would generate a 415, not a 404) and I also made sure the HTTP verb is correct.
If only I could get Tomcat to list out somewhere what URI's it actually knows about. Is it possible to get this from an MBean somewhere?
来源:https://stackoverflow.com/questions/64421903/404-on-jax-rs-on-tomcat-mbeans