[英]Some servlet/jetty questions
Having the ServletAPI plus the configurations you can make to jetty or any other web container 拥有ServletAPI以及您可以对jetty或任何其他Web容器进行的配置
While dispatching a request in your own configured servlet, can we forward ( not redirect ) the request to the 'default' servlet. 在您自己配置的servlet中调度请求时,我们是否可以将请求转发(不重定向)到“default”servlet。 ? ? Will this allways work ? 这总是有效吗?
RequestDispatcher rd = getServletContext().getNamedDispatcher("default"); HttpServletRequest wrapped = new HttpServletRequestWrapper(req) { public String getServletPath() { return ""; } }; rd.forward(wrapped, resp);
Thanks in advance! 提前致谢!
Spring has something to take care of this. Spring有一些事情可以解决这个问题。 If you're using Spring, you're in luck, or else you need to roll your own solution based on what Spring does. 如果您正在使用Spring,那么您很幸运,或者您需要根据Spring的功能推出自己的解决方案。 I can't speak for other frameworks, but I guess many other frameworks would have some support for this. 我不能代表其他框架,但我想其他许多框架都会对此有所支持。
Take a look at org.springframework.web.multipart.commons.CommonsMultipartResolver
and org.springframework.web.multipart.MaxUploadSizeExceededException
看看org.springframework.web.multipart.commons.CommonsMultipartResolver
和org.springframework.web.multipart.MaxUploadSizeExceededException
The CommonsMultipartResolver
has a property maxUploadSize
that lets you control the max size. CommonsMultipartResolver
有一个属性maxUploadSize
,可以控制最大大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.