Questions tagged [dynamic-proxy]

A Dynamic Proxy is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface.

A Dynamic Proxy is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface. Thus, a dynamic proxy class can be used to create a type-safe proxy object for a list of interfaces without requiring pre-generation of the proxy class, such as with compile-time tools. Method invocations on an instance of a dynamic proxy class are dispatched to a single method in the instance's invocation handler, and they are encoded with a java.lang.reflect.Method object identifying the method that was invoked and an array of type Object containing the arguments.

Dynamic proxy classes are useful to an application or library that needs to provide type-safe reflective dispatch of invocations on objects that present interface APIs. For example, an application can use a dynamic proxy class to create an object that implements multiple arbitrary event listener interfaces (interfaces that extend java.util.EventListener) to process a variety of events of different types in a uniform fashion, such as by logging all such events to a file.

226 questions
1
vote
2 answers

Failing to send data from Action Controller to AJAX Caller ,Serializing context model of a dynamic proxy property

I'm trying to send the queried data gathered from the context back to the ajax caller with the following status 1-The source code server side succeeds querying the data. 2-The source code server side succeeds sending the data in case HTTPPOST or…
1
vote
0 answers

Instantiating and binding Dynamic Proxy Binding from a complex data source with Automapper, Linfu, Clay or ImpromptuInterface

I need to construct an Immutable Complex Dynamic Proxy class from an anonymous type, json or Dictionary Given I have a public interface ICommand { Guid AggregateId { get; } } public interface IChangeDetails : ICommand { Name Name { get;…
1
vote
1 answer

Intercept static methods with cglib

I am working on dynamic proxy creation on concrete classes. Since java's plain Proxy class does help only with Interfaces , I chose CGLIb. I am using Enhancer class with MethodInterceptor for intercepting the methods of my proxy and I am able to…
Suresh Anbarasan
  • 943
  • 1
  • 8
  • 20
1
vote
1 answer

Is is possible to proxy a COM interface using Spring.Net?

I am trying to create a dynamic proxy using Spring.NET and C# for a COM interface. I am currently experimenting using code, not config files. I have code similar to the following: Type comInterfaceType = typeof(ICOMInterface); ProxyFactory…
Matt H
  • 7,311
  • 5
  • 45
  • 54
1
vote
2 answers

Proxy not getting attributes on virtual properties?

Using DynamicProxy 2.2 I think I'm seeing this issue: "Inheritable attributes on virtual properties not available on proxy" http://support.castleproject.org/projects/DYNPROXY/issues/view/DYNPROXY-ISSUE-109 I've got a base class with a virtual…
PatrickSteele
  • 14,489
  • 2
  • 51
  • 54
1
vote
1 answer

Getting implemented interfaces from the proxy

You normally crate a proxy using val proxy = Proxy.newProxyInstance(ClassLoader, Class[] interfaces, handler) I am interested in the second parameter because I save created proxies in a list and I want to recreate the proxy with the same…
1
vote
1 answer

aop performance on spring (idk, aspectj)

I tried to test the performance of AOP on Spring framework 4.1.6 and AOP methods were clean, jdk dynamic proxy and aspectJ. I made one to five simple advices to them and checked elapsed time for each. result: jdk dynamic proxy: aspect1: 2.499…
jongseok
  • 153
  • 2
  • 9
1
vote
1 answer

Handling AOP reflective proxies: "object is not an instance of declaring class"

My application needs to perform dynamic invocation on Spring bean. I scan a Spring bean for methods annotated with a custom annotation and store the reference to the Method object for future invocation. public Method getMethod(Class clazz, final…
usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305
1
vote
1 answer

Unknown exception when calling a webservice

I have in my system two WCF webservices. The webservice A calls the webservice B. Most part of the time, it works properly. But sometines, an exception in A is raised when it calls B : Exception has been thrown by the target of an invocation. In…
BaptX
  • 561
  • 1
  • 7
  • 21
1
vote
1 answer

Dynamic, reflective SignalHandler in Java

How do I install signal handling logic iff sun.misc.Signal is available? Background First generation of my code, which assumed signal handling availability, looked something like this: class MyApp { public static void main(String[] args) { …
pilcrow
  • 56,591
  • 13
  • 94
  • 135
1
vote
1 answer

c# entity framework changing the contents of my lists

I'm getting a really strange glitch and I believe entity framework is to blame. Here's the basic scenario thats going on. I have an entity object, Foo, with a navigation property collection, Bar. Foo in this context is being tracked by entity…
Vance Palacio
  • 1,280
  • 12
  • 17
1
vote
2 answers

Binding proxy for remote Object in java RMI

I would implement a security layer for java RMI, with dynamic proxy mechanism. I've some class with remote interface that bind in rmi registry, now I'm coding a class SecurityInvocationHandler, code below: import…
Andrew
  • 13
  • 1
  • 4
1
vote
1 answer

Intercept only interface methods with DynamicProxy

I got an interface like this public interface IService { void InterceptedMethod(); } A class that implements that interface and also has another method public class Service : IService { public virtual void InterceptedMethod() { …
Rafael Mueller
  • 6,028
  • 3
  • 24
  • 28
1
vote
1 answer

Navigation Properties on Post Action

I need to access navigation properties on a post edit action but the current way I did that looks not the best alternative as I make a call to database and "reupdate" the model. Is there a better solution? public class Foo { public int Id { get;…
1
vote
2 answers

Metadata contains a reference that cannot be resolved The remote server returned an error: (401) Unauthorized

I have windows service which access Microsoft Dynamics CRM 2011. I have a problem windows service giving exception when it trying to connect to CRM 2011. It works fine when we run service directly from server. I have an administrator privileges on…
adeel
  • 35
  • 1
  • 2
  • 7