当使用spring mvc 的restful架构后,apache+resin的配置问题

1 篇文章 0 订阅
1 篇文章 0 订阅

 

下面长话短说

技术架构:

Spring MVC(RESTFul)+Spring+JPA(Hibernate)

应用软件

Apache+Resin+Window/Linux+MySQL/SqlServer/Oracle/DB2

 

传统的apache+resin配置(官方教程),apache能够处理静态内容,resin处理jsp、servlet内容

但由于使用RESTFul架构后,大部分的Controller访问地址都无后续名,导致resin不去解析,传统配置无效

(PS:Tomcat 的AJP模块支持排除响应方式,因此无这个问题)

因此,这对这种环境和需求,可以参考下面的配置,通过反向代理形式实现:

 

 

#resin配置

#LoadModule caucho_module C:/resin3.1/win32/apache-2.2/mod_caucho.dll

#ResinConfigServer localhost 6800

#CauchoConfigCacheDirectory /tmp

#CauchoStatus yes

 

#<Location /caucho-status>

  #SetHandler caucho-status

#</Location>

 

#

#由于apache+resin的旧配置,无法处理restfull的应用

#因此,当需要使用apache+resin,同时也要全网支持restfull,暂时只能使用反响代理模式

#

 

 

<VirtualHost *:80>

    ServerAdmin webmaster@dummy-host2.localhost

    DocumentRoot "C:/www/cms"

    ServerName localhost

    ErrorLog "logs/dummy-host2.localhost-error.log"

    CustomLog "logs/dummy-host2.localhost-access.log" common

 

    ProxyPreserveHost On

 

    ProxyPassMatch ^(/.*\.htm)$ !

    ProxyPassMatch ^(/.*\.html)$ !

    ProxyPassMatch ^(/.*\.shtml)$ !

    ProxyPassMatch ^(/.*\.css)$ !

    ProxyPassMatch ^(/.*\.js)$ !

    ProxyPassMatch ^(/.*\.gif)$ !

    ProxyPassMatch ^(/.*\.jpg)$ !

    ProxyPassMatch ^(/.*\.jpeg)$ !

    ProxyPassMatch ^(/.*\.png)$ !

 

    ProxyPass /  http://localhost:8080/ 

    ProxyPassReverse / http://localhost:8080/

 

    #<Proxy *>

#Order Deny,Allow

#Allow from all

    #</Proxy>

 

    <Directory "C:/www/cms">

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from all

    </Directory>

</VirtualHost>

 

 

但用过apache反向代理的人都知道,它也会带来其它问题,如ip获取、路径获取、域名等。

这些都需要开发人员去对应。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值