aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "URLConnection 422 Http Error response" Watch "URLConnection 422 Http Error response" New topic
Author

URLConnection 422 Http Error response

Mano Krrish
Greenhorn

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
urce)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unkn
own Source)

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19719
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Mano Krrish
Greenhorn

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
Greenhorn

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