Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!news.szaf.org!news.gnuher.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: Lothar Kimmeringer Newsgroups: comp.lang.java.programmer Subject: Re: POSTing to a servlet Date: Sun, 30 Dec 2012 14:47:04 +0100 Organization: Organization?! Only chaos here! Lines: 28 Message-ID: References: Reply-To: news@kimmeringer.de NNTP-Posting-Host: mnch-5d8556b6.pool.mediaways.net Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: online.de 1356875228 25531 93.133.86.182 (30 Dec 2012 13:47:08 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Sun, 30 Dec 2012 13:47:08 +0000 (UTC) User-Agent: 40tude_Dialog/2.0.15.1de Xref: csiph.com comp.lang.java.programmer:20816 RVic wrote: > 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"); [...] > 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 [...] > "Moved Temporarily?" What in the world might be going on here? TIA Try HttpPost httpPost = new HttpPost("http://myaerver.com:8080/servlets/json/"); instead. Regards, Lothar -- Lothar Kimmeringer E-Mail: spamfang@kimmeringer.de PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) Always remember: The answer is forty-two, there can only be wrong questions!