使用Java建立GAE專案

GAE使用Java的Java Servlet API建立網路應用程式。
要做一個簡單的回應,建立一個繼承於 javax.servlet.http.HttpServlet的類別。
在新建立的類別中複寫doGet()或doPost()方法。
範例程式碼:

package guestbook;
 
import java.io.IOException;
import javax.servlet.http.*;
 
public class HelloWorld extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {
        resp.setContentType("text/plain");
        resp.getWriter().println("Hello, world");
    }
}