package surc.test;

import java.io.IOException;
import java.io.PrintWriter;

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.JSONObject;

/**
 * Servlet implementation class CancelUpload
 */
@WebServlet("/cancelUpload")
public class CancelUpload extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public CancelUpload() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		PrintWriter out = response.getWriter();
		JSONObject obj = new JSONObject();
		String name = request.getParameter("name");
		
		obj.put("name", name);
		out.println(obj);
	}
}

@@ -891,162 +891,500 @@
  %7B%0D%0A
-%09%09PrintWriter out = response.getWriter();%0D%0A%09%09JSONObject obj = new JSONObject();%0D%0A%09%09String name = request.getParameter(%22name%22);%0D%0A%09%09%0D%0A%09%09obj.put(%22name%22, name
+%0D%0A%09%09// please add this segment to all your current servlets and your%0D%0A%09%09// servlets creating in the future.%0D%0A%09%09response.setContentType(%22application/json;charset=utf-8%22);%0D%0A%0D%0A%09%09PrintWriter out = response.getWriter();%0D%0A%09%09JSONObject obj = new JSONObject();%0D%0A%0D%0A%09%09// get the name of file that will be deleted.%0D%0A%09%09String name = request.getParameter(%22name%22);%0D%0A%0D%0A%09%09// Remove the file from both the file list in session and the hard%0D%0A%09%09// drive.%0D%0A%09%09System.out.println(name);%0D%0A%0D%0A%09%09obj.put(%22status%22, %22ok%22
 );%0D%0A

Add Example for Cancel Upload