任何人都可以告訴我如何從簡單終端客戶端調用發佈請求嗎?來自簡單終端客戶端的澤西POST請求
@POST
@Path("insertt")
public void insert(@QueryParam("id") Integer id,
@QueryParam("name") String name,
@QueryParam("lastname") String lastname,
@QueryParam("adress") String adress,
@QueryParam("city") String city) {
Customer cust = new Customer();
cust.setCustomerId(id);
cust.setName(name);
cust.setLastNAme(lastname);
cust.setAddressline1(adress);
cust.setCity(city);
customerDAO.add(cust);
}
在客戶端我做的:
Client c = ClientBuilder.newClient();
WebTarget resource = c.target("http://localhost:8080/WebService/webresources/generic/insertt?id=100&name=test&lastname=test&adress=test&city=test");
//resource.request().post(); // This does not work
測試,什麼不起作用?你看到哪個例外? –
你嘗試過curl命令嗎? –
@MaximDobryakov我沒有看到任何異常,我只是不知道如何發送來自客戶端的請求。我有網址和資源,但是如何從客戶端發送請求? – kvway