0
I am creating a webservice Rest, and it is working properly, but there is a situation that I could not handle: if the provided url is searching for a non-existent method, the requester is redirected to my system’s error screen, I would like to display a customized message. Follows description:
url1 (valid): https://127.0.0.1/system/Ws/example/query 1? param1=test 1¶m2=test 2
url (invalid): https://127.0.0.1/system/Ws/example/query 2
I would like the system to display a custom message when receiving a different url than url1, rather than redirecting to the page screen not found. However, how should I create a method to intercept and validate the url, and the given path does not exist in my class?
@Path("/ws/exemplo")
public class exemploResource {
//único método implementado atualmente
@GET()
@Produces("text/plain")
@Path("consulta1")
public String consulta1(@QueryParam("param1") final String param1,
@QueryParam("param2") final String param2,
final @Context HttpServletRequest request) {
...
}