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
1 answer

can you use castle dynamic proxies on web services references?

Is it possible to create a dynamic proxy on the a web service reference that has been added to a visual studio project? I've added the web service reference in the normal way and tried to create a dynamic proxy using castle to wrap the method…
Marty Henderson
  • 105
  • 3
  • 9
1
vote
1 answer

javassist exception

public class PracticeJavassist2 { @Test public void test2() throws InstantiationException, IllegalAccessException{ ProxyFactory factory = new ProxyFactory(); factory.setSuperclass(JavassistClass.class); // …
vincen
  • 13
  • 3
1
vote
2 answers

What are Proxy in the Reflection API good for?

I am learning the concepts of reflection and I am reading "Java Reflection In action" book. I have just started with the chapter "Proxy" where it says "a proxy, that supports the interface of another object, its target, so that the proxy can…
1
vote
1 answer

How to create dynamic proxy with Spring and Java

I have this situation: I have one interface Service which aggregates all service interfaces. So for example if I have two interfaces ILoginService1 and ILoginService2 the Service interface looks like this Service extends…
Xoke
  • 984
  • 2
  • 11
  • 17
1
vote
2 answers

Recommend a proxy server which has reverse proxy function

In my application, both the server and client are hosted by myself, each client has a configuration which can configure the server it should connect, the communication is based on HTTP. Now, I get a requirement that the connect server of client…
Xilang
  • 1,513
  • 3
  • 18
  • 36
1
vote
0 answers

How do I configure ninject to return a dynamic proxy of T?

I have a class UserModel I want to proxy it for caching. So i've set up public class UserModelCached:DynamicProxy via http://greenicicleblog.com/2010/02/21/piece-of-proxy-cake/ Now I want Ninject to still be able to create a UserModel but…
Maslow
  • 18,464
  • 20
  • 106
  • 193
1
vote
1 answer

Dynamic retry proxy

Consider the below, which works: public interface IService { void DoSomething(object arg); void DoSomethingElse(object arg, bool anotherArg); bool AndDoYetMoreStuff(object arg, object[] moreArgs); } public class Service : IService { …
Myles McDonnell
  • 12,943
  • 17
  • 66
  • 116
1
vote
0 answers

WCF using proxy objects on the server during deserialization

I'm trying to keep track of changed properties on a PUT request in WCF (we're doing REST instead of SOAP). I have an idea that I'm trying to vet, but I can't get past this one piece. At some point when the request is coming in, the body (JSON, XML,…
kelloti
  • 8,705
  • 5
  • 46
  • 82
0
votes
3 answers

How does Castle Project's DynamicProxy make code easier to maintain when the concern is not cross-cutting?

Not sure if i'm naming it correctly (i.e. nested interface implementations). However I do not understand the benefit of using dynamic proxy over nested interface implementations. How is dynamic proxy better than doing what the sample code below…
Charles Lambert
  • 5,042
  • 26
  • 47
0
votes
0 answers

struts2 - spring integration without struts2-spring plugin

I want to know how spring bean(PersonService) object is assigned to setPersonService method without using struts-spring plugin, I got JdkDynamicAopProxy keyword when I try to trace the action class method(setPersonService ). But I don't have any…
Arun
  • 1,167
  • 18
  • 37
0
votes
0 answers

Jackson JSON with Dynamic Proxy

I have a class which I'm trying to serialize with Jackson and it is wrapped in a dynamic proxy that does Hibernate method validation. What is the best way to get Jackson to ignore my Method validation proxy?
0
votes
1 answer

Applying Current Values from a POCO to a DynamicProxy gives an error on complex objects

I have an MVC3 project that is using an EF4 project as its Domain. The Domain is a Model first project that uses T4 to build POCO objects. There are several ComplexTypes at play in the Domain and everything works great as long as I use the proxies…
0
votes
0 answers

Why cglib generate the fastclass of the target class?

cglib generate 3 class:proxy、proxy fastClass、target fastClass,what is the purpose of target fastClass? as the description..
Leon
  • 1
0
votes
1 answer

Different between CGLIB proxy and JDK proxy on Spring AOP perspective

Baeldung has this section: this limits matching to join points where the bean reference is an instance of the given type, while target limits matching to join points where the target object is an instance of the given type. The former works when…
SoT
  • 898
  • 1
  • 15
  • 36
0
votes
1 answer

How to debug when a JDK or CGLIB dynamic proxy will be used in Java by Spring Boot?

I've hit an issue where adding an annotation to a class produces a proxy error Bean named 'XXXX' is expected to be of type 'xxxx.XXXX' but was actually of type 'com.sun.proxy.$Proxy223' For further details see How to enabled CGLIB proxies on…
Shane Gannon
  • 6,770
  • 7
  • 41
  • 64