cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Mansfield <...@dm.cobite.com>
Subject limiting jaxb marshalled object graph based on depth or by property
Date Wed, 19 Sep 2012 22:55:40 GMT
Hi All.

I can see this has been discussed before, but the thread ended before 
any solution was proposed.

My issue is that I have an object (from hibernate) which has 
"associations" (properties) which if followed probably end up 
referencing my entire database.

By association, I mean an object property which holds a reference to 
another object or collection of objects, except that the actual object 
is probably a "lazy proxy" for the real object (or collection).  If any 
lazy proxies are accessed on the object, hibernate will either fetch the 
object from the DB on demand or throw an exception if the session is closed.

I need to be able, on a per service-method basis, limit the depth (or 
set of properties) of the object graph traversal.  For example, if I 
have a collection of "Order" objects to return, I don't want the 
"lineItems" property, but if I'm returning a single "Order", then I do 
want it.  (Like a dynamic XmlTransient).

Note: I don't want to solve the LazyInitializationException  by keeping 
the session open as other users may have requested, I need to limit the 
graph traversal.

I see the DepthRestrictingStreamInterceptor but seems to be an "in" 
interceptor to limit the exposure to denial of service from large or 
maliciously formed XML object graphs.  I need the reverse.  Can it be 
used for this purpose with or without some modification?  Is there 
anyway to affect the way the jaxb marhsalling happens dynamically?

-- 
Thanks,
David Mansfield
Cobite, INC.


Mime
View raw message