Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #20291
| Received | by 10.224.184.11 with SMTP id ci11mr1187131qab.1.1355407195817; Thu, 13 Dec 2012 05:59:55 -0800 (PST) |
|---|---|
| Received | by 10.49.98.42 with SMTP id ef10mr304541qeb.15.1355407195794; Thu, 13 Dec 2012 05:59:55 -0800 (PST) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!fc2no525753qab.0!news-out.google.com!gf5ni48614768qab.0!nntp.google.com!fc2no546052qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.java.programmer |
| Date | Thu, 13 Dec 2012 05:59:55 -0800 (PST) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=96.254.190.240; posting-account=-VTU1AoAAAAj8_Yg-fSOSMK2kXzWy-EX |
| NNTP-Posting-Host | 96.254.190.240 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <e3d17f12-5b5f-4655-a596-402d66bcbf82@googlegroups.com> (permalink) |
| Subject | POSTing to a servlet |
| From | RVic <rvince99@hotmail.com> |
| Injection-Date | Thu, 13 Dec 2012 13:59:55 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.java.programmer:20291 |
Show key headers only | View raw
I have a JUnit test that tests a servlet. The code is straightforward:
HttpClient httpClient = new DefaultHttpClient();
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
HttpPost httpPost = new HttpPost("http://myaerver.com:8080/servlets/json");
addParameter(nvps, "query", "engagementByFacility");
addParameter(nvps, "surveyId", 681150);
httpPost.setEntity(new UrlEncodedFormEntity(nvps));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = httpClient.execute(httpPost, responseHandler);
On this last line however, httpClient.execute(), things fail and I am at an utter loss as to why. The URL is good. Examination of the stack shows:
org.apache.http.client.HttpResponseException: Moved Temporarily
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:68)
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:54)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1070)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1044)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1035)
at ees.cmn.web.servlet.JSONServletTest.testFindOrgs(JSONServletTest.java:75)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
"Moved Temporarily?" What in the world might be going on here? TIA
RVince
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
POSTing to a servlet RVic <rvince99@hotmail.com> - 2012-12-13 05:59 -0800
Re: POSTing to a servlet Arne Vajhøj <arne@vajhoej.dk> - 2012-12-13 19:50 -0500
Re: POSTing to a servlet Roedy Green <see_website@mindprod.com.invalid> - 2012-12-17 02:46 -0800
Re: POSTing to a servlet Lothar Kimmeringer <news200709@kimmeringer.de> - 2012-12-30 14:47 +0100
Re: POSTing to a servlet Arne Vajhøj <arne@vajhoej.dk> - 2012-12-30 15:37 -0500
csiph-web