3

I've set up a Google App Engine application to respond to various HttpPosts and store various bits of information. For some reason in one of my HttpServlets, I am unable to respond back to an HttpPost. I know I've completed this in a similar fashion before but have been unable to figure out the solution neither from trial/attempt nor stackoverflow questions.

Here, my servlet receives the post with no problem:

@Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    {
      //I do some random processing and storing of data
      //Then I respond with a String dependent upon the info I'm given
        resp.setContentType("application/JSON");
        PrintWriter out = resp.getWriter();
        out.print(myResponse);        
        out.close();
    }

I never receive the actual response data back however. The method below is never called. I've set the NSURLConnectionDelegate.

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;

Does anyone know why this might be?? I'm considering switching to an HttpGet but I know for sure I've done this with an HttpPost before. Any help will be extremely appreciated thanks!

margz
  • 31
  • 3
  • do the POST request appears on the server log, and are you able to response to browser with a simple static (e.g. Hello World) message? – user1431972 Jul 09 '13 at 03:39
  • Like the previous comment, does the POST work from other clients (like a test web page)? Have you tried a GET? According to http://stackoverflow.com/questions/477816/what-is-the-correct-json-content-type you should use `application/json` as the content type. – disrvptor Feb 27 '14 at 03:12

0 Answers0