I am trying to do something like the below using jersey :
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
public class route {
private final Logger logger = LogManager.getLogger(route.class);
private ResourceBundle errMsgs = ResourceBundle.getBundle(Master.ROUTE.getBundleName());
@GET @Path("route/{v_route}")
@Produces(MediaType.TEXT_PLAIN)
public Response response(@PathParam("v_route") String vp_route) {
String[] strings = {vp_route};
if (Misc.isEmptyNull(strings)) {
logger.error(errMsgs.getString("missingRouteID"));
throw new WebException(errMsgs.getString("missingRouteID"));
}
return Response.ok("ok",MediaType.TEXT_PLAIN).build();
}
@POST @Path("route")
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response postResponse(@FormParam("v_auditid") String p_auditid,
@FormParam("v_tenant") String p_tenant){
// removed to keep short
}
However, even a simple cURL get to the basic http://site/WebApi/route/parameter yields the following :
"" - Error report
HTTP Status 404 - Not Found
type Status report
messageNot Found
descriptionThe requested resource is not available.
""
Two important things to note before you rush to answer this question :
- Nothing appears in /opt/glassfish4/glassfish/domains/mydomain/logs/server.log
- Yes I am sure http://site/WebApi is the correct prefix. I have another jersey java class that works perfectly fine under the same prefix !