I am using Tomcat 6 and would like to be able to retrieve the maxPostSize (defined in the HTTP Connector in server.xml) programmatically from within a JSP so that I can know what the max file upload size is.
Is there a way to get this?
I am using Tomcat 6 and would like to be able to retrieve the maxPostSize (defined in the HTTP Connector in server.xml) programmatically from within a JSP so that I can know what the max file upload size is.
Is there a way to get this?
Assuming that you've only one Tomcat service with one connector, then you can access it in Servlet by:
ServerFactory
is by the wayorg.apache.catlina.ServerFactory
.Note: this tight-couples your code to the Tomcat servletcontainer and your webapp may not be reuseable on other servletcontainers, possibly even not different versions. Consider configuring your own context parameter in
web.xml
with the same value.Then you can access it in Servlet by
or in JSP by