I'm using the JacksonJsonProvider to perform json serialization of my
objects.
public class MyClass {
private long myId;
private String firstName;
private String lastName;
// ... getters and setters for all
}
@Path("myresource")
public class MyResource {
@GET
public MyClass getTestObject() {
MyClass testObj = new MyClass();
// ... set test values.
return testObj;
}
}
Now, for the purposes of my restful interface, I would like to swap out the
serialization for the 'myId' field, and replace it with a URI built via the
UriBuilder class.
I think I will need to create a custom (jackson) serializer to perform this
serialization, but I will somehow need to get a reference to the UriBuilder
from the jersey framework in order to perform the URI construction, correct?
Any idea how I might wire all of this together? I found docs on the custom
serializers, and I can register them with the JacksonJsonProvider or via
annotations, but those bindings are done at initialization time.
Is the UriBuilder instantiated per request, or also at initialization time?
how would I get a reference to the uribuilder in the customer serializer?
Thanks,
James
--
View this message in context: http://jersey.576304.n2.nabble.com/Replacing-IDs-with-URIs-in-Jersey-Jackson-tp5911742p5911742.html
Sent from the Jersey mailing list archive at Nabble.com.