I'm creating a @RepositoryRestResource
and export it as rest service as follows:
@RepositoryRestResource(collectionResourceRel = "myContent", path = "myContent")
public interface MyContentRepository extends PagingAndSortingRepository<MyContentEntity, Long> {
}
Problem: when I request the content, I'm getting the following excerpt:
"content" : [ {
"value" : [ ],
"rel" : null,
"collectionValue" : true,
"relTargetType" : "com.domain.MyContentEntity"
} ],
Question: how can I prevent to expose the relTargetType
package and "real" domain name?
If you don't want relTargetType in the JSON at all:
@JsonIgnore
public String getRelTargetType() {
return relTargetType;
}
If you just want to hide the package:
public String getRelTargetType() {
return relTargetType.split("\\.")[2];
}
If you want to hide the package and return a different domain name:
public String getRelTargetType() {
return "AlteredDomainName";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With