后台服务器什么技术搭建 使用http协议,服务器采用tomcat servlet 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 后台就是j2ee,比如ssh架构,通过json格式来传送数据 /** * 根据url获得页面源码 * @param url 访问地址, 必备参数 * @param method 请求方式post还是get, 默认get * @param params 参数列表 post必备, 比如:"name=张三&age=18" * @param sessionInfo 可以保持session, 默认不保持 * @param encoding 编码格式, 默认UTF_8 * @param isLine 得到的源码是否换行, 默认false * @return */ public String sound(String url, String method, String params, String sessionInfo, String encoding, boolean isLine) throws Exception { encoding = (isBlank(encoding) ? HTTP.UTF_8 : encoding); method = (isBlank(method) ? Domain.REQUEST_GET : method.toUpperCase()); String mathStr = "mathRandom=" + Math.random(); if (method.equals(Domain.REQUEST_GET)) {url += (url.indexOf("?") != -1 ? "&" : "?") + mathStr;} HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); if (!isBlank(sessionInfo)) {conn.setRequestProperty("Cookie", sessionInfo);} conn.setRequestMethod(method); if (requestTime > 0) { conn.setConnectTimeout(requestTime); conn.setReadTimeout(requestTime); } if (method.equals(Domain.REQUEST_POST)) { conn.setDoOutput(true); OutputStream output = conn.getOutputStream(); output.write((isBlank(params) ? mathStr : params + "&" + mathStr).getBytes(encoding)); output.flush();output.close(); } String response = FileUtil.get().readFile(conn.getInputStream(), encoding, 1, isLine); conn.disconnect(); requestTime = Domain.LONG_REQUEST_TIME; return response; } 一般的网络协议,应用层http服务器环境:tomcat + mysql即可(java +servlet) ----希望联系我: [email protected] 你要做什么类型的android app 服务器就是一个一般的网站服务器就可以了,就是配置一个IIS网站就行啦 我觉得后台服务器还是用php加c扩展或者c++扩展为好。。用java感觉太过繁琐。 android下函数使用问题 一个有关Content Provider的问题 Bluetooth 数据接收存储到SD卡,数据为什么会丢失?求解 情何以堪呐 继承activity的类如何调用继承ListActivity? 如何得到sdcard中的所用图片 静默安装,求大神指点! ZXing中的MultiFormatReader支不支持解析PDF417? 大神们围观了,使用xUtils框架的ViewUtils模块后,混淆出现的问题 testActivity不能相应LifecycleOwner 怎么等待一个线程结束?希望等待的过程中界面不能卡死.. android如何将一个网页上的表格显示在手机上
* 根据url获得页面源码
* @param url 访问地址, 必备参数
* @param method 请求方式post还是get, 默认get
* @param params 参数列表 post必备, 比如:"name=张三&age=18"
* @param sessionInfo 可以保持session, 默认不保持
* @param encoding 编码格式, 默认UTF_8
* @param isLine 得到的源码是否换行, 默认false
* @return
*/
public String sound(String url, String method, String params, String sessionInfo, String encoding, boolean isLine) throws Exception {
encoding = (isBlank(encoding) ? HTTP.UTF_8 : encoding);
method = (isBlank(method) ? Domain.REQUEST_GET : method.toUpperCase());
String mathStr = "mathRandom=" + Math.random();
if (method.equals(Domain.REQUEST_GET)) {url += (url.indexOf("?") != -1 ? "&" : "?") + mathStr;}
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
if (!isBlank(sessionInfo)) {conn.setRequestProperty("Cookie", sessionInfo);}
conn.setRequestMethod(method);
if (requestTime > 0) {
conn.setConnectTimeout(requestTime);
conn.setReadTimeout(requestTime);
}
if (method.equals(Domain.REQUEST_POST)) {
conn.setDoOutput(true);
OutputStream output = conn.getOutputStream();
output.write((isBlank(params) ? mathStr : params + "&" + mathStr).getBytes(encoding));
output.flush();output.close();
}
String response = FileUtil.get().readFile(conn.getInputStream(), encoding, 1, isLine);
conn.disconnect();
requestTime = Domain.LONG_REQUEST_TIME;
return response;
}
用java感觉太过繁琐。