How to properly communicate with Servlets from Angular

I am attempting to fetch data from a servlet, and call such servlet from an angular Controller. However the controller doesnt seem to be reaching the servlet.

I set a couple of error messages (instead of debugging) and i see that the function is executed, but the servlet is not reached (always getting the “unable to find” Message).

Is it possible the pathing im using is incorrect? I tested with a / at the start, and also using the full path (localhost/project/servlet).

ANgular Controller


app.controller("userController", function($scope, $http){

    $scope.error = "NOT EXECUTED";
    var onSuccess = function(response){
        $scope.users = response.data;
        $scope.error = "EXECUTED BUT NOT PROPERLY";
    };
    var onError = function(response){
        $scope.error = "unable to find the record";
    }
    var con = $http.get("UserListServlet");
    con.then(onSuccess, onError);

})

Servlet

package servlets;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONArray;

import com.google.gson.Gson;

import elementos.Usuario;


@WebServlet(value="/UserListServlet")
public class UserListServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;


    public UserListServlet() {
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        Database db = Database.getInstance();
        ArrayList<Usuario> usersList = db.getUsuarios();

        JSONArray arrayObj = new JSONArray(usersList);
        String jObj = new Gson().toJson(arrayObj);

        response.setContentType("text/html");
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write(jObj);


    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }

}

My goal is to get the data from the servlet so i can easily display it on my Home Page.

Source: AngularJS