Hmm, apparently the code was filtered out but is included here:
http://tapestry.1045711.n5.nabble.com/XHR-isXHR-shortcut-tp3353416p5713607.html 

I'll try posting it again:

// Code begin
public class ZoneWorker implements ComponentClassTransformWorker2 {
        protected Request request;

        public ZoneWorker(Request request) {
                this.request = request;
        }

        public void transform(PlasticClass plasticClass, TransformationSupport 
support, MutableComponentModel model) {
                // Find Zone's getBody method
                PlasticMethod getBody = null;
                if (plasticClass.getClassName().equals(Zone.class.getName())) {
                        for (PlasticMethod method : plasticClass.getMethods()) {
                                if 
(method.getDescription().methodName.toLowerCase().equals("getbody")) {
                                        getBody = method;
                                        break;
                                }
                        }
        
                        getBody.addAdvice(new MethodAdvice() {
                                public void advise(MethodInvocation invocation) 
{
                                        if(request.isXHR()) {
                                                // Proceed to Zone's getBody 
method
                                                invocation.proceed();
                                        } else {
                                                // Override to return null and 
trigger full page render
                                                invocation.setReturnValue(null);
                                        }
                                }
                        });
                }
        }
}
// Code end

Best regards,
Jacob


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to