Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > Java > weblogic for apache插件,weblogic内应用程序获取用户的ip
【标  题】:weblogic for apache插件,weblogic内应用程序获取用户的ip
【关键字】:weblogic,for,apache,weblogic
【来  源】:http://blog.csdn.net/woowindice/archive/2007/04/13/1563889.aspx

weblogic for apache插件,weblogic内应用程序获取用户的ip

Your Ad Here
在apache+Weblogic整合系统中,apache会对request对象进行再包装,附加一些WLS要用的头信息。这种情况下,直接用request.getRemoteAddr()是无法取到真正的客户IP的。
apache会增加下列头信息:
X-Forwarded-For=211.161.1.239
WL-Proxy-Client-IP=211.161.1.239

所取得客户的IP需要这样:
    String ip=request.getHeader("X-Forwarded-For");
    if(ip == null || ip.length() == 0) {
        ip=request.getHeader("WL-Proxy-Client-IP");
    }
    if(ip == null || ip.length() == 0) {
        ip=request.getRemoteAddr();
    }
 
或者也可通过weblogic的设置直接能过request.getRemoteAddr();取得客户的IP。
在weblogic console
domain->servers->servername->General ->Advanced Options ->
  WebLogic Plug-In Enabled

Specifies whether this server uses the proprietary WL-Proxy-Client-IP header. (This is needed only when WebLogic plugins are configured.)
但是如果apache设置的是反向代理这样就不行了,因为apache不会向heaer写入WL-Proxy-Client-IP的信息。只能通过第一种方法解决。
JS实现进度条,抄袭于ZK ajax框架.:【上一篇】
netBeans 中的自定义代码的书写位置:【下一篇】
【相关文章】
  • ActiveReport for net WebViewer 设置zoom
  • WinForm属性查看工具
  • Delphi for PHP的试用
  • apache与tomcat整合
  • mysql for linux傻瓜式安装 step by step
  • 在for循环里对std::map进行元素移除
  • Facade forward
  • 解决正版DB2ESE for aix为试用版问题
  • Solaris ABC for Linux/UnixDevelopers(II)
  • weblogic pool train
  • 【随机文章】
  • Unix的两个命令
  • Emacs常用命令速查(转载)
  • RPL疑难解答
  • Director MX 2004教程--Director的工作界面
  • 用Factory Method模式扩展MyMSDNTVLibrary
  • 初级黑客安全技术命令详解(二)
  • 创建rman恢复目录
  • ODE v0.5 用户指南
  • WWW-Browsers for Linux
  • scp 用法
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.