I am currently facing an issue with my Angular component that is supposed to make a simple HTTP Get request:
this.http.get<any>('http://localhost:80/userservice/login', { params: { username: this.model.username, password: this.model.password } })
.subscribe(
data => {
this.router.navigate(['/register']);
},
error => {
this.alertService.error(error.message);
this.loading = false;
});
Additionally, I have a Java webservice that should handle the request:
@GET @Produces( MediaType.APPLICATION_JSON ) @Path("/login")
public Response login(@QueryParam("username") String username, @QueryParam("password") String password)
{
return Response.status(Response.Status.OK).header("Content-type", "application/json").entity("test").build();
}
Despite the successful request being received and responded to by the Java server, Angular always encounters an error instead of processing the data subscription.
Error-Message: "Http failure response for (unknown url): 0 Unknown Error”
I have verified through breakpoints that the Java Server is correctly receiving and responding to the requests. Any insights on what might be causing this issue would be greatly appreciated. Thank you!