Question: package com.dronerecon.ws; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.security.SecureRandom; /** * * @author Hanlin Jin */ public class DroneDataService extends HttpServlet{ public
package com.dronerecon.ws; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.security.SecureRandom; /** * * @author Hanlin Jin */ public class DroneDataService extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json;charset=utf-8"); response.addHeader("Access-Control-Allow-Origin", "*"); PrintWriter out = response.getWriter(); String area_id = request.get('area_id') String tilex = request.get('tilex') String tiley = request.get('tiley') String totalcols = request.get('totalcols') String totalrows = request.get('totalrows') String sDirection = "right" // ############################## // 1. Calculate next drone move. // Determine next tile to move to. // Base this on current x and y. // Change sDirection if necessary. // Drone must serpentine from top left of grid back and forth down. // If rows are done, change sDirection to "stop". // ############################## // ############################## // 2. Format & Return JSON string to caller. /* Return via out.println() a JSON string like this: {"area_id":"[area id from above]", "nextTileX":"[next tile x]", "nextTileY":"[next tile y]", "direction":"[direction string from above]"} */ // ############################## } } Please just type the code in this unfinished code, I want to see the whole complete code with question. Thank you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
