Closed serhiivinichuk closed 7 years ago
What type of method do you want to use on restClient
?
I think that if you have an image associated to you entity, the image URL must be returned by Server, and mapped on entity property.
Do you have a concrete example for your issue?
Here are some examples that I would use in my project
{
"_links": {
...
"preview": {
"href": "resource/id/preview",
"type": "image/*"
},
}
class SubResource extends HalResource { ... }
class Resource extends HalResource { ... createSubResource(data) { this.restClient.create(url, data, SubResource) } }
I'm sure there're other ways it can be useful.
I'm ok with the createSubResource
method.
But, for your image issue, base Url is not accessible on restClient
, it's not a property of HalRestClient
. Can you use resource.uri
instead? Or use a @HalProperty
and get uri like this resource.preview.uri
I figured out a way to deal with my images. Thank you. But having restClient
for additional requests is still useful enhancement, in my opinion.
I agree. It's done, you can upgrade to 0.2.3 version
It would be useful to make
HalResource.restClient
fieldprotected
instead ofprivate
. This allows to create additional method in model classes that will make some requests or use the base url. For example, request for images or other non-HAL resources.