设为首页 加入收藏

TOP

Java实现OpenLayers跨域代理程序(三)
2014-11-24 01:43:04 来源: 作者: 【 】 浏览:5
Tags:Java 实现 OpenLayers 代理 程序
l){
connection.setRequestProperty("Authorization", request.getHeader("Authorization"));
}
if(request.getHeader("Connection") != null){
//TODO HTTP/1.1 proxies MUST parse the Connection header field before a message is forwarded and, for each connection-token in this field, remove any header field(s) from the message with the same name as the connection-token.
//connection.setRequestProperty("Connection", request.getHeader("Connection"));
}


//set de-facto standard proxy headers (x-forwarded-for, others s)
if(request.getHeader("X-Forwarded-For") != null){
connection.setRequestProperty("X-Forwarded-For", request.getHeader("X-Forwarded-For"));//TODO append IP proxy
} else{
connection.setRequestProperty("X-Forwarded-For", request.getRemoteAddr());//TODO append IP proxy
}
}


private void transferHTTPRequestHeadersForPOST(HttpURLConnection connection, HttpServletRequest request){
if(request.getHeader("Content-Type") != null){
connection.setRequestProperty( "Content-Type",request.getContentType());
} else {
//throw exception
}
}


private boolean isAllowedHost(String remoteHost){
//TODO checking of host
return true;
}
}


没有细看,仅供参考,貌似网上第二段用得多些。


首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇OpenLayer加载WFS图层及C#编写ASP.. 下一篇Android 应用开发者必看的 9 个 T..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: