loty wrote:
> Have a weird problem - I'm trying to read a page from my web site but
> for some reason it just can't find it. I can navigate to my page in a
> browser no problem but if I use the same URL in HttpClient I get the
> 404 (File not found) from my host service. Any clues?
>
> Here is the code I use - seems pretty straightforward
>
> HttpClient client = new DefaultHttpClient();
> HttpGet getMethod = new HttpGet(strURL);
> try {
> HttpResponse response = client.execute(getMethod);
> Log.d(LOG_TAG, "Response Code " + Integer.toString
> (response.getStatusLine().getStatusCode()));
> if(response.getStatusLine().getStatusCode()==404)
> {
> Log.d(LOG_TAG, "WTF - 404");
> return;
> }
>
> String res = EntityUtils.toString(response.getEntity());
> Log.d(LOG_TAG, res);
Can you request other pages, from other services, other than the one
you're trying? In other words, is your problem unique to your host
service, or is it a problem for all pages you try requesting?
Assuming the problem is unique to your host service...
Is the request of a static page or something generated by some
server-side process? If the latter, is the process expecting other
behavior (e.g., session cookie from a successful login) and is failing
with a 404 instead of a 500 or something?
--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.4 Published!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---