本文介绍了Web项目下ESAPI.properties的正确位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中添加了一个OWASP ESAPI库。目前我遇到了一个问题,在哪里找到 ESAPI.properties 文件。此项目稍后应部署在我无法访问的少数服务器上。所以在我看来,没有办法自定义 org.owasp.esapi.resources 变量,我不能把它放在用户主目录下。所以我可以放这个文件的唯一地方是 SystemResource Directory / resourceDirectory 但它在哪里?我已经尝试过这些文件:

  .esapi / ESAPI.properties 
esapi / ESAPI.properties
ESAPI.properties

进入这些地点:

  $ CATALINA_HOME / webapps /< MY_PROJECT> / 
$ CATALINA_HOME / webapps /< MY_PROJECT> / WEB-INF
$ CATALINA_HOME / webapps /< MY_PROJECT> / WEB-INF / classes
$ CATALINA_HOME / webapps /< MY_PROJECT> / META-INF

但是在所有这些地方我都收到一个错误:
在SystemResource目录/ resourceDirectory中找不到:.esapi \ APIAPI.properties



那么我应该在哪里找到这个文件?这是一个遗留项目(只有 Eclipse Project 没有Maven),它的结构非常难看。没有像 / src / main / resources 这样的目录在我看来应该找到这个 ESAPI.properties 文件。我已经创建了这个目录,但最终这个文件应该在部署到Tomcat的WAR存档之后?

解决方案

ESAPI.properties 文件应位于 esapi 目录下的 CLASSPATH 中。 / p>

因此,假设您有一个模块,它以2种形式中的任何一种部署到战争中:作为jar,或作为类爆炸。
只需在你使用OWASP ESAPI第三方的模块源中创建一个目录。



从eclipse的角度来看,文件只需要在 CLASSPATH 无论您是否使用maven。当使用maven时,maven resources 目录被转换为eclipse sources 目录 m2eclipse 插件。



示例(使用eclipse标准源结构):

  src 
| --- com
| | --- module
| | | --- SomeClass.java
| --- esapi
| | --- ESAPI.properties


I added a OWASP ESAPI library to my project. And currently I'm stuck with a problem where to locate ESAPI.properties file. This project later should be deployed on few servers to which I don't have an access. So in my opinion there is no way to customizeorg.owasp.esapi.resources variable and I can't put it under user home directory. So the only place where I can put this file is SystemResource Directory/resourceDirectory but where is it? I have already tried to put these files:

.esapi/ESAPI.properties
esapi/ESAPI.properties
ESAPI.properties

Into these locations:

$CATALINA_HOME/webapps/<MY_PROJECT>/
$CATALINA_HOME/webapps/<MY_PROJECT>/WEB-INF
$CATALINA_HOME/webapps/<MY_PROJECT>/WEB-INF/classes
$CATALINA_HOME/webapps/<MY_PROJECT>/META-INF

But in all of these places I get an error:Not found in SystemResource Directory/resourceDirectory: .esapi\ESAPI.properties

So where I should locate this file? It's a legacy project(just Eclipse Project without Maven) and it's structure is pretty ugly. There is no such directory like /src/main/resources where in my opinion this ESAPI.properties file should be located. I have created this directory, but where finally this file should be after deployment a WAR archive to Tomcat?

解决方案

ESAPI.properties file should reside in a CLASSPATH under the esapi directory.

So let's say you have a module which is deployed into war in any of the 2 forms: as a jar, or exploded as classes.Just create a directory inside the source of a module where you use the OWASP ESAPI 3rd party.

From eclipse perspective the file just need to be in the CLASSPATH regardless whether you use maven or not. When using maven, maven resources directory is converted as eclipse sources directory by m2eclipse plugin.

Example (using eclipse standard source structure):

src
|---com
|   |---module
|   |   |---SomeClass.java
|---esapi
|   |---ESAPI.properties

这篇关于Web项目下ESAPI.properties的正确位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 20:14