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: Subject: POSTing to a servlet From: RVic 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 I have a JUnit test that tests a servlet. The code is straightforward: HttpClient httpClient = new DefaultHttpClient(); List nvps = new ArrayList(); HttpPost httpPost = new HttpPost("http://myaerver.com:8080/servlets/json"); addParameter(nvps, "query", "engagementByFacility"); addParameter(nvps, "surveyId", 681150); httpPost.setEntity(new UrlEncodedFormEntity(nvps)); ResponseHandler 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