0
的我創建的NetBeans內GlassFish上成功地測試一個Web服務,它使用POST和回饋結果如下:如何部署的NetBeans在碼頭.WAR出來的NetBeans
@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;
}
}
我沒有任何的web.xml但使用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;
}
}
我試圖在LOCALMACHINE在碼頭部署這個應用程序的NetBeans出來, 的,但我不能訪問我的服務,所有我能夠看到的是 當我訪問localhost時,在本地瀏覽器上的helloworld:8080/caas