View Full Version : using a custom constraint in 4.0
04-13-2010, 08:54 AM
May I know what's the syntax to put in a custom constraint in 4.0 resin-web.xml?
http://www.caucho.com/resin-3.0/config/webapp.xtp#constraint doesn't seem to work anymore, and I couldn't find the documentation for 4.0
The Resin 4.0 docs should be up again soon, but to answer your question, you can construct constraints using our new integrated rewrite & security framework. For example, if you wanted to restrict a page based on the remote user, you might do:
If you need a custom predicate, you can write one by implementing com.caucho.rewrite.RequestPredicate (http://www.caucho.com/resin-javadoc/com/caucho/rewrite/RequestPredicate.html), then using a <resin:Redirect> or <resin:Forbidden> tag to respond.
Let me know if that covers the case you had in mind. If not, I can give more specific suggestions.
04-15-2010, 04:30 AM
I have created a class implementing com.caucho.rewrite.RequestPredicate. It works perfect :D
Thanks for your help.
04-15-2010, 06:27 AM
I got a related question. In my application, I need to put in a normal javax.servlet.Filter to do RequestDispatcher.forward(). I noticed that <resin:Forbidden> will only be called after the normal filters, whereas <Allow> will be called before the normal filters. Is that correct?
vBulletin® v3.8.6, Copyright ©2000-2017, Jelsoft Enterprises Ltd.