[英]Cloud Foundry Java Buildpack : how to change value in server.xml for Tomcat?
I want to override the value maxPostSize property in the Connector element in the server.xml
configuration file. 我想覆盖
server.xml
配置文件中Connector元素中的maxPostSize属性值。 (Set the maximum size to 1MB) (将最大大小设置为1MB)
Is the only way to do this to fork the https://github.com/cloudfoundry/java-buildpack and change the existing server.xml
configuration file ? 这样做的唯一方法是派生https://github.com/cloudfoundry/java-buildpack并更改现有的
server.xml
配置文件?
Or is it also possible to add a server.xml
somewhere in my WAR file, so that this one will be used instead of the one which is present in the buildpack. 或者也可以在我的WAR文件中的某处添加
server.xml
,以便使用该文件而不是buildpack中的文件。
Or can I also use JAVA_OPTS for that ? 还是可以为此使用JAVA_OPTS?
Is the only way to do this to fork the https://github.com/cloudfoundry/java-buildpack and change the existing server.xml configuration file ?
这样做的唯一方法是派生https://github.com/cloudfoundry/java-buildpack并更改现有的server.xml配置文件?
With version 3.7+ of the Java build pack you can override the Tomcat configuration without forking the build pack. 使用Java构建包的3.7+版本,您可以覆盖Tomcat配置,而无需派生构建包。 The feature is called "External Tomcat Configuration".
该功能称为“外部Tomcat配置”。
https://github.com/cloudfoundry/java-buildpack/blob/master/docs/container-tomcat.md#external-tomcat-configuration https://github.com/cloudfoundry/java-buildpack/blob/master/docs/container-tomcat.md#external-tomcat-configuration
Here's the gist of how it works. 这是其工作原理的要点。
tomcat/conf
directory. tomcat/conf
目录的TAR文件。 This can contain things like server.xml
, context.xml
, web.xml
and anything that would normally go under Tomcat's conf/
directory. server.xml
, context.xml
, web.xml
内容,通常包含在Tomcat的conf/
目录下的任何内容。 index.yml
and that TAR file on an HTTP server some where. index.yml
和该TAR文件托管在HTTP服务器上的某个位置。 If you don't have one, you can push it as an application to CF using the Static File build pack. JBP_CONFIG_TOMCAT
. JBP_CONFIG_TOMCAT
将Java构建包指向此配置JBP_CONFIG_TOMCAT
。 Here is an example: `"{ tomcat: { external_configuration_enabled: true }, external_configuration: { repository_root: \\"url_to_repo\\" } }" More on the structure for the files on the HTTP server can be found here 有关HTTP服务器上文件结构的更多信息,请参见此处
I believe this will document all of your official options: https://github.com/cloudfoundry/java-buildpack/blob/master/docs/container-tomcat.md#additional-resources 我相信这将记录您所有的正式选择: https : //github.com/cloudfoundry/java-buildpack/blob/master/docs/container-tomcat.md#additional-resources
Neither of which are very simple/easy. 两者都不是非常简单/容易的。
You could consider changing your application to a spring boot application. 您可以考虑将您的应用程序更改为Spring Boot应用程序。 I'm not a boot expert but I believe that the java buildpack can use a boot embedded tomcat even even if the packaging type is a .war.
我不是启动专家,但我相信即使打包类型为.war,java buildpack也可以使用启动嵌入式tomcat。 In this type of configuration you might be able to use boot to customize how it starts the embedded tomcat to customize things like maxPostSize.
在这种类型的配置中,您可能能够使用boot来定制启动嵌入式tomcat的方式来定制诸如maxPostSize之类的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.