jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes URLConnection 422 Http Error response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "URLConnection 422 Http Error response" Watch "URLConnection 422 Http Error response" New topic

URLConnection 422 Http Error response

Mano Krrish

Joined: Sep 10, 2010
Posts: 13
Hi all,

I have a JSON feed which I am trying to call using URLConnection. I requested the feed with authentication parameters(UserName & Password) and got the cookies of the call, then tried to request the server with cookies, for the feed data, but I received a 422 Http Error response. Could any one please help us on this and correct me if I am wrong in any other aspect of using the Connection too.

Thanks in advance!!

I have given below the error console and the code snippet I am using for this:

java.io.IOException: Server returned HTTP response code: 422 for URL:

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unkn
own Source)

Rob Spoor

Joined: Oct 27, 2005
Posts: 20137

422 means "http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error" (source: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error). Unfortunately, that's as far as I can help you as I've never seen this status code appear "in the wild" before.

How To Ask Questions How To Answer Questions
Mano Krrish

Joined: Sep 10, 2010
Posts: 13
Thanks for the reply Rob,

Yep, the definition of the 422 Error response is much weird, which I couldn't figure out. May be could you please confirm if the code I am using is correct?
Mano Krrish

Joined: Sep 10, 2010
Posts: 13
All I just need to get currently is the reader of that inputstream, but I am getting this exception only just before the getInputStream() during the runtime.

Please help me.....!!!
I agree. Here's the link: http://aspose.com/file-tools
subject: URLConnection 422 Http Error response
It's not a secret anymore!