I"m working with a third party application that use restlet.org's library for mapping restful urls to spring beans. It generates the follow pattern to match a very simple url:
url pattern - /api/0/full/{action}/{paramsJSON}
generated regex pattern
/api/0/preauthfull/((?:[a-zA-Z\d\-\.\_\~\!\$\&\'\(\)\*\+\,\;\=\:\@]|(?:\%[\dABCDEFabcdef][\dABCDEFabcdef]))+)/((?:[a-zA-Z\d\-\.\_\~\!\$\&\'\(\)\*\+\,\;\=\:\@]|(?:\%[\dABCDEFabcdef][\dABCDEFabcdef]))+)
It fails as soon as the pattern is over around 220 characters. Interestingly enough, this only fails in the tomcat server environment, not jetty, even though they're both running with the same jre. I'm a bit at a loss of how to correct this, the regex is built dynamically by restlet-
You may be running into a problem with the default stack size for threads. This is a known issue with java.util.regex.Pattern, it's about too deep recursions, never tried, to be honest, to look deep into what's going on inside this thing, just try to increase JVM stack size like
java -Xss1024k
until Pattern is happy