I've been building a REST Web service, deployed in Tomcat7, with Java; and client with HTML/AngularJS.
@GET
@Path("/hello")
@Produces("plain/text")
public Response hello(){
String hello="hello";
return Response.status(Status.OK).entity(hello).build();
}
This simple method in server side seems to be working when invoked from browser using right URL (http://localhost:8080/some-path/hello) and gives hello as plain text.
Everthing seems right in Tomcat log files as well.
But, with this piece of code,
$http({
url: 'http://localhost:8080/some-path/hello',
method: 'GET'
}).then(
function (response){
$scope.passCheck = response.data;
},
function (response){
$scope.passCheck = response.status ;
}
);
I'm getting -1 status code (Always second response function executes).
Could anyone help me with this?