On Thu, 2012-03-22 at 14:27 -0700, Shing Wai Chan wrote:
> public class EchoProtocolHandler implements ProtocolHandler {
> public void init(WebConnection wc) {
> wc.getInputStream().setReadListener(new ReadListener() {
> public void onDataAvailable() {
> try {
> ServletInputStream sis = wc.getInputStream();
> byte[] dataBytes = new byte[sis.dataAvailable()];
> sis.read(dataBytes);
> wc.getOutputStream().write(dataBytes);
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
>
+1 for it, but it could be nice to avoid using ServletInputStream and
ServletOutputStream for the upgraded connections, it has a lot of extra
methods that are not very useful. [it should only have byte[] based
methods IMO]
--
Remy Maucherat <rmaucher_at_redhat.com>
Red Hat Inc