Hi,
I haved wondered what is the best way to have resources with responses only having URIs to subresources or associated resources.
For example the response of a mainresource:
-------------------
<mainresource>
<id>1</id>
<name>Test</name>
<uri>
http://localhost:8080/mainresources/1</uri>
<subresources>
<subresource uri="
http://localhost:8080/mainresources/1/subresources/1" />
<subresource uri="
http://localhost:8080/mainresources/1/subresources/2" />
<subresource uri="
http://localhost:8080/mainresources/1/subresources/3" />
<subresource uri="
http://localhost:8080/mainresources/1/subresources/4" />
</subresources>
<associatedresource uri="
http://localhost:8080/associatedsource/1" />
</mainresource>
-------------------
and the response of one subresource:
-------------------
<subresource>
<id>2</id>
<uri>
http://localhost:8080/mainresources/1/subresources/2</uri>
<name>SubresourceTest</name>
<description>A description</description>
</subresource>
-------------------
I've tried many different ways, but there where always points I couldn't get further.
One try was the @Ref annotation in jersey-server-linking. But I always ended up in a loop of exceptions with the following stacktrace:
-------------------
29.11.2010 23:37:57 com.sun.jersey.server.linking.impl.FieldDescriptor getFieldValue
SCHWERWIEGEND: null
java.lang.IllegalAccessException: Class com.sun.jersey.server.linking.impl.FieldDescriptor can not access a member of class java.util.zip.ZipConstants with modifiers "public static final"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.reflect.Field.doSecurityCheck(Field.java:960)
at java.lang.reflect.Field.getFieldAccessor(Field.java:896)
at java.lang.reflect.Field.get(Field.java:358)
at com.sun.jersey.server.linking.impl.FieldDescriptor.getFieldValue(FieldDescriptor.java:66)
at com.sun.jersey.server.linking.impl.RefProcessor.processLinks(RefProcessor.java:113)
at com.sun.jersey.server.linking.impl.RefProcessor.processMember(RefProcessor.java:120)
at com.sun.jersey.server.linking.impl.RefProcessor.processLinks(RefProcessor.java:113)
at com.sun.jersey.server.linking.impl.RefProcessor.processMember(RefProcessor.java:120)
at com.sun.jersey.server.linking.impl.RefProcessor.processLinks(RefProcessor.java:113)
...
at com.sun.jersey.server.linking.LinkFilter.filter(LinkFilter.java:78)
-------------------
even if no @Ref annotations are used, only with the ContainerResponseFilter property activated.
I hope you can point me to the right direction.
Thanks
Tristan