A server initiaited redirect will be followed automatically by httpClient. In a client side redirect, you read the html and find the redirection url in one of the meta tags.
On Oct 24, 9:15 pm, Brian <[EMAIL PROTECTED]> wrote: > I'm REALLY sorry for the triplicate submission, but it was looking > like there was something wrong with the groups site; after the 2nd > post from the groups site didn't appear for awhile, I sent one from > gmail; I finally saw it here in the discussions 20 mins after the last > post. > > I would very much appreciate any help on the original issue with > HttpClient. Thanks > > On Oct 24, 2:18 pm, Brian <[EMAIL PROTECTED]> wrote: > > > I've got a basic connection and request/response working with > > HttpClient. But it appears to be redirecting, and I need that > > redirected url because I need to post to it. Where/how can I get that > > with the org.apache.http.foo classes? I've been digging around in the > > docs for awhile and can't find it. I thought there was a location > > header or response url header, but I've logged the headers and the url > > isn't there either. > > > For example, I'm doing my first request tohttp://myservice.comand > > it's responding > > withhttp://myservice.com/(S(jaaxb545nlp3p455mfcz2qbm))/index.aspx. > > > Here's my code: > > > HttpClient client = new DefaultHttpClient(); > > HttpGet getMethod = new HttpGet("http://myservice.com"); > > try { > > HttpResponse response = client.execute(getMethod); > > String res = > > EntityUtils.toString(response.getEntity()); > > String viewState = extractParm(res, "__VIEWSTATE"); > > log(viewState); > > > Header[] headers = response.getAllHeaders(); > > for(Header header : headers) { > > log(header.getName() + " : " + > > header.getValue()); > > } > > > List<NameValuePair> pairs = new > > ArrayList<NameValuePair>(); > > pairs.add(new BasicNameValuePair("__VIEWSTATE", > > viewState)); > > } catch (Exception e) { > > e.printStackTrace(); > > log(e.getMessage()); > > } > > > Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

