bsh for android : URL Connect Test
2014-04-04 22:56
363 查看
beanshell : URLConnectTest.bsh
参考: Core Java 2 Volume II ( 7th Edition) v2ch3
source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh"); a = Android(); urlName = a.call("dialogGetInput","Connect Test","Input URL:").get("result"); print(urlName); try { URL url = new URL("http://"+ urlName); URLConnection conn = url.openConnection(); conn.connect(); Scanner in = new Scanner(conn.getInputStream()); Map headers = conn.getHeaderFields(); for (Map.Entry entry : headers.entrySet()){ String key = entry.getKey(); for (String value : entry.getValue()) print(key +": "+ value); } for (int n=1; in.hasNextLine() && n <=5; n++) print(in.nextLine()); if (in.hasNextLine()) print("..."); } catch(e){ print(e); }
参考: Core Java 2 Volume II ( 7th Edition) v2ch3
相关文章推荐
- Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306/test'
- bsh for android : Inet 地址 Test
- bsh for android : Socket Test
- 解决Cannot create JDBC driver of class '' for connect URL 'null'
- CTSFail解决办法 android.webkit.cts.WebSettingsTesttestUserAgentString_default 和libcore.java.net.URLfail
- 关于 Cannot create JDBC driver of class '' for connect URL 'null' 的异常
- 使用TOMCAT5.5连接池连接mysql(解决Cannot create JDBC driver of class '' for connect URL 'null' 及can not load org.gjt.mm.mysql.Driver)
- Cannot create JDBC driver of class '' for connect URL 'null'
- SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 解决办法
- Cannot create JDBC driver of class '' for connect URL 'null'解决方法2——对我有效
- bsh for android : 传感器
- IBatis配置tomcat的JNDI问题解决Cannot create JDBC driver of class '' for connect URL 'null'
- 在 Cordova/Phonegap for Android 中编写 URL 过滤器
- 现在的连接url:Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?useUnico
- Error:Execution failed for task ':app:prepare Debug Android Test Dependencies'.Dependency Error. See
- Cannot create JDBC driver of class '' for connect URL 'null'
- No instrumentation runner found for the launch, using android.test.
- 解决:Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list.xml, reason: connect
- Cannot create JDBC driver of class '' for connect URL 'null'
- Cannot create JDBC driver of class '' for connect URL 'null' 引发的血案