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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming that you’ve only one Tomcat service with one connector, then you can access it in Servlet by:
ServerFactoryis 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.xmlwith the same value.Then you can access it in Servlet by
or in JSP by