Reputation: 3825
Before you minus this question, you should know I searched for solution and didn't find it.
I want to return String by rest endpoint:
@GET
@Path("/getMyString")
@Produces({ MediaType.APPLICATION_JSON })
public Response getId() {
String s = "this is my string";
(...)
return Response.ok(s).build();
}
But in view I receive char array (result in firebug):
Resource { 0="t", 1="h", 2="i", more...}
In front I use angular resource like:
blablaResources.factory('AngularApp', [ '$resource', function($resource) {
return $resource(contextPath + '/.rest/v1/someService', {}, {
(... other methods ...)
getString : {
method : 'GET',
url : contextPath + '/.rest/v1/someService/getMyString'
}
});
} ]);
Is there any wrapper class for String or annotation to send it like:
Resource { value = "this is my string" }
or just normal
"this is my string"
Thanks for any constructive response :)
Upvotes: 3
Views: 14789