在后台写了一部分代码,用来实现跨域,下面是主要代码
HttpClient httpclient2=new HttpClient();//创建一个客户端,类似打开一个浏览器
HttpMethod getMethod=new GetMethod(url);//创建一个get方法,类似在浏览器地址栏中输入一个地址
int statusCode=httpclient2.executeMethod(getMethod);//执行方法,类似于点击回车键!
int state = getMethod.getStatusCode();//得到请求的状态,200表示成功
String reVal = getMethod.getResponseBodyAsString();//得到请求的返回内容
getMethod.releaseConnection();//释放连接
System.out.println(statusCode);
System.out.println(state);
System.out.println(reVal);
输出的3个结果是这样的:
500
500
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>CAS – Central Authentication Service</title>
<link type="text/css" rel="stylesheet" href="/cas/css/cas.css;jsessionid=DB5E79A6B5606598BEB7F6253967882C" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="icon" href="/cas/favicon.ico;jsessionid=DB5E79A6B5606598BEB7F6253967882C" type="image/x-icon" />
</head>
<body id="cas" class="fl-theme-iphone">
<div class="flc-screenNavigator-view-container">
<div class="fl-screenNavigator-view">
<div id="header" class="flc-screenNavigator-navbar fl-navbar fl-table">
<h1 id="company-name">Jasig</h1>
<h1 id="app-name" class="fl-table-cell">Central Authentication Service (CAS)</h1>
</div>
<div id="content" class="fl-screenNavigator-scroll-container">
<div id="welcome">
<h2>CAS is Unavailable</h2>
<p>
There was an error trying to complete your request. Please notify your support desk or try again.
</p>
</div>
</div>
<div id="footer" class="fl-panel fl-note fl-bevel-white fl-font-size-80">
<a id="jasig" href="http://www.jasig.org" title="go to Jasig home page"></a>
<div id="copyright">
<p>Copyright © 2005 - 2012 Jasig, Inc. All rights reserved.</p>
<p>Powered by <a href="http://www.jasig.org/cas">Jasig Central Authentication Service 3.5.2</a></p>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
<script type="text/javascript" src="/cas/js/cas.js;jsessionid=DB5E79A6B5606598BEB7F6253967882C"></script>
</body>
</html>
请问这是个什么情况?