我正在做一個測試RESTful
服務,其作用是返回通過URL
轉發的兩個號碼的結果。 我目前正試圖:http://localhost:8080/XMLWSAssignment/AddService/3/5
結合3 + 5。但是,我招呼着GlassFish中一個"404"
錯誤...REST風格的Web服務將不會從URL調用
下面的代碼:
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.PathParam;
@Path("/MyRestService")
public class MyRestClass {
@Path("/AddService/{a}/{b}")
public class AddService {
@GET
public String getMessage(@PathParam("a") Integer a, @PathParam("b") Integer b) {
Integer res = a + b;
return res.toString();
}
}
}
同樣的錯誤發生:( 錯誤:404 –