App Engine có một dịch vụ, hình ảnh dịch vụ, có thể được thừa hưởng để thao tác hình ảnh. Để chứng minh làm thế nào để sử dụng dịch vụ này, chúng tôi sẽ hướng dẫn bạn qua việc tạo ra một servlet cơ bản mà sẽ lật hình ảnh tải lên trên trục thẳng đứng. Bạn sẽ tiếp tục xây dựng trên cùng một dự án Eclipse, nhưng bạn cần phải thêm một số thư viện nhiều hơn: 1. | CHAPTER 8 APP ENGINE SERVICES catch MalformedURLException e .println catch lOException e .println You can use URL Fetch to retrieve and parse XML documents call RESTful web services and read RSS feeds. If you want to look at a REST-based web service example set the URL to http findNearby lat lng 9. This is an example of an XML-based web serviceXML-based web service that exposes a public REST API to return nearby country codes. Next you ll take a quick look at another App Engine service for manipulating images. Images Service App Engine has a service Images service which can be leveraged for image manipulation. To demonstrate how to use this service we ll walk you through the creation of a basic servlet that will flip uploaded images on the vertical axis. You ll continue to build on the same Eclipse project but you need to add some more libraries 1. This example uses the Apache Commons FileUpload package. Start by downloading that package from the following location http fileupload. We re using Version for this example. Download and unzip the binary distribution of the package. 2. Drag the file from the lib directory into the WEB-INF lib directory on the Eclipse Package ExplorerEclipse Package Explorer of your project. 3. Right-click the file in the Eclipse Package Explorer and select Build Path Add to Build Path. 4. You also need to use the Apache Commons IO library. Repeat the previous steps after downloading Commons IO from http io. We re using version for this example. 178 CHAPTER 8 APP ENGINE SERVICES Creating the Java Classes Now that the prerequisite libraries have been set up in your project you ll need four new Java classes in order to leverage the Images service. Create a new servlet called ImageTransform. See Figure 8-6 for more information on the options you chose in the New Java Class .