Stephen is there a way to issue a GET without bringing back the actual HTML
content? My main goal is just to get the final URL of what the link is and
bringing back all the content will slow things down quite a bit.




On Wed, Sep 8, 2010 at 12:18 PM, Stephen J. Butler <[email protected]
> wrote:

> On Wed, Sep 8, 2010 at 1:42 PM, Jim <[email protected]> wrote:
> > HttpHead httpget = null;
> > HttpHost target = null;
> > HttpUriRequest req = null;
> >
> > String startURL = "
> >
> http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNGrJk-F7Dmshmtze2yhifxRsv8sRg&url=http://www.mtv.com/news/articles/1647243/20100907/story.jhtml
> > ";
> > HttpContext localContext = new BasicHttpContext();
> >
> localContext.setAttribute(ClientContext.COOKIE_STORE,HttpClientFetcher.emptyCookieStore);
> > httpget = new HttpHead(startURL);
>
> There's your problem. Google doesn't respond to HEAD the same way as GET:
>
> $ nc news.google.com 80
> HEAD /news/url?sa=t&fd=R&usg=AFQjCNGrJk-F7Dmshmtze2yhifxRsv8sRg&url=
> http://www.mtv.com/news/articles/1647243/20100907/story.jhtml
> HTTP/1.1
> Host: news.google.com
>
> HTTP/1.1 200 OK
> Content-Type: text/html; charset=ISO-8859-1
> Set-Cookie:
> PREF=ID=c0dc77b54e3366b4:TM=1283973424:LM=1283973424:S=5gVyGhbFXF9WJ_WY;
> expires=Fri, 07-Sep-2012 19:17:04 GMT; path=/; domain=.google.com
> X-Content-Type-Options: nosniff
> Date: Wed, 08 Sep 2010 19:17:04 GMT
> Server: NFE/1.0
> Content-Length: 0
> X-XSS-Protection: 1; mode=block
> Expires: Wed, 08 Sep 2010 19:17:04 GMT
> Cache-Control: private
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to