当前位置: 技术问答>java相关
HTTP头获取?
来源: 互联网 发布时间:2015-09-16
本文导语: HTTP/1.1 302 Object moved Server: Microsoft-IIS/5.0 Date: Tue, 24 Sep 2002 03:26:29 GMT Location: ..%5Cmainmenu.htm Content-Length: 138 Content-Type: text/html Set-Cookie: user%5Fjm=ch; path=/ Set-Cookie: username=%B3%C2%BB%B3; path=/ Set-Cookie: trader=E001002; pat...
HTTP/1.1 302 Object moved
Server: Microsoft-IIS/5.0
Date: Tue, 24 Sep 2002 03:26:29 GMT
Location: ..%5Cmainmenu.htm
Content-Length: 138
Content-Type: text/html
Set-Cookie: user%5Fjm=ch; path=/
Set-Cookie: username=%B3%C2%BB%B3; path=/
Set-Cookie: trader=E001002; path=/
Set-Cookie: role%5Fcode=LTRADER; path=/
Set-Cookie: defpw%5Fsucc=0; path=/
Set-Cookie: ASPSESSIONIDGGGGGXUQ=DEALHBODGNNCIMCLGOIJMJKK; path=/
Cache-control: private
以上为一个从服务器返回的http头,我想获取其中的Set-Cookie的内容,该如何办?
原始问题为:
有一个ASP网站需要登录,我想做一个Java Client直接连接,然后获取网站上的页面内容,如何处理?
Server: Microsoft-IIS/5.0
Date: Tue, 24 Sep 2002 03:26:29 GMT
Location: ..%5Cmainmenu.htm
Content-Length: 138
Content-Type: text/html
Set-Cookie: user%5Fjm=ch; path=/
Set-Cookie: username=%B3%C2%BB%B3; path=/
Set-Cookie: trader=E001002; path=/
Set-Cookie: role%5Fcode=LTRADER; path=/
Set-Cookie: defpw%5Fsucc=0; path=/
Set-Cookie: ASPSESSIONIDGGGGGXUQ=DEALHBODGNNCIMCLGOIJMJKK; path=/
Cache-control: private
以上为一个从服务器返回的http头,我想获取其中的Set-Cookie的内容,该如何办?
原始问题为:
有一个ASP网站需要登录,我想做一个Java Client直接连接,然后获取网站上的页面内容,如何处理?
|
URLConnection.getHeaderField("Set-Cookie")
|
URLConnection.getHeaderField("Set-Cookie")不行吗?
好象应该可以啊!
好象应该可以啊!