interceptor

How might you implement the interceptor pattern on client-side (browser) AJAX request/response pairs?

Let me start with a real-life use case: DWR is getting confused when server-side authentication filters attempt to redirect AJAX requests to the login page due to an expired session. You'd like to add some filters so that Requests whose HTTP status code equal 3xx execute a client-side redirect, like window.location = ...login.html Req...

Intercepting or renaming a method call in Grails / Groovy

I'm trying to intercept a method call (afterInsert() of a domain class) in a Grails application. In doWithDynamicMethods closure of my plugin I have: for (dc in application.domainClasses) { // What I'm basically doing is renaming method A to B // and creating a new method A with its own business logic // and a call to B() at...

nhibernate dynamically bind a class

Hey, So I may be completely off the mark here but I'm still new to nhibernate so bare with me. I've read this article http://www.mattfreeman.co.uk/2009/01/nhibernate-21-trunk-entity-name-some-inheritance-and-dynamic-component/ And am looking for a way to dynamically change my mapping at runtime to bind to a different table using a on...

Access custom attribute on method from Castle Windsor interceptor

I am trying to access a custom attribute applied to a method within a castle interceptor, e.g.: [MyCustomAttribute(SomeParam = "attributeValue")] public virtual MyEntity Entity { get; set; } using the following code: internal class MyInterceptor : IInterceptor { public void Intercept(IInvocation invocation) { if (invo...

Am I allowed to declare a lifecycle interceptor on an interceptor?

I have my business bean defined thus: @Local @Interceptors(BusinessInterceptor.class}) public class MyBean implements SomeBean { ... } And then I want my BusinessInterceptor to be configured with Spring's SpringBeanAutowiringInterceptor: @Interceptors(SpringBeanAutowiringInterceptor.class) public class BusinessInterceptor { @Auto...

[Castle-DynamicProxy] What really interceptors do with my c# class?

I was asked to implement castle dynamic proxy in my asp.net web application and i was going through couple of articles which i got from Castle Project and Code Project about castle dynamic proxy in asp.net web application.... Both articles delt with creating interceptors but i can't get the idea why interceptors are used with classes.....

NHibernate: update item in list from an Interceptor

hi When i try to update a property on a item that is in a list from an interceptor, the update is not persisted. Is this possible at all? or am i doing something wrong? The child is mapped as a list of composite elements. The context is, i am trying to enforce read consistency for aggregates using Read committed isolation level and ...

NInject2 Interceptor usage with NHibernate transactions

Hello, In my previous project we used NHibernate and Spring.NET. Transactions were handled by adding [Transaction] attribute to service methods. In my current project I'm using NHibernate and NInject 2 and I was wondering if it's possible to solve transaction handling using "Ninject.Extensions.Interception" and similar [Transaction] ...

Method interception in PHP 5.*

Hi everybody, I'm implementing a Log system for PHP, and I'm a bit stuck. All the configuration is defined in an XML file, that declares every method to be logged. XML is well parsed and converted into a multidimensionnal array (classname => array of methods). So far, so good. Let's take a simple example: #A.php class A { publ...

Interface design pattern / Java / Seam

Hi all, Is this possible somehow? @Name("geolocationService") public interface GeolocationService { @Query("SELECT g FROM Geolocation geolocation INNER JOIN geolocation.deployment deployment WHERE geolocation.ipStart <= INET_ATON(:ipAddress) AND deployment.active = TRUE") Geolocation findByIpAddress(@NamedParameter("ipAddress")fi...

In Castle Windsor, can I register a Interface component and get a proxy of the implementation?

Lets consider some cases: _windsor.Register(Component.For<IProductServices>().ImplementedBy<ProductServices>().Interceptors(typeof(SomeInterceptorType)); In this case, when I ask for a IProductServices windsor will proxy the interface to intercept the interface method calls. If instead I do this : _windsor.Register(Component.For<Pr...

Can I specify to Castle Windsor which virtual methods to override in a class proxy?

I have many virtual methods in a class, but only one should be intercepted, Can I tell Castle Windsor to override only that method so I dont have to do validation in the Intercept method? Edit: I use the IKernelEvents.ComponentRegistered event to choose which types get the interceptor. ...

Castle interceptor does not intercept a method on an MVC Controller during unit test

I have a .net test class. In the Initialize method, I create a windsor container and make some registrations. In the actual test method, I call a method on the controller class but the interceptor does not work and the method gets directly called. What are potential reasons for this? Here is all the related code: Test.cs: private Some...

intercepting http traffic to/from Google Chrome

I use Fiddler for intercepting HTTP traffic when using IE or Firefox. Now that I'm using chrome for most of my day, I would like to be able to see the http traffic using something like Fiddler. What do chrome developers use ? I prefer something automatic like Fiddler but something that needs config, etc would also help. P.S : I'm on win...

Add objects to association in OnPreInsert, OnPreUpdate

Hi, I have an event listener (for Audit Logs) which needs to append audit log entries to the association of the object: public Company : IAuditable { // Other stuff removed for bravety IAuditLog IAuditable.CreateEntry() { var entry = new CompanyAudit(); this.auditLogs.Add(entry); return entry; } ...

nhibernate intercept select query

Hey, I'm looking at the nhibernate interceptor. It seems to be able to intercept save, update and delete queries but is there anyway I can intercept a select query. The problem I have is that I automatically want to append some additional sql filters to the executing sql statement in certain cases. Any thoughts Thanks Mat ...

Use cellular emulator with a REAL WinMo device?

I don't whether this is even possible which is obviously why I am asking this question :) Is it in any way possible to leverage functionality the Cellular Emulator on a REAL PHYSICAL device?? :) So when I test it on my device, I really do not have to send real SMS(s) to test my MessageInteceptor. On a sidenote, why does MessageIntecept...

Is is possible to intercept a static method on an object you don't own and did not create?

Referring to my possible answer to this question: http://stackoverflow.com/questions/2907535/how-would-you-audit-asp-net-membership-tables-while-recording-what-user-made-the/2911616#2911616 Is it possible to intercept a call, coming from code you do not own, to a ctor on a sealed internal class that you do not own with the intention of ...

Windsor OnCreated for all components

Hi, How would I go about globally intercepting the creation/resolution of all instances by my container? I know I can do this individually with OnCreated on a per-component basis, but I want to do this globally for all objects resolved by the container. Thanks. ...

Redirect to another action in an interceptor in struts 2

I am currently in the process of learning Struts 2 and I am currently building a simple application where unverified users are redirected to a login form. I have a login form and action functional which takes the users credentials, verifies them and stores a User object in the session however I am now trying to prevent access to pages b...