Add 'static' indicator near start of URL for static resources to allow fast detection by filters ------------------------------------------------------------------------------------------------
Key: WICKET-4343 URL: https://issues.apache.org/jira/browse/WICKET-4343 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 1.5.4 Environment: Any Reporter: Chris Colman Priority: Minor While it is possible to affect the 'prefix' of static package resource URLs this prefix appears near the end of the URL, after the namespace, resource identifier, full path name and class name. Adding a prefix towards the end of the URL that distinguishes static resources so that third party filters can detect them and avoid establishing a session means each filter needs to perform full scan of every URL it receives to test if the 'prefix' is present. It's substantially quicker to test the first few chars of a URL string for a match with 'startsWith' than it is to iterate through to almost the end of each URL string to see if it 'contains' a substring. Any URL will fail to match on comparison of the first character if they don't have a 'w' (to match wicket/resource) at the beginning which makes startsWith a 'fast fail' test for most URLs it processes. I think that's probably why the Servlet Spec chooses to do filter and servlet path matching via a 'starts with' strategy without support for wildcards except at the very end of a pattern. Many of the URLs requested are very long and it would be preferable if wicket and third party filters could avoid string parsing of many thousands of super long URLs wherever they can - there's already enough of that going on without adding to the CPU's work load. Looking at the code it would probably be easy to do in BasicResourceReferenceMapper.java. Maybe to not disturb the number of segments used for resources it could be less invasive to change the start path of resources guaranteed to be stateless/static (not requiring a session to service requests for) it could simply replace the second segment provided by the getResourceIdentifier() so that the path ends up as /wicket/static-resource if static and /wicket/resource if not static. Perhaps getResourceHandler could take boolean static parameter. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira