2012-02-23 13 views
0

私は、Google App Engineを使用してJava上でWebアプリケーションを作成しようとしています。私はhttp-post要求を送信しているアプリケーションを持っています。簡単なhttp投稿要求を処理するGAE

  • このhttp-postリクエストを処理するにはどうすればよいですか?でURLに

    public class ExampleAppServlet extends HttpServlet{ 
        public void doPost(HttpServletRequest req, HttpServletResponse resp) { 
    
         // get some data from POST 
         InputStream input = req.getInputStream(); 
    
         // do something with input 
    
         // send back some reply 
         resp.getWriter().write("Hello Example App").close(); 
        } 
    } 
    
  • 地図このサーブレットを:私のWebアプリのGAEのURLがhttp://example.appspot.com/example_app

答えて

2
  1. がPOSTを扱うservlet on GAEを作成している場合、私はHttpPostで使用すべきかURL

  2. web.xml config file

    <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"> 
        <servlet> 
         <servlet-name>example_app_servlet</servlet-name> 
         <servlet-class>com.package.ExampleAppServlet</servlet-class> 
        </servlet> 
        <servlet-mapping> 
         <servlet-name>example_app_servlet</servlet-name> 
         <url-pattern>/example_app</url-pattern> 
        </servlet-mapping> 
    </web-app> 
    
関連する問題