而在网络服务器上http://www.xxxfjjsp01.com/quality/mobile/getCustomer 发送同样的请求返回的数据就是的错误呢?(Tomcat404错误,但是Tomcat日志什么也没有,The requested resource is not available!)
3 个解决方案
#1
网络地址http://www.xxxfjjsp01.com/quality/mobile/getCustomer需要指明端口号8080么?
#2
不需要啊! 服务器地址,其他功能可以啊,我这个需求就是手机注册功能注册成功返回注册信息,其中有写内容是系统给的!
局域网测试可以,但是相同的代码放到服务器上面就会报404错误
HttpClient httpClient = new DefaultHttpClient(httpParams);
// 发送请求
HttpResponse response = httpClient.execute(httpPost);
Toast.makeText(getApplicationContext(), "注册成功", 0).show();
// 显示响应
showResponseResult(response);
private void showResponseResult(HttpResponse response){
if (null == response){
return;
}
HttpEntity httpEntity = response.getEntity();
try {
InputStream inputStream = httpEntity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(
inputStream));
String result = "";
String line = "";
while (null != (line = reader.readLine())){
result += line;
}
Toast.makeText(getApplicationContext(), result.toString(), 1).show();
}
catch (Exception e) {
e.printStackTrace();
}
}
局域网测试可以,但是相同的代码放到服务器上面就会报404错误
HttpClient httpClient = new DefaultHttpClient(httpParams);
// 发送请求
HttpResponse response = httpClient.execute(httpPost);
Toast.makeText(getApplicationContext(), "注册成功", 0).show();
// 显示响应
showResponseResult(response);
private void showResponseResult(HttpResponse response){
if (null == response){
return;
}
HttpEntity httpEntity = response.getEntity();
try {
InputStream inputStream = httpEntity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(
inputStream));
String result = "";
String line = "";
while (null != (line = reader.readLine())){
result += line;
}
Toast.makeText(getApplicationContext(), result.toString(), 1).show();
}
catch (Exception e) {
e.printStackTrace();
}
}
#3
服务器就返回一个数字!
response.getWriter().write("140702");
放到网络服务器上,注册可以成功就是返回的时候返回的是网页代码404的错误
response.getWriter().write("140702");
放到网络服务器上,注册可以成功就是返回的时候返回的是网页代码404的错误
#1
网络地址http://www.xxxfjjsp01.com/quality/mobile/getCustomer需要指明端口号8080么?
#2
不需要啊! 服务器地址,其他功能可以啊,我这个需求就是手机注册功能注册成功返回注册信息,其中有写内容是系统给的!
局域网测试可以,但是相同的代码放到服务器上面就会报404错误
HttpClient httpClient = new DefaultHttpClient(httpParams);
// 发送请求
HttpResponse response = httpClient.execute(httpPost);
Toast.makeText(getApplicationContext(), "注册成功", 0).show();
// 显示响应
showResponseResult(response);
private void showResponseResult(HttpResponse response){
if (null == response){
return;
}
HttpEntity httpEntity = response.getEntity();
try {
InputStream inputStream = httpEntity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(
inputStream));
String result = "";
String line = "";
while (null != (line = reader.readLine())){
result += line;
}
Toast.makeText(getApplicationContext(), result.toString(), 1).show();
}
catch (Exception e) {
e.printStackTrace();
}
}
局域网测试可以,但是相同的代码放到服务器上面就会报404错误
HttpClient httpClient = new DefaultHttpClient(httpParams);
// 发送请求
HttpResponse response = httpClient.execute(httpPost);
Toast.makeText(getApplicationContext(), "注册成功", 0).show();
// 显示响应
showResponseResult(response);
private void showResponseResult(HttpResponse response){
if (null == response){
return;
}
HttpEntity httpEntity = response.getEntity();
try {
InputStream inputStream = httpEntity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(
inputStream));
String result = "";
String line = "";
while (null != (line = reader.readLine())){
result += line;
}
Toast.makeText(getApplicationContext(), result.toString(), 1).show();
}
catch (Exception e) {
e.printStackTrace();
}
}
#3
服务器就返回一个数字!
response.getWriter().write("140702");
放到网络服务器上,注册可以成功就是返回的时候返回的是网页代码404的错误
response.getWriter().write("140702");
放到网络服务器上,注册可以成功就是返回的时候返回的是网页代码404的错误