如何在项目启动时调用servlet dopost方法

时间:2015-05-21 08:20:43

标签: servlets

示例代码如下所示:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("Inside Post");
Client client =Client.create(); 
WebResource webResource=client.resource("https://mondelezinternational-test.coupahost.com/api/invoices/");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
ClientResponse resp=webResource.queryParams(queryParams).header("X-COUPA-API-KEY","53fb46e5bb0dbe7fc338f22e2d5035e52cc302fa").header("Accept","application/xml").post(ClientResponse.class);
System.out.println("Responce Body"+resp.getStatusInfo());
System.out.println("Responce Body"+resp.getStatus());
System.out.println("Responce Body"+resp.getLanguage());
System.out.println("Responce Body"+resp.getHeaders());

if (resp.getStatus()==200)

0 个答案:

没有答案