servlet下diable http method put&delete

由于通过xsan检测到tomcat服务器存在put&delete method.在通过查找后找到了disable的方法.
以下为tomcat5.5下的代码
package org.apache.catalina.valves;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.apache.catalina.Request;
import org.apache.catalina.Response;
import org.apache.catalina.ValveContext;
import org.apache.catalina.valves.RequestFilterValve;

/***/ /**
*Concreteimplementationof<code>RequestFilterValve</code>thatfilters
*HTTPrequestsbaseduponthestringrepresentationoftherequestmethod.
*
*inserver.xml:<ValveclassName="org.apache.catalina.valves.HttpMethodValve"
*allow="comma-separated-string"deny="comma-separated-string"/>
*
*wherecomma-separated-stringisalistofHTTPmethods(uppercase)separated
*bycommas.
*
*Example:TodisablePUTandDELETEmethodsonastandaloneTomcat5server,
*
*<Engine...><!--or<Host>--><Valve
*className="org.apache.catalina.valves.HttpMethodValve"deny="PUT,DELETE"/>
*</Engine>
*
*
@authorMarkAnderson
*
@version$Revision:1.0$$Date:2004/12/2713:56:21$
*/


public final class HttpMethodValve extends RequestFilterValve ... {

//-----------------------------------------------------InstanceVariables

/***//**
*Thedescriptiveinformationrelatedtothisimplementation.
*/

privatestaticfinalStringinfo="org.apache.catalina.valves.HttpMethodValve/1.0";

//-------------------------------------------------------------Properties

/***//**
*ReturndescriptiveinformationaboutthisValveimplementation.
*/

publicStringgetInfo()...{

return(info);

}


//---------------------------------------------------------PublicMethods

/***//**
*Extractthedesiredrequestproperty,andpassit(alongwiththe
*specifiedrequestandresponseobjects)totheprotected
*<code>process()</code>methodtoperformtheactualfiltering.This
*methodmustbeimplementedbyaconcretesubclass.
*
*
@paramrequest
*Theservletrequesttobeprocessed
*
@paramresponse
*Theservletresponsetobecreated
*
@paramcontext
*Thevalvecontextusedtoinvokethenextvalveinthecurrent
*processingpipeline
*
*
@exceptionIOException
*ifaninput/outputerroroccurs
*
@exceptionServletException
*ifaservleterroroccurs
*/

publicvoidinvoke(Requestrequest,Responseresponse)
throwsIOException,ServletException...{

ServletRequestsreq
=request.getRequest();
if(sreqinstanceofHttpServletRequest)...{
HttpServletRequesthreq
=(HttpServletRequest)sreq;
process(hreq.getMethod(),request,response);
}


}


}
由于tomcat5.0与tomcat5.5有很大区别.所以实际实现方法是不一样的.在修改时需要注意.而tomcat6.0还没有搞过disable过.所以还请自己搜下了.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值