闲着没事Hessian开发WebService的总结(二)
在Spring和Hessian整合中,以前整合直接在客户端使用代理访问Spring和Hessian整合的远程访问调用,没有问题,最近没事,直接采用地址栏输入地址,常见的一个问题,Hessian仅仅支持Post请求。
在客户端访问源代码:
http://topmanopensource.iteye.com/blog/350108
请参看:
Spring中HessianServiceExporter 类源代码如下:
public class HessianServiceExporter extends HessianExporter implements HttpRequestHandler {
/**
* Processes the incoming Hessian request and creates a Hessian response.
*/
public void handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if (!"POST".equals(request.getMethod())) {
throw new HttpRequestMethodNotSupportedException(request.getMethod(),
new String[] {"POST"}, "HessianServiceExporter only supports POST requests");
}
try {
invoke(request.getInputStream(), response.getOutputStream());
}
catch (Throwable ex) {
throw new NestedServletException("Hessian skeleton invocation failed", ex);
}
}
}
由上可以看出仅仅支持HTTP中的POST协议。
备注:在java web开发中,http的常用的请求方式有两种HTTP POST,HTTPGET ,默认的GET,但是在地址栏中输入http地址实质就是get请求方式。所以不支持!