Call REST GET Service from JSP

痴心易碎 提交于 2019-12-04 09:49:41

In order to call REST from JSP, you could utilize Apache HTTPClient. Once you have that you could walk through the samples as well as the HTTPClient Tutorial. HTTPClient supports all REST API Call including GET/POST and others.

Check also this following HTTPClient template to see how HTTPClient can be used with REST. You need to call a similar code from your JSP.

In particular to REST GET Service, you want to look the following block from the template in the above link


final HttpClient httpClient = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(httpClient.getParams(), 10000);
HttpGet httpget = new HttpGet(SERVER_URL + url);
HttpResponse response = httpClient.execute(httpget);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!