改变Tomcat中的JSP编译器(JSP Compiler)
在Tomcat 4.1(或更高版本,大概),JSP的编译由包含在Tomcat里面的Ant程序控制器直接执行。这听起来有一点点奇怪,但这正是Ant有意为之的一部分,有一个API文档指导开发者在没有启动一个新的JVM的情况下,使用Ant。
这是使用Ant进行Java开发的一大优势。另外,这也意味着你现在能够在Ant中使用任何javac支持的编译方式,这里有一个关于Apache Ant使用手册的javac page列表。
使用起来是容易的,因为你只需要在<init-param> 元素中定义一个名字叫“compiler”,并且在value中有一个支持编译的编译器名字,示例如下:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>
org.apache.jasper.servlet.JspServlet
</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>WARNING</param-value>
</init-param>
<init-param>
<param-name>compiler</param-name>
<param-value>jikes</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
|
当然,给出的编译器必须已经安装在你的系统中,并且CLASSPATH可能需要设置,那处决于你选择的是何种编译器。
限制特定主机访问(Restricting Access to Specific Hosts)
有时,你可能想限制对Tomcat web应用的访问,比如,你希望只有你指定的主机或IP地址可以访问你的应用。这样一来,就只有那些指定的的客户端可以访问服务的内容了。为了实现这种效果,Tomcat提供了两个参数供你配置:RemoteHostValve 和RemoteAddrValve。
通过配置这两个参数,可以让你过滤来自请求的主机或IP地址,并允许或拒绝哪些主机/IP。与之类似的,在Apache的httpd文件里有对每个目录的允许/拒绝指定。例如你可以把Admin Web application设置成只允许本地访问,设置如下:
<Context path=
"/path/to/secret_files" ...>
<Valve className="org.apache.
catalina.valves.RemoteAddrValve"
allow="127.0.0.1" deny=""/>
</Context>
|
如果没有给出允许主机的指定,那么与拒绝主机匹配的主机就会被拒绝,除此之外的都是允许的。与之类似,如果没有给出拒绝主机的指定,那么与允许主机匹配的主机就会被允许,除此之外的都是拒绝的。
分享到:
相关推荐
tool.jar下载Unable to create schema compiler需要加载tool.jar的同学们。
Introduction to Compiler Design 2
Compiler Design - Introduction to the Theory of Computation.rar
An Incremental Approach to Compiler Construction
Introduction to Compiler Construction addresses the essential aspects of compiler design at a level that is perfect for today's undergraduate. Publisher: W. H. Freeman 1992 | 359 Pages | ISBN: ...
In order to reduce the complexity of designing and building computers, nearly all of these are made to execute relatively simple commands (but do so very quickly). A program for a computer must be ...
compiler from the JDK to compile JSPs, or any other Java compiler supported by Apache Ant. ============== API Stability: ============== The public interfaces for the following classes are fixed and ...
c compiler to learn how to download files
DoneEx XCell Compiler
keil5.37没有预装compiler version5,这是compiler version5安装包
Note: As Tomcat 8 matures, the above list will be added to. The list is not considered complete at this time. The remaining classes are considered part of the Tomcat internals and may change without...
This is the first book to describe the recent significant changes to the .NET compilation process and demonstrate how .NET developers can use the new Compiler API to create compelling applications....
DFT Compiler
赠送jar包:commons-compiler-3.0.8.jar; 赠送原API文档:commons-compiler-3.0.8-javadoc.jar; 赠送源代码:commons-compiler-3.0.8-sources.jar; 赠送Maven依赖信息文件:commons-compiler-3.0.8.pom; 包含...
This is the first book to describe the recent significant changes to the .NET compilation process and demonstrate how .NET developers can use the new Compiler API to create compelling applications....
missing compiler version 5的解决方法
include=%compiler_home%\include;%compiler_home%\PlatformSDK\Include; lib=%compiler_home%\lib;%compiler_home%\PlatformSDK\Lib; path+=%compiler_home%\bin 2.将安装目录复制到VC2010.dat里面的@set VC2010=...
WndRiver_Compiler_Users_Guide_for_arm_xscale_5.6 WndRiver_Compiler_Users_Guide_for_cf_xscale_5.6 WndRiver_Compiler_Users_Guide_for_mips_xscale_5.6 WndRiver_Compiler_Users_Guide_for_ppc_xscale_5.6 ...
The Dummies’ Guide to Compiler Design By 作者: Rosina S Khan Pub Date: 2018 ISBN: n/a Pages: 161 This book is useful for those who are interested in knowing the underlying principles of a Compiler ...