-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Garey,
On 9/12/13 4:14 PM, Garey Mills wrote: > I'm running Apache Tomcat Version 7.0.29. I have inserted a Remote > Address filter into server.xml inside of the <Host> tag. It is not > blocking addresses that are not in <Allow>. :( > I am using the Remote Address filter because I want to allow > access only to addresses in our institution's community. This is a > large institution and we have 4 or 5 class B address ranges, maybe > 10 class Cs, and a number of broken ranges. The regular expression > runs to 8181 characters without doubling up on \. It does, however, > work in a test Java class that I wrote, correctly allowing and > disallowing a test group of addresses. > > One question I have is that the example in > > http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Remote_Address_Filter > > has single backslashes, but in order to make the pattern work in > my test class, I had to double up on the slashes. This is a Java-source issue: Java requires you to \-escape "\" characters because the "\" is itself an escape character in Java source. If you are configuring Tomcat via XML (i.e. conf/server.xml), then the double-\ characters are not necessary: only a single \ is required. > I took a look at the RequestFilter code, and it looks like the > pattern string is just passed to Pattern.compile, so the pattern in > the filter should need double slashes. No. The double-\ is removed by the compiler, so at runtime both the XML and hard-coded strings end up only having single-\ in their text. > I've tried it both ways and neither worked. > > Anybody have any idea about what might be going wrong? Can you give us a very small snippet of the pattern you are using in conf/server.xml? - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJSMx2YAAoJEBzwKT+lPKRYBqgP/2RTeTPQHgDqWrZfuswRVRUb /dBiwxKTm/0UvQexosCgws1eQ8IcDghrYBqxPx1o82aQgneEmyaCDdAQ2nYTKtyz hDpre2wzaQI3teD2zXtmJ/uCDzsYTMw9SjK0iX0U4jRWoV6fnM3Y8a4eb/rtmUh+ eqEESBosVL59TNnYJUv9oDZ3PZVgwaAinAl7K1CBflsvx/rZh0r4PwUozuPW7grc iVocgo0vQyxamifASFayuF16QjjvID3doO3tg7LjueFMO+qL4wWRCy/g2QyZcIw2 0Gvx4UBdAoihau6EoMMyjwszGUsWad6ukCMQNZpFwFVQwyfWni2NfiEtWvOUqCRg gy/R2pMtGQKopTzvzVC+U+pt6fosujxRKpkowFbLT0Igfruzo0SZvyDTiPg12hBe f1ya4X7T6pTXOfYLwIAi/WYVs3yzp//nMwj/TcBphm5ReuOKHjHljeYR38pYzGgy Zy7qU3zvb0nnJARJuNjMheujtfh6lJLsmw++Xu3qfmTr4xzZBRatSlKC5BOsIMQY xNWPdkVn5R+7PkCOEh7x7oLL/LUi9kf7pb9fGWqGyGXN9Zet3qqRV0KYWKKrgSDh 2e6gf5TdPSnH8B7RHUQMqjfvG1Ojmk//HiMKeDTKsfhri0BeW2QIvshLsBPssZZj pda+uu3reuYLgIS9IRSI =Db9j -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org