开发者

How to connect servlet

开发者 https://www.devze.com 2023-02-09 14:42 出处:网络
I am doing client server process. I dont know how to connect with Servlet . In servlet i have JDBC that collects data from oracle. I want to connect servlet and to show all the details from oracle dat

I am doing client server process. I dont know how to connect with Servlet . In servlet i have JDBC that collects data from oracle. I want to connect servlet and to show all the details from oracle datab开发者_StackOverflow中文版ase in android.


Android offers the HttpClient API to fire and handle HTTP requests. There are several snippets on androidsnippets.org. Here's an example of firing a HTTP GET request:

public static InputStream getInputStreamFromUrl(String url) {  
  InputStream content = null;  
  try {  
    HttpClient httpclient = new DefaultHttpClient();  
    HttpResponse response = httpclient.execute(new HttpGet(url));  
    content = response.getEntity().getContent();  
  } catch (Exception e) {  
    Log.("[GET REQUEST]", "Network exception", e);  
  }  
  return content;  
}   


I did customize this code and using it as generic web service caller class.

you can use this customized version of WebService class -> http://dl.dropbox.com/u/13849473/WebService.java

p.s. the original source is from; http://www.josecgomez.com/2010/04/30/android-accessing-restfull-web-services-using-json/

0

精彩评论

暂无评论...
验证码 换一张
取 消