How to retrieve a JSON object from HttpServletResponse in Spring?
I have a Spring controller in which I have to read a JSON object from a URLConnection. Currently I am doing this by reading from the conn开发者_Python百科ection's input stream line by line. Basically I am reading the text contents of the response line by line.
Is there any JSON api that I could use to populate the JSON object directly from the URLConnection? Anything that integrates with Spring?
Perhaps this is related? Essentially, implementing JsonView.
http://jackson.codehaus.org/1.6.0/javadoc/org/codehaus/jackson/JsonFactory.html#createJsonParser(java.io.InputStream) This could help, as URLConnection can return InputStream. What do you want to integrate with Spring, btw?
精彩评论