Java Tomcat服务器.xml解析器
我需要从代码中修改Tomcat的Java Tomcat服务器.xml解析器,java,xml,jakarta-ee,tomcat,xml-parsing,Java,Xml,Jakarta Ee,Tomcat,Xml Parsing,我需要从代码中修改Tomcat的server.xml 好的,这只是一个XML文件,有很多方法可以解析它,但我想知道是否已经有专门用于server.XML(例如来自Apache)的API,并且不必编写任何代码来解析它。 有吗? 注意:解析server.xml的程序将“离线”进行解析,即它不是阀门的一部分,也不是可以访问容器的其他组件的一部分通过xml生成xsd(使用IDEA或)->通过xsd生成jaxb表示(使用jaxb)不会花费很长时间通过xml生成xsd(使用IDEA或)->通过xsd生成ja
server.xml
好的,这只是一个XML文件,有很多方法可以解析它,但我想知道是否已经有专门用于
server.XML
(例如来自Apache)的API,并且不必编写任何代码来解析它。有吗?
注意:解析
server.xml
的程序将“离线”进行解析,即它不是阀门的一部分,也不是可以访问容器的其他组件的一部分通过xml生成xsd(使用IDEA或)->通过xsd生成jaxb表示(使用jaxb)不会花费很长时间通过xml生成xsd(使用IDEA或)->通过xsd生成jaxb表示(使用jaxb)不会花费很长时间您可以使用Tomcat用于加载server.xml的相同解析例程,即。通过这种方式,您可以重用常规的Tomcatcatalina.jar
,避免生成过时的代码
从文件中:
b3) createStartDigester()
Configures a digester for the main server.xml elements like
org.apache.catalina.core.StandardServer (can change of course :)
org.apache.catalina.deploy.NamingResources
Stores naming resources in the J2EE JNDI tree
org.apache.catalina.LifecycleListener
implements events for start/stop of major components
org.apache.catalina.core.StandardService
The single entry for a set of connectors,
so that a container can listen to multiple connectors
ie, single entry
org.apache.coyote.tomcat5.CoyoteConnector
Connectors to listen for incoming requests only
It also adds the following rulesets to the digester
NamingRuleSet
EngineRuleSet
HostRuleSet
ContextRuleSet
b4) Load the server.xml and parse it using the digester
Parsing the server.xml using the digester is an automatic
XML-object mapping tool, that will create the objects defined in server.xml
Startup of the actual container has not started yet.
您可以使用Tomcat用于加载server.xml
的相同解析例程,即。通过这种方式,您可以重用常规的Tomcatcatalina.jar
,避免生成过时的代码
从文件中:
b3) createStartDigester()
Configures a digester for the main server.xml elements like
org.apache.catalina.core.StandardServer (can change of course :)
org.apache.catalina.deploy.NamingResources
Stores naming resources in the J2EE JNDI tree
org.apache.catalina.LifecycleListener
implements events for start/stop of major components
org.apache.catalina.core.StandardService
The single entry for a set of connectors,
so that a container can listen to multiple connectors
ie, single entry
org.apache.coyote.tomcat5.CoyoteConnector
Connectors to listen for incoming requests only
It also adds the following rulesets to the digester
NamingRuleSet
EngineRuleSet
HostRuleSet
ContextRuleSet
b4) Load the server.xml and parse it using the digester
Parsing the server.xml using the digester is an automatic
XML-object mapping tool, that will create the objects defined in server.xml
Startup of the actual container has not started yet.
以编程方式这样做是否是一种好的做法?以编程方式这样做是否是一种好的做法?如果你让一个安装程序变得非常有用如果你让一个安装程序变得非常有用,我很想这样做,但是jaxb会生气(当然是我的错,但我不知道怎么做)然后返回可序列化列表,而不是相应的bean,这个block我想这样做,但是jaxb发疯了(当然是我的错,但我不知道怎么做),然后返回可序列化列表,而不是相应的bean,这个block我