-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Mark,
On 10/14/19 04:50, Mark Thomas wrote: > On 13/10/2019 23:46, Garret Wilson wrote: >> On 10/13/2019 11:52 AM, Mark Thomas wrote: >>> That depends on how you define best. Simplest to implement? >>> Easiest to maintain? Minimum overhead? >> >> How about, "What best follows the spirit of the Tomcat >> architecture?" >> >> Or alternatively, "What would be most efficient (i.e. not slowing >> down normal requests)?" >> >>> >>> It also depends on how many redirects are you talking about as >>> well as what sort of % of the over all requests need to be >>> redirected. >> >> Let's say 100 resources need redirecting, to pick an arbitrary >> number. >> >> (The use case is simply to migrate some old URLs that have >> probably been indexed already or even linked on the web. >> Theoretically the entire site would need to redirect its old >> URLs, but probably only the pages.) > > For that use case I'd start with the RewriteValve. RewriteValve won't be the most efficient way to do this, because RewriteValve has its own overhead of mapping request URIs (and possibly other requirements) to arbitrary things-to-do. If you want it to be as fast as possible, then you need to write your own Servlet (or Filter), map all URIs-to-redirect to that servlet (in WEB-INF/web.xml) and then write Java code to do the mapping. The fastest possible implementation wouldn't be a bunch of "string".equals calls or a HashMap, but something more elaborate. But all that seems like a lot of work for something that CAN be accomplished by using RewriteValve, where you don't have to write new code and then baby sit it forever. > If you notice a performance impact then we should take a look with > a profiler and see if there is room for improvement in the > RewriteValve. If someone could write Javadoc for the org.apache.catalina.valves.rewrite.RewriteMap interface, that would be very helpful. I took a quick look at the code, and it's not clear to me what either of the two methods in that interface should actually do and/or return. Also, Substitution.SubstitutionElement#evaluate(). That would help with the above. Rémy, is that originally your code? git blame says most of the code was committed by you. - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl2lxw8ACgkQHPApP6U8 pFjMphAAw8fHxiPzgNSMY0cIlcCrDGSYeU78c0oMj+UDfqIprj2tDDOXmeJ8i2/o H7ngAzcuFeAm6G965KBa3brpS4phHj2q1ZRk1Ww5IQikYX0EeeHl+6LjI3r+irR9 cfm32Zlb8MWZ4JoqyGX2vhyzrlCokAXidlBhFLRMkP9gG6Bq1fICdTwpQ1/yTRVe FDqMVlbaBepB3mvZpbA2SH58+rz0wHPGZweZEo5KTFOUM0xqQ/2hxbdhJsRfAtbS muR1zyLBPhA8cNZYpUC88OhmNCoumI6laBdWcpZ3h9yMW/a7T5LnxeUCZNJxwdze MvYB8CFGC5h3a9DIcapkhAk3sebiFhWVXjQ0Icz3qK+RLoiKoDVH/YsG3RW20u+4 XDFSAij+GrfL49gc9P4nZ0sUfAOvZt7NlzbnB3z5qK2ybAQ5wEXboNBV0vrHEVgc hwnv7ShW7sKyv5ywjloscFABoGPfXbn43iiFT7fE09vVJnIRZZydHpqjhXQNSJPR 4N9lqsOnmiIVeuqC/IzY10QZoo1g3S6AnoqyX6mENuicOrWQbB1MRTgChdQdV8Xc w03shweUED8JW0LvJsFf089w1xlu4xJQkmoSFgU1DCCUnioKJcwXni1VQlyP3m5G Vfl4WKIm1HwX4fMyhaBX8JkxUBlt1/GCI8bG67IvcM0GtrV5wj8= =fBb1 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org