@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException
	{
		HttpSession session = req.getSession();
		
		String keyword = (String) session.getAttribute("keyword");
		String imageSource = (String) session.getAttribute("imageSource");
		List<String> images = (List<String>) session.getAttribute("images");
		
		String path = req.getSession().getServletContext().getRealPath("/imageStore");
		
		System.out.println(path);
		File dir = new File(path, imageSource + "/" + keyword);
		
		if(!dir.exists())
		{
			dir.mkdirs();	
		}
		
		//long start = System.currentTimeMillis();
		
		String[] urlArray = null;
		
		for (int i = 0; i < images.size(); i++)
		{
			String url = images.get(i);
			int pos = url.lastIndexOf("/");
			
			String imageName = url.substring(pos + 1);
			
			File file = new File(dir, imageName);
			
			
			if(i % 5 == 0)
			{
				if(0 != i)
				{
					new SavaImagesThread(dir, urlArray).start();
				}
				urlArray = new String[5];
				
			}
			urlArray[i % 5] = url;
			
			//write2Local(url, file);
		}
		
		//long end = System.currentTimeMillis();
		//System.out.println("下载的时间：" + (end - start));
		
		resp.getWriter().print("success");
		resp.getWriter().flush();
		
	}