projects/positioning/backend/src/main/java/io/v/positioning/GpsLocationServlet.java
/**
     * Processes a GET request and returns device's GPS location
     *
     * @param req  The servlet request that includes <b>"androidId"</b> parameter
     * @param resp The servlet response with lat/long information
     */
Processes a GET request and returns device's GPS location
@param req  The servlet request that includes "androidId" parameter
@param resp The servlet response with lat/long information
Processes a GET request and returns device ' s GPS location @param req The servlet request that includes " androidId " parameter @param resp The servlet response with lat / long information
@Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {
        resp.setContentType("text/plain");
        DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
        Query.Filter propertyFilter = new Query.FilterPredicate("androidId", Query.FilterOperator.EQUAL, req.getParameter("androidId"));
        Query q = new Query("gps").setFilter(propertyFilter);
        Entity e = datastore.prepare(q).asSingleEntity();
        if (e == null) {
            resp.getWriter().println("Missing location for the given androidId.");
        } else {
            resp.getWriter().println("(" + e.getProperty("latitude") + ", " + e.getProperty("longitude") + ")");
        }
    }
@ Override public void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws IOException { resp . setContentType ( "text/plain" ) ; DatastoreService datastore = DatastoreServiceFactory . getDatastoreService ( ) ; Query . Filter propertyFilter = new Query . FilterPredicate ( "androidId" , Query . FilterOperator . EQUAL , req . getParameter ( "androidId" ) ) ; Query q = new Query ( "gps" ) . setFilter ( propertyFilter ) ; Entity e = datastore . prepare ( q ) . asSingleEntity ( ) ; if ( e == null ) { resp . getWriter ( ) . println ( "Missing location for the given androidId." ) ; } else { resp . getWriter ( ) . println ( "(" + e . getProperty ( "latitude" ) + ", " + e . getProperty ( "longitude" ) + ")" ) ; } }
Processes a GET request and returns device's GPS location
 @param req  The servlet request that includes <b>"androidId"</b> parameter
 @param resp The servlet response with lat/long information
Processes a GET request and returns device ' s GPS location @param req The servlet request that includes <b > " androidId " < / b > parameter @param resp The servlet response with lat / long information