content length warning with JsonRpcDispatcher

24 views
Skip to first unread message

Shawn Garner

unread,
Jul 5, 2013, 6:18:46 PM7/5/13
to jay...@googlegroups.com
Hello,

I'm using a java client to connect to Jayrock JsonRpcDispatcher without going through the handler.  I'm using the System.Net (HttpListener) packages and not the Web packages because I don't want to install IIS.
The java client is complaining that the content length is not set:
"Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended."
I was going to try to manually set the content length on the response but I was looking at the public void Process(TextReader request, TextWriter response) on JsonRpcDispatcher and was unable to figure out how to accomplish this.
Is this possible?

Shawn

Atif Aziz

unread,
Jul 6, 2013, 11:09:50 AM7/6/13
to jay...@googlegroups.com
Yes it is possible by buffering up the result and then calculating and emitting the length from the buffer before flushing it to the response. This is basically what ASP.NET does too. I've posted a gist the demonstrates how you can do this using the JsonRpcDisaptcher:


- Atif


--
You received this message because you are subscribed to the Google Groups "Jayrock" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jayrock+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Shawn Garner

unread,
Jul 6, 2013, 5:33:20 PM7/6/13
to jay...@googlegroups.com
That exactly what I was looking for.  Thanks for the example and quick response.

Shawn
Reply all
Reply to author
Forward
0 new messages