在码头配置外部WebApp的最大帖子大小 [英] Configure max post size for a external webapp in jetty

查看:121
本文介绍了在码头配置外部WebApp的最大帖子大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题如下:

我提供了一个webapp.war和一个Tomcat服务器以从中进行部署.

I deliver a webapp.war and a Tomcat server to deploy it from.

我的客户端可以选择不使用服务器,而使用将我的应用程序部署在Jetty中作为外部Web应用程序的服务.

My client has the option to not use my server and use a service that deploys my app in Jetty as an external webapp.

Jetty对POST大小有一个限制,即默认大小(200k),对于我的应用程序来说,它太小而无法正常运行其所有功能-我的HTTP 1/1 POST请求被截断,并且变得基本上不可用.

That Jetty has a limitiation for POST size that is default (200k) and is too small for my app to run all its features properly - my HTTP 1/1 POST request get truncated and become mainly unusable.

我需要做的是配置我的Web应用程序,以便当在Jetty中作为外部应用程序部署时,其最大POST大小是我选择的值-就像1M.

What I need to do is configure my webapp so that when deployed in Jetty as an external app, its max POST size is a value of my choosing - like 1M.

我进行了一些研究,发现可以配置jetty来仅更改特定Web应用程序的POST大小,但是由于我不使用Jetty,因此我尚不清楚此设置应该去哪里以及有什么区别.设置的角度来看,在Jetty中外部Web应用程序和内部Web应用程序之间(路径除外).

I have done some research and I found that one can configure jetty to change POST size only for a particular webapp, but as I don't use Jetty I am yet unclear where this settings should go and what is the difference, from the settings point of view, between an external webapp and an internal webapp in Jetty (other than path).


http://wiki.eclipse.org/Jetty/Howto/Configure_Form_Size#Changing_the___for_Maximum_Form


http://wiki.eclipse.org/Jetty/Howto/Configure_Form_Size#Changing_the_Maximum_Form_Size_for_All_Apps_on_a_Server


http://wiki.eclipse.org/Jetty_WTP_Plugin/Jetty_WTP_External_WebApp


http://wiki.eclipse.org/Jetty_WTP_Plugin/Jetty_WTP_External_WebApp

我希望能找到更多的信息,但是对于Jetty中的外部Web应用程序,我的研究并非偶然.

I would have liked to have found out more, but my research was not quite fortuitous with respect to external webapps in Jetty.

我尝试了JVM方法,将"org.eclipse.jetty.server.Request.maxFormContentSize"环境变量设置为1000000,但是我发现设置行为没有改变.

I have tried the JVM approach, setting "org.eclipse.jetty.server.Request.maxFormContentSize" environment variable to 1000000, but I noticed no change in my setup behaviour.

该请求不会在Tomcat中被截断(该请求也在默认配置下运行),但是到目前为止,无论我如何阻止该请求的发生,该请求在Jetty上都被截断了.

The request is not truncated in Tomcat (which also runs on a default configuration), but was so far truncated on Jetty no matter what I did to stop that from happening.

如果可以避免的话,我不应该更改Jetty服务器的全局设置,但是即使我必须为此做出任何妥协,也欢迎取得任何进展.

I should not change the Jetty server's global setting, if I can avoid it, but any progress would be welcome even if I have to compromise on this.

你们对我应该做什么有任何想法吗?

Do you guys have any ideas on what I should do?

推荐答案

如果您正在编写自己的Java码头服务器,这就是直接从Java源代码更改主体大小的方法

If you are programing your own java jetty server, this is the way, how to change body size directly from java source code

org.eclipse.jetty.server.Server server =
    new org.eclipse.jetty.server.Server(port);

// configure http request body size limit to 100MB
server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", "100000000");
...
server.start();
server.join();

这篇关于在码头配置外部WebApp的最大帖子大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆