I would like to pass Double path params like 5, 5.0, 0.5, 3.5, 3.65 etc.
So I make such method on JAX-RS resource:
@GET
@Path("/rated-above/{minAvgRating : \\d+(\\.\\d+)? }")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getProvidersOnAverageRatedAbove( @PathParam("minAvgRating") Double minAvgRating,
@BeanParam PaginationBeanParam params) throws ForbiddenException {
// method
}
But this method seems to doesn't work correctly even without Regex pattern.
Caused by: org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: pl.salonea.jaxrs.utils.ErrorResponseWrapper of media type: application/octet-stream
at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:67)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:153)
UPDATE
Sorry without regex it works correctly there is some problem with regex \d+(\.\d+)? I have been also trying to use: [0-9]+(\.[0-9]+)? and just \S+ (not white space)