I created a webservice successfully tested on glassfish within netbeans , which uses POST and give back results as follows:
@Path("caas")
public class Cribservice {
@Context
private UriInfo context;
public Cribservice() {
TimeZone theTz = TimeZone.getTimeZone("UTC");
}
@POST
@Path("/post")
@Consumes(MediaType.TEXT_PLAIN)
public void setJson(String p) {
String x = p;
System.out.println(x);
run(x);
}
@POST
@Path("/postid")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
public String halloween(String p){
int sizy;
return some string;
}
}
I dont have any web.xml but using ApplicationConfig.java
@javax.ws.rs.ApplicationPath("webresources")
public class ApplicationConfig extends Application {
public Set<Class<?>> getClasses() {
return getRestResourceClasses();
}
/**
* Do not modify this method. It is automatically generated by NetBeans REST support.
*/
private Set<Class<?>> getRestResourceClasses() {
Set<Class<?>> resources = new java.util.HashSet<Class<?>>();
resources.add(cribservice.Cribservice.class);
return resources;
}
}
I tried to deploy this app on jetty on localmachine out of netbeans , but i am not able to access my services , all i am able to see is helloworld on local browser when i access localhost:8080/caas