RE: Which user executes JSP in Tomcat?
Hello, Thanks for you reply and advice. Others asked if the JSP is correct, yes it is, there are no errors displayed. No catch(Exception ex) { /*do nothing*/} kind of code either. The error logs for Tomcat don't show anything out of the ordinary. Is there anyway to tell tomcat to allow IO access to a specific folder? Thanks for your help everyone. I'm looking through the log files. Caldarale, Charles R wrote: From: raga2 [mailto:ragabo...@gmail.com] Subject: Re: Which user executes JSP in Tomcat? ps -aef tells me it's root running tomcat. That's a really bad thing to do. You should be running Tomcat under a userid that does not give it the privilege to scribble anywhere in the file system. If you need to access ports 1024, start Tomcat with jsvc, or use iptables to redirect the low ports to what's configured in Tomcat. Back to your original problem: there's no guarantee that a servlet container will allow webapp code to have access to any part of the file system, other than a spec-defined work area. Tomcat usually does allow such access, unless you're running with a security manager. If you're trying to use relative paths in your directory and file creation, then you're likely trying to write within Tomcat's directory structure, which is another Really Bad Thing. Make sure that wherever you're writing is outside of Tomcat. (And if you're using a 3rd-party, repackaged version of Tomcat, it's anybody's guess where all the pieces of Tomcat are, since the repackagers seem to delight in scattering bits of Tomcat all over, and then tying things back together with a mess of symlinks - bloody ridiculous.) - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- View this message in context: http://www.nabble.com/Which-user-executes-JSP-in-Tomcat--tp22865557p22893516.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: HTTP Connector GZIP compression
Caldarale, Charles R wrote: From: Michael [mailto:sg...@gmx.net] Subject: HTTP Connector GZIP compression I am on tomcat 5.5.27. Unfortunately compression worked arbitrary, worked on html only and worked even when I turned it off. Please post your server.xml so we can see exactly what you configured. Note that the minimum default size for compression is 2048. Hi Charles, this is my server.xml: http://www.pastie.org/437454 CompressionMinSize is given bytes, isn't it? Thanks - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: How to debug Error: listenerStart?
log4j errors when porting a 5.5 webapp to 6.x: output/build/webapp/docs/logging.html 1. Create a file called log4j.properties with the following content and save it into $CATALINA_HOME/lib. log4j.rootLogger=debug, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=${catalina.home}/logs/tomcat.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.apache.catalina=DEBUG, R --done no problems-- 2. Download Log4J (v1.2 or later) and place the log4j jar in $CATALINA_HOME/lib. --done no problems-- 3. Build the commons-logging additional component using the extras.xml Ant build script which is part of the Tomcat source bundle. --start extras.xml from Tomcat source bundle (which BTW has no references to log4j) -- ?xml version=1.0? project name=Tomcat 6.0 default=extras basedir=. !-- = Initialize Property Values === -- !-- See build.properties.sample in the top level directory for all -- !-- property values you must customize for successful building!!!-- property file=${user.home}/build.properties/ property file=build.properties/ property file=build.properties.default/ !-- Project Properties -- property name=name value=Apache Tomcat / property name=year value=2007 / property name=version.major value=6 / property name=version.minor value=0 / property name=version.build value=0 / property name=version.patch value=0 / property name=version value=6.0.0-dev / property name=version.number value=${version.major}.${version.minor}.${version.build}.${version.patch} / property name=project value=apache-tomcat / property name=final.namevalue=${project}-${version} / property name=final-src.namevalue=${project}-${version}-src / !-- Build Defaults -- property name=tomcat.build value=${basedir}/output/build/ property name=tomcat.classesvalue=${basedir}/output/classes/ property name=tomcat.dist value=${basedir}/output/dist/ property name=tomcat.extras value=${basedir}/output/extras/ property name=tomcat.deployer value=${basedir}/output/deployer/ property name=tomcat.releasevalue=${basedir}/output/release/ property name=test.failonerror value=true/ property name=test.runner value=junit.textui.TestRunner/ !-- Can't be lower - jsp uses templates -- property name=compile.source value=1.5/ !-- JAR artifacts -- property name=bootstrap.jar value=${tomcat.build}/bin/bootstrap.jar/ property name=annotations-api.jar value=${tomcat.build}/lib/annotations-api.jar/ property name=servlet-api.jar value=${tomcat.build}/lib/servlet-api.jar/ property name=jsp-api.jar value=${tomcat.build}/lib/jsp-api.jar/ property name=el-api.jar value=${tomcat.build}/lib/el-api.jar/ property name=catalina.jar value=${tomcat.build}/lib/catalina.jar/ property name=catalina-ant.jar value=${tomcat.build}/lib/catalina-ant.jar/ property name=catalina-ant-jmx.jar value=${tomcat.build}/lib/catalina-ant-jmx.jar/ property name=tomcat-coyote.jar value=${tomcat.build}/lib/tomcat-coyote.jar/ property name=jasper.jar value=${tomcat.build}/lib/jasper.jar/ property name=jasper-el.jar value=${tomcat.build}/lib/jasper-el.jar/ property name=tomcat-dbcp.home value=${base.path}/tomcat6-deps/dbcp / property name=jasper-jdt.home value=${base.path}/tomcat6-deps/jdt / property name=tomcat-dbcp.jar value=${tomcat-dbcp.home}/tomcat-dbcp.jar/ property name=jasper-jdt.jar value=${jasper-jdt.home}/jasper-jdt.jar/ property name=tomcat-juli.jar value=${tomcat.extras}/tomcat-juli.jar/ property name=tomcat-juli-adapters.jar value=${tomcat.extras}/tomcat-juli-adapters.jar/ property name=catalina-ws.jar value=${tomcat.extras}/catalina-ws.jar/ !-- Classpath -- path id=tomcat.classpath pathelement location=${tomcat.classes}/ /path target name=prepare mkdir dir=${tomcat.extras}/ /target target name=clean delete dir=${tomcat.extras}/ /target target name=commons-logging antcall target=downloadfile param name=sourcefile value=${commons-logging-src.loc}/ param name=destfile value=${tomcat.extras}/logging/commons-logging-src.tar.gz/ param name=destdir value=${tomcat.extras}/logging// /antcall gunzip src=${tomcat.extras}/logging/commons-logging-src.tar.gz dest=${tomcat.extras}/logging/commons-logging-src.tar/ untar src=${tomcat.extras}/logging/commons-logging-src.tar dest=${tomcat.extras}/logging// replace
RE: How to debug Error: listenerStart?
From: Martin Gainty [mailto:mgai...@hotmail.com] Subject: RE: How to debug Error: listenerStart? log4j errors when porting a 5.5 webapp to 6.x: output/build/webapp/docs/logging.html None of your post is relevant to the topic under discussion. The instructions for using log4j here: http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j are appropriate when you want *Tomcat* to use log4j internally, not when using log4j inside a webapp, which is all the OP is trying to do. If you want to discuss using log4j for Tomcat's own logging, start a new thread. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: HTTP Connector GZIP compression
From: Michael [mailto:sg...@gmx.net] Subject: Re: HTTP Connector GZIP compression this is my server.xml: http://www.pastie.org/437454 Other than having Context elements in there, the only other obviously wrong item is the compressionMinSize attribute; there isn't one for a Connector. CompressionMinSize is given bytes, isn't it? There's no such attribute for a Connector, so your question is moot. Read the doc: http://tomcat.apache.org/tomcat-5.5-doc/config/http.html#Standard%20Implementation You are testing through port 8080, aren't you? I don't see any problems with compression on 5.5.27 when testing on my laptop; I see a header of Content-Encoding: gzip on all appropriate responses. You need to supply the URLs you're using and the response headers as seen by the browser. (Live HTTP headers for Firefox is good for this.) - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Re: HTTP Connector GZIP compression
Caldarale, Charles R wrote: From: Michael [mailto:sg...@gmx.net] Subject: Re: HTTP Connector GZIP compression this is my server.xml: http://www.pastie.org/437454 Other than having Context elements in there, the only other obviously wrong item is the compressionMinSize attribute; there isn't one for a Connector. Correct, I removed that element. CompressionMinSize is given bytes, isn't it? There's no such attribute for a Connector, so your question is moot. Read the doc: http://tomcat.apache.org/tomcat-5.5-doc/config/http.html#Standard%20Implementation You are testing through port 8080, aren't you? I don't see any problems with compression on 5.5.27 when testing on my laptop; I see a header of Content-Encoding: gzip on all appropriate responses. You need to supply the URLs you're using and the response headers as seen by the browser. (Live HTTP headers for Firefox is good for this.) Yes, I am on port 8080. Local testing. I have altered the Connctor to: - Connector compression=8 compressableMimeType=text/html,text/javascript URIEncoding=UTF-8 acceptCount=100 connectionTimeout=2 disableUploadTimeout=true enableLookups=false maxHttpHeaderSize=8192 maxSpareThreads=75 maxThreads=150 minSpareThreads=25 port=8080 redirectPort=8443 / - I have two testfiles on my server: 1. lorem.jsp: 72 726 bytes 2. prototype.js: 134.057 bytes According to the above setting only the JS file should be compressed. Inspecting the requests with Fiddler and Firebug (caches cleared) results in: 1. lorem.jsp: # Result Protocol Host URL Body Caching Content-Type Process Comments Custom 0 200 HTTP localhost:8080 /java-demo/lorem.jsp 19 665 text/html;charset=UTF-8 firefox:500 GET /java-demo/lorem.jsp HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de-DE,de;q=0.8,nl-NL;q=0.6,nl;q=0.4 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: JSESSIONID=E0EEB796A88FECFE98882E37EB499565 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Content-Encoding: gzip Vary: Accept-Encoding Date: Sun, 05 Apr 2009 16:57:07 GMT a � 2. prototype.js: # Result Protocol Host URL Body Caching Content-Type Process Comments Custom 1 200 HTTP localhost:8080 /java-demo/prototype.js 134 057 text/javascript firefox:500 GET /java-demo/prototype.js HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 Accept: */* Accept-Language: de-DE,de;q=0.8,nl-NL;q=0.6,nl;q=0.4 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://localhost:8080/java-demo/lorem.jsp Cookie: JSESSIONID=E0EEB796A88FECFE98882E37EB499565 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 ETag: W/134057-1238784461906 Last-Modified: Fri, 03 Apr 2009 18:47:41 GMT Content-Type: text/javascript Content-Length: 134057 Date: Sun, 05 Apr 2009 16:57:07 GMT [body omitted] Regarding number 1: this is compressed although I set threshold to 80 000 bytes Regarding number 2: the Javascript ist not compressed! No I turn compression off: # Result Protocol Host URL Body Caching Content-Type Process Comments Custom 0 200 HTTP localhost:8080 /java-demo/lorem.jsp 19 665 text/html;charset=UTF-8 firefox:500 # Result Protocol Host URL Body Caching Content-Type Process Comments Custom 1 200 HTTP localhost:8080 /java-demo/prototype.js 134 057 text/javascript firefox:500 lorem.jsp still compressed: WTF This is really weird, I simply do *not* unterstand the compression logic. Thanks, Mike - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RemoteAddrValve syntax
How do I specify wildcards in the RemoteAddrValue declaration? The Tomcat docs says it uses the java.util.regex package, so i wrote a test case like this: String patternStr = 192.168.*.*; String searchStr = 192.168.1.2; Pattern p = Pattern.compile(patternStr); Matcher m = p.matcher(searchStr); System.out.println(Does + patternStr); System.out.println(Match + searchStr); boolean b = m.matches(); System.out.println(Result: + b); Which returns true, however when I placed patternStr into my server.xml file (following the conventions in the Tomcat docs of escaping the . with \ ): Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\.*\.*/ It didn't match, ie. I couldn't get in. I hard coded my current ip into the above value and it worked, but I need to match any 192.168.*.* address. How do specify this in server.xml? Thanks Setup: Java 1.4.2 Tomcat 5.5
Tomcat 5.5 embedded vs Tomcat 6.0.18 embedded
Hi there, I have an application that uses Tomcat as embedded engine and so far I was using version 5.5 of Tomcat. I wanted to upgrade to version 6.0.18 and I've found some issues due to the different behaviour and I don't see any difference in the API or articles I've found so I wonder what I'm doing wrong. The first problem is that, after using Server.start(), unless I have another living thread, the program will exit even though I have the container started and supposedly listening on the port. I have tested that the server indeed works and listens to that port, but when my other threads finish, the container simply exists without a trace. I've seen a thread in the tomcat-dev list (embedded tomcat 6 14 Feb 2008) that seems to imply this is normal with Tomcat 6, but in Tomcat 5.5 this did not happen. Is this normal? On the other hand, if I start the server with a GUI window, so the container remains alive due to the GUI thread, stopping the server does not really work, as even though it says that the Connector stopped, I can still access the server for some seconds and then it starts answering resource not available, but the thing is, it still answers to the port. And I starting the server again does not fix it. On the other hand, with Tomcat 5.5 I am able to stop the server, and it stops answering at the port, so I am also able to start it again. Using exactly the same code. The code looks like this: -- this.theEmbedded = new Embedded(); this.theEmbedded.setCatalinaHome(new File(tomcat_6).getAbsolutePath()); // Add the engine this.engine = this.theEmbedded.createEngine(); this.engine.setName(Catalina); this.engine.setDefaultHost(localhost); // Create the host this.host = this.theEmbedded.createHost(localhost, .); this.engine.addChild(this.host); this.theContext = this.theEmbedded.createContext(/, this.theConfiguration.getBasePath()); this.theContext.setReloadable(false); this.host.addChild(this.theContext); this.theEmbedded.addEngine(this.engine); // Add a conector this.connector = this.theEmbedded.createConnector((java.net.InetAddress) null, this.port, false); this.theEmbedded.addConnector(this.connector); this.theEmbedded.start(); -- Stopping it is quite simple: this.theEmbedded.stop(); -- So, is the Tomcat 6 embedded engine broken or do I have to change the code? Nothing in the API seemed to indicate any changes needed but... who knows? :) Thanks for your help, D. PD: I can provide more information like libraries used and log traces, but I did not want to make this message too long, in case it was something obvious I had missed. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: HTTP Connector GZIP compression
From: Michael [mailto:sg...@gmx.net] Subject: Re: HTTP Connector GZIP compression 1. lorem.jsp: 72 726 bytes 2. prototype.js: 134.057 bytes According to the above setting only the JS file should be compressed. No; response from the .jsp will also be compressed if the return type is html - which it almost always is for JSPs. HTTP/1.1 200 OK Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Content-Encoding: gzip Regarding number 1: this is compressed although I set threshold to 8 bytes Note the Transfer-Encoding of chunked along with this sentence from the doc: If the content-length is not known and compression is set to 'on' or more aggressive, the output will also be compressed. HTTP/1.1 200 OK Content-Type: text/javascript Content-Length: 134057 Regarding number 2: the Javascript ist not compressed! That does seem to be a problem; check your server.xml again now that you've removed the undefined attribute. No I turn compression off: # Result Protocol HostURL Body 0 200HTTP localhost:8080 /java-demo/lorem.jsp 19665 Caching Content-Type Process text/html;charset=UTF-8 firefox:500 lorem.jsp still compressed: WTF Why do you think the output of lorem.jsp is compressed this time? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Re: RemoteAddrValve syntax
Jonathan Mast wrote: How do I specify wildcards in the RemoteAddrValue declaration? The Tomcat docs says it uses the java.util.regex package, so i wrote a test case like this: String patternStr = 192.168.*.*; String searchStr = 192.168.1.2; Pattern p = Pattern.compile(patternStr); Matcher m = p.matcher(searchStr); System.out.println(Does + patternStr); System.out.println(Match + searchStr); boolean b = m.matches(); System.out.println(Result: + b); Which returns true, however when I placed patternStr into my server.xml file (following the conventions in the Tomcat docs of escaping the . with \ ): Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\.*\.*/ This is not a Tomcat convention, it is how regular expressions work. In a regular expression, a . means 'any character' \. mean 'the character .' the expression \.* means a ., 0 or n times The expression 192.168.1.2, as a regexp, matches 192.168.1.2, but also matches 192A168+1C2 and 19201689152 (and a lot more strings), since an unescaped . matches any character. The regexp 192.168.*.* does not make much sense, since the first .* will match anything that follows (or nothing), leaving nothing to match for the second .*. To match any address starting with 192.168., use Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\..*/ or (if you want to be really finicky about it) Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\.\d{1,3}\.\d{1,3}/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: RemoteAddrValve syntax
From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Subject: RemoteAddrValve syntax The Tomcat docs says it uses the java.util.regex package But you apparently didn't read the doc for java.util.regex, which is not anything like the wildcards you tried to use: http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html André has done your homework and provided the proper syntax. Java 1.4.2 You might want to consider moving up to a supported JRE level; 1.4.2 reached end-of-life last October. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RemoteAddrValve syntax
André Warnier wrote: [...] To match any address starting with 192.168., use Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\..*/ or (if you want to be really finicky about it) Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\.\d{1,3}\.\d{1,3}/ What is not very clear in the on-line Tomcat documentation, is whether a remote client address of 192.168.1.2 would be translated to the string 192.168.1.2 by Tomcat prior to matching in the Valve, or to for example 192.168.001.002. Maybe the Valve source code is clearer ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: HTTP Connector GZIP compression
Caldarale, Charles R wrote: From: Michael [mailto:sg...@gmx.net] Subject: Re: HTTP Connector GZIP compression 1. lorem.jsp: 72 726 bytes 2. prototype.js: 134.057 bytes According to the above setting only the JS file should be compressed. No; response from the .jsp will also be compressed if the return type is html - which it almost always is for JSPs. Well, I was not refering to the mime type but to the file size. I set the threshold to 80 000 bytes. No compression should happen below 80 000 bytes. Did I missunderstand something here? HTTP/1.1 200 OK Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Content-Encoding: gzip Regarding number 1: this is compressed although I set threshold to 8 bytes Note the Transfer-Encoding of chunked along with this sentence from the doc: If the content-length is not known and compression is set to 'on' or more aggressive, the output will also be compressed. Ok, understood. What is the rationale for? Is there a good reason to compress anyway? HTTP/1.1 200 OK Content-Type: text/javascript Content-Length: 134057 Regarding number 2: the Javascript ist not compressed! That does seem to be a problem; check your server.xml again now that you've removed the undefined attribute. Checked, the server.xml remains the same. I did not alter it except the invalid attribute. The same happens for CSS too. No I turn compression off: # Result Protocol HostURL Body 0 200 HTTP localhost:8080 /java-demo/lorem.jsp 19665 Caching Content-Type Process text/html;charset=UTF-8 firefox:500 lorem.jsp still compressed: WTF Why do you think the output of lorem.jsp is compressed this time? The simple reason is that I have disabled compression completely and the uncompressed size is 72 726 bytes. But 19 665 bytes have been sent over the wire which means I has beeen compressed anyway. Thanks again, Mike - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: HTTP Connector GZIP compression
From: Michael [mailto:sg...@gmx.net] Subject: Re: HTTP Connector GZIP compression What is the rationale for? Is there a good reason to compress anyway? The size is unknown until the last chunk is generated, so no threshold can be applied. Since chunked encoding usually involves larger outputs, the appropriate thing to do is compress. Checked, the server.xml remains the same. I did not alter It except the invalid attribute. The same happens for CSS too. Did you restart Tomcat after making the change? Are you sure you're actually using the server.xml you think you are? The simple reason is that I have disabled compression completely and the uncompressed size is 72 726 bytes. No, that's the size of the .jsp file - that has little relevance to the size of the generated HTML. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Re: RemoteAddrValve syntax
I looked at the javadocs for the RemoteAddrValve and they provided no further clarity on the syntax issue. You're right, my test case mistakenly returned a false positive, .* could match anything its true and their is no common sense wildcard in the Java Regex package. I looked at the javadoc for the regex package and found it a little too pedantic. I thought javadocs were supposed to be human-readable ;-) thanks for the help On Sun, Apr 5, 2009 at 2:41 PM, André Warnier a...@ice-sa.com wrote: André Warnier wrote: [...] To match any address starting with 192.168., use Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\..*/ or (if you want to be really finicky about it) Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\.\d{1,3}\.\d{1,3}/ What is not very clear in the on-line Tomcat documentation, is whether a remote client address of 192.168.1.2 would be translated to the string 192.168.1.2 by Tomcat prior to matching in the Valve, or to for example 192.168.001.002. Maybe the Valve source code is clearer ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: HTTP Connector GZIP compression
Caldarale, Charles R wrote: From: Michael [mailto:sg...@gmx.net] Subject: Re: HTTP Connector GZIP compression Checked, the server.xml remains the same. I did not alter It except the invalid attribute. The same happens for CSS too. Did you restart Tomcat after making the change? Are you sure you're actually using the server.xml you think you are? Yes, I am absolutely sure. The simple reason is that I have disabled compression completely and the uncompressed size is 72 726 bytes. No, that's the size of the .jsp file - that has little relevance to the size of the generated HTML. Right, but my jsp contains lorem ipsum only, so plain text only. But this makes absolutely sense since JSP is dynamic and the final size is not known before is it is send to the user. BUT: I created a minimal server.xml ans started tomcat with the Tomcat service under Windows. This is the new server.xml: http://www.pastie.org/437744 Additionally, I have created several files which should or should not be compressed, threshold 40 KiB, which should *always* work with all non dynamic content. This is the output of Firefox with Fiddler: http://home.htw-berlin.de/~s0525102/fiddler.log (plain text). To be perfectly honest, only JSP compression seems to be predictable, the rest aboslutely not. What's wrong here. Thanks again, Mike - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat 5.5 embedded vs Tomcat 6.0.18 embedded
From: d.lope...@gmail.com [mailto:d.lope...@gmail.com] On Behalf Of Daniel Lopez Subject: Tomcat 5.5 embedded vs Tomcat 6.0.18 embedded when my other threads finish, the container simply exists without a trace. The metaphysical implications of existing without a trace are rather intriguing... I've seen a thread in the tomcat-dev list (embedded tomcat 6 14 Feb 2008) that seems to imply this is normal with Tomcat 6, but in Tomcat 5.5 this did not happen. Is this normal? Looks like it. In Tomcat 5.5, there was a non-daemon thread for each Connector named http-port-Monitor; this thread no longer exists in 6.0, since the whole area appears to have been re-architected. There are no non-daemon threads in Tomcat 6.0, other than the whatever thread gets the game started; the normal Tomcat bootstrap uses this lead thread to listen on the shutdown port. You'll need to have some thread hanging around to keep the JVM from terminating; if you don't have such a thread, why are you bothering with embedded? if I start the server with a GUI window, so the container remains alive due to the GUI thread, stopping the server does not really work, as even though it says that the Connector stopped, I can still access the server for some seconds and then it starts answering resource not available, but the thing is, it still answers to the port. It's your responsibility to terminate your GUI thread so the JVM can kill off all the daemon threads. The code looks like this: -- this.theEmbedded = new Embedded(); this.theEmbedded.setCatalinaHome(new File(tomcat_6).getAbsolutePath()); // Add the engine this.engine = this.theEmbedded.createEngine(); this.engine.setName(Catalina); this.engine.setDefaultHost(localhost); // Create the host this.host = this.theEmbedded.createHost(localhost, .); this.engine.addChild(this.host); this.theContext = this.theEmbedded.createContext(/, this.theConfiguration.getBasePath()); this.theContext.setReloadable(false); this.host.addChild(this.theContext); this.theEmbedded.addEngine(this.engine); // Add a conector this.connector = this.theEmbedded.createConnector((java.net.InetAddress) null, this.port, false); this.theEmbedded.addConnector(this.connector); this.theEmbedded.start(); You really use this. everywhere? Seems a bit tedious, to say nothing of making code reviews difficult. So, is the Tomcat 6 embedded engine broken or do I have to change the code? You have to change your code; you got lucky in 5.5. Nothing in the API seemed to indicate any changes needed Yes, the doc could be improved here. You could create a FAQ/Wiki entry based on your findings. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
a href to another JSP
Hi, I have an index.jsp page with 3 links to other JSP's. These links don't seem to work. I get the 404 error. Do I have to register the JSP's somewhere similarly to how I create servlet mappings? in the href attribute I tried passing along both relative path - sine all my JSP's are in one directory called JSP under the app root so I wrote something like ./mission.jsp And I also tried giving the absolute path - /JSP/mission.jsp - no luck. Thanks.