1
I am new to web services, however lately I have taken to develop mine, however I can’t even do a hello world due to an error that Tomcat is returning me, it just doesn’t find the URL, can help me?
package Login;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PUT;
import javax.ws.rs.core.MediaType;
/**
* REST Web Service
*
* @author Matheus
*/
@Path("/Teste")
public class Teste {
@Context
private UriInfo context;
/**
* Creates a new instance of Teste
*/
public Teste() {
}
/**
* Retrieves representation of an instance of Login.Teste
* @return an instance of java.lang.String
*/
@GET
@Produces("text/plain")
public String getText() {
//TODO return proper representation object
return "ola";
}
/**
* PUT method for updating or creating an instance of Teste
* @param content representation for the resource
*/
@PUT
@Consumes(MediaType.TEXT_PLAIN)
public void putText(String content) {
}
}
The home URL is http://localhost:8080/Project, this page is easily found, however when I access the URL http://localhost:8080/Project/Test which is to return a "hello" it simply returns a 404 error from page not found.
You need to give much more details so that someone understands your problem. I suggest reading the help sections: How to Ask a Question and How to create a Minimum, Complete and Verifiable example
– mari