我正在关注Google App Engine Guestbook示例,以在src文件夹中创建一个新的servlet.当创建servlet对话框打开时,我发现我无法选择或键入"Web项目",也无法浏览以选择"源文件夹".
eclipse是版本3.5,我安装的jdk是1.6.0_14-b08
我正在使用SP3的Windows XP Pro.
在我尝试创建新的servlet之前,我可以编译并启动服务器,在访问http:// localhost:8080之后,示例应用程序正常工作.
请指教.谢谢.
我的asp.net应用程序将httpwebrequest发送到远程REST服务器并等待响应,我发现有很多相同的错误消息,如下所示:
System.Net.WebException:操作已超时.在System.Net.HttpWebRequest.GetResponse()
在我捕获此异常并直接关闭底层http连接后,这可能吗?或者我真的不必这样做,因为我已经将keepalive设置为false?
谢谢.
实际上另一个问题是,如果超时异常总是发生在System.Net.HttpWebRequest.GetResponse(),那意味着应用程序正在等待来自远程服务器的响应,并且在超时之前无法获得响应.可能的原因是什么,网络连接不稳定?远程服务器无响应?任何其他可能的原因?
这是代码:
System.Net.HttpWebResponse httpWebResponse = null;
System.IO.Stream stream = null;
XmlTextReader xmlTextReader = null;
try
{
System.Net.HttpWebRequest httpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(request);
httpWebRequest.ReadWriteTimeout = 10000;
httpWebRequest.Timeout = 10000;
httpWebRequest.KeepAlive = false;
httpWebRequest.Method = "GET";
httpWebResponse = (System.Net.HttpWebResponse)httpWebRequest.GetResponse();
stream = httpWebResponse.GetResponseStream();
xmlTextReader = new XmlTextReader(stream);
xmlTextReader.Read();
xmlDocument.Load(xmlTextReader);
//Document processing code.
//...
}
catch
{
//Catch blcok with error handle
}
finally
{
if (xmlTextReader != null)
xmlTextReader.Close();
if (httpWebResponse != null)
httpWebResponse.Close();
if (stream != null)
stream.Close(); …Run Code Online (Sandbox Code Playgroud)