Error returning ok(inputStream)

204 views
Skip to first unread message

Ben McCann

unread,
Nov 22, 2013, 11:36:58 PM11/22/13
to play-fr...@googlegroups.com
Hi,

I'm trying to return an InputStream from a URL and it is failing with the error:

    The response to this request is chunked and hence requires HTTP 1.1 to be sent, but this is a HTTP 1.0 request.

The code I'm using is:

    try (InputStream is = new URL(url).openStream()) {
      return ok(is);
    }

Is there someway that I can make ok(is) use HTTP 1.1 for the request or some other way around this?

Thanks,
Ben

Keith Rockhold

unread,
Nov 23, 2013, 12:29:16 AM11/23/13
to play-fr...@googlegroups.com

Ben McCann

unread,
Nov 23, 2013, 1:31:38 PM11/23/13
to play-fr...@googlegroups.com
Hi Keith, is there some part of that doc page that's supposed to solve the issue? I don't see anything there about changing the HTTP version used.

-Ben


--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/1XzbvgSczw4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
about.me/benmccann

Keith Rockhold

unread,
Nov 23, 2013, 2:36:24 PM11/23/13
to play-fr...@googlegroups.com
I owe you an apology, I misread the question. Play always returns http 1.1. That error is the appropriate response in this case, http 1.0 does not support chunked encoding. Is it possible for you to write the input stream to a string and return it, Store-and-Forward style? You may have to set a keep-alive in the header.
Keith Rockhold
Developer
ke...@gliffy.com


Gliffy Inc.
PO Box 7775 #35255
San Francisco, CA, 94120-7775

877-2-Gliffy (877-245-4339)

Ben McCann

unread,
Nov 24, 2013, 12:20:18 AM11/24/13
to play-fr...@googlegroups.com
Ah, I understand the message now. Thanks. Converting the response to a string and returning that worked. It's quite odd that Play knows it cannot chunk the response and yet tries to anyway.
Reply all
Reply to author
Forward
0 new messages