server.xml

does maxPostSize apply to multipart/form-data file uploads

假装没事ソ 提交于 2019-12-19 06:04:10
问题 I have a webapp on a Tomcat server that allows files to be uploaded. There is a limit on the size of a file upload, and I'd like that limit to be enforced preemptively (ie, once you cross the limit, the file upload fails, rather than transferring the whole file, checking that it's too big and then sending an error). I tried to do this by add maxPostSize="1000" to the connector section in the relevant connector in server.xml, but I can still upload larger files. I've seen a post indicating

Set default login/authentication in server.xml. How can you do this?

孤者浪人 提交于 2019-12-12 01:45:20
问题 Extract from my server.xml : <basicRegistry id="basic" realm="customRealm"> <user name="defaultUser@example.com" password="password" /> </basicRegistry> Currently, this requires login from the user in the form of a dialog box. I would like for the user to be logged in as defaultUser@example.com by default, without any dialog boxes or having to type anything. How can I do this? 回答1: You could try to use this kind of link to provide authentication credentials in it: http://userid:secretpassword

Moving contents of META-INF/context.xml to tomcat/conf

好久不见. 提交于 2019-12-11 07:35:10
问题 We are trying to take the environment specific configuration settings out of our war files, so we can deploy the same war file to dev/test/prod tomcat servers and not have to change the contents of the war config file. When I move the META-INF/context.xml for the database connection to the conf/server.xml the database connection no longer works, with the following error, anyone know why this would be? server.xml: <GlobalNamingResources> .... <Resource url="jdbc:oracle:thin:@hostname:1521

Why is my Tomcat 6 executor thread pool not being used by the connector?

痞子三分冷 提交于 2019-12-06 05:57:20
My server.xml looks like the following: <!--The connectors can use a shared executor, you can define one or more named thread pools--> <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="200" minSpareThreads="4"/> <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="10000" maxKeepAliveRequests="1" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> However, in the Tomcat manager ( http://localhost/manager/status ) it shows to following http-8080: Max threads: -1 Current thread count: -1 Current

Tomcat - How to specify properties that can be expanded in server.xml

北城以北 提交于 2019-12-05 21:49:15
问题 Currently, I have in my server.xml: <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> I want it to become: <Connector port="${oms.ui.port}" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> I put this property oms.ui.port in a property file residing in apache-tomcat-7.0.8\lib but it does not find it, I get: WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'port' to '${oms.ui.port}' did not find a matching

Programmatically get Tomcat HTTP Connector's maxPostSize in a JSP

ε祈祈猫儿з 提交于 2019-12-05 04:19:02
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: int maxPostSize = ServerFactory.getServer().findServices()[0].findConnectors()[0].getMaxPostSize(); ServerFactory is by the way org.apache.catlina.ServerFactory . Note: this tight-couples your code to the Tomcat servletcontainer and your webapp may not be

Tomcat的配置文件server.xml中添加中文注释后,启动Tomcat时出现错误

依然范特西╮ 提交于 2019-12-04 08:49:47
今天 启动tomcat时出现失败,控制台一闪而过,打开catalina的log发现错误指向了conf/server.xml,报错信息如下: ----------------------------------------------------------------------------------------------------------------------------------- 警告: Catalina.start using conf/server.xml: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效。 ... ... ----------------------------------------------------------------------------------------------------------------------------------- 想起刚刚的确是修改了这个文件,遂比较了一下本文件的历史版本,发现可疑之处在于追加的中文注释,删除掉,问题就解决了。 上述问题是解决了,但是我们想添加中文注释!有没有办法让它支持中文呢?接下来试着把xml头定义中的encoding=

Tomcat - How to specify properties that can be expanded in server.xml

旧巷老猫 提交于 2019-12-04 05:04:58
Currently, I have in my server.xml: <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> I want it to become: <Connector port="${oms.ui.port}" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> I put this property oms.ui.port in a property file residing in apache-tomcat-7.0.8\lib but it does not find it, I get: WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'port' to '${oms.ui.port}' did not find a matching property. Maybe someone with a better Tomcat experience can help me, please? According to Tomcat 7.0

tomcat 7: automatically redirect https requests to port 8443

与世无争的帅哥 提交于 2019-12-03 17:39:20
问题 On tomcat7, our web application is running through https over port 8443 and works fine except that we are unable to redirect https default port ( 443 ) to 8443 so as a consequence the ':8443' has to be included in the URL whenever we have to access the application. I include some parts of our server.xml file. What should be done in order to be able to load our pages without having to enter port information in the URL? <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000"

Tomcat 7 GZIP compression not working

折月煮酒 提交于 2019-12-03 05:36:00
问题 I have added the following lines in tomcat's conf/server.xml file to enable gzip compression but its not working. Pages are still uncompressesd. <Connector port="8080" compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml,text/plain,text/css, text/javascript,text/json,application/x-javascript, application/javascript,application/json"/> Any idea? 回答1: If Tomcat is fronted by Apache on port 80, you will need to enable