0

I am working on a Google App Engine Application, and I have implemented a servlet that I want to test. Specifically, I want to call the doPost() method of the servlet, and check the results. Is there any way that I can do this without having to re-deploy every time?

Currently I have to deploy to check it, which is very inconvenient. If this is my (not actual) deployed URL:

HttpPost postMethod=new HttpPost("http://my_app.appspot.com/my_app/my_app_place");

However, if I put the development mode URL in the HttpPost(...) I get a "Permission Denied" Error. Has anyone managed to do this before?

P.P
  • 117,907
  • 20
  • 175
  • 238
hjweide
  • 11,893
  • 9
  • 45
  • 49
  • what url are you using for development mode? This should work just fine... – Rick Mangi May 11 '12 at 15:48
  • http://127.0.0.1:8888/MyApplication.html?gwt.codesvr=127.0.0.1:9997/my_app/my_app_place I read that you have to change 127.0.0.1 to 10.0.2.2 for the emulator, but this retrieves me the contents of the MyApplication.html file from my servlet's doPost?! – hjweide May 11 '12 at 18:53
  • http://stackoverflow.com/questions/10542939/android-emulator-connect-to-gae-on-localhost Here is a more recent version of my question, with some new things that I have found out. – hjweide May 11 '12 at 19:10

2 Answers2

0

If you can't POST to your servlet locally via Java, would using a command-line tool such as cURL suffice?

curl -X POST [see cURL's man page for the arguments you need] http://localhost:8080/my_app/my_app_place

cURL's man page can be found here.

anon
  • 4,163
  • 3
  • 29
  • 26
0

If you ar just testing the Servlet (and not the UI), it should be sufficient to use HttpUnit's ServletUnit.

Moritz Petersen
  • 12,902
  • 3
  • 38
  • 45