Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.DownstreamMessageEvent


    {
      Constants.ahessianLogger.warn("",ex);
    }
    if (future == null)
    future = Channels.future(_ctx.getChannel());
        _ctx.sendDownstream(new DownstreamMessageEvent(_ctx.getChannel(), future, _buf, _ctx.getChannel().getRemoteAddress()));
    _buf = dynamicBuffer(1024);
    return future;
  }
View Full Code Here


      StringBuilder sb = new StringBuilder();

    //System.out.println(e);
    if (e instanceof DownstreamMessageEvent)
    {
      DownstreamMessageEvent devm = (DownstreamMessageEvent) e;
      Object mes = devm.getMessage();
      sb.append('[');
      sb.append(e.getChannel().getId());
      sb.append(" >out> ");
      if (mes instanceof ChannelBuffer)
        encodeBuffer((ChannelBuffer)((DownstreamMessageEvent)e).getMessage(), sb);
View Full Code Here

  {
      Constants.ahessianLogger.info("write timed out -> send empty buffer heartbeat");
    ChannelFuture future = Channels.future(_ctx.getChannel());
    ChannelBuffer b = ChannelBuffers.buffer(1);
    b.writeByte(0);
        _ctx.sendDownstream(new DownstreamMessageEvent(_ctx.getChannel(), future, b, _ctx.getChannel().getRemoteAddress()));
  }
View Full Code Here

  @Override
  public void sendDownstreamAsBinary(ChannelHandlerContext ctx, ChannelFuture future)
  {
    ChannelBuffer buffer = toBinaryChannelBuffer();
    ctx.sendDownstream(new DownstreamMessageEvent(ctx.getChannel(), future, buffer,
                                                  ctx.getChannel().getRemoteAddress()));
  }
View Full Code Here

  public void writeToChannelAsBinary(ChannelHandlerContext ctx, ChannelFuture future)
  {
    ChannelFuture realFuture = (null != future) ? future : Channels.future(ctx.getChannel());

    ChannelBuffer serializedResponse = serializeToBinary();
    DownstreamMessageEvent e = new DownstreamMessageEvent(ctx.getChannel(), realFuture,
                                                          serializedResponse,
                                                          ctx.getChannel().getRemoteAddress());
    ctx.sendDownstream(e);
  }
View Full Code Here

      // =====================================================================
     
      // =====================================================================
      // Comment the next line to ditch the CompatibleObjectEncoder from the pipeline
      // =====================================================================
      ctx.sendDownstream(new DownstreamMessageEvent(e.getChannel(), Channels.future(e.getChannel()), ret, e.getChannel().getRemoteAddress()));
     
     
    } else {
      System.err.println("WTF..... anything getting here should be a string but we got a [" + msg.getClass().getName() + "]");
    }
View Full Code Here

    response.setHeader(CONTENT_LENGTH, cb.readableBytes());
    response.setHeader(CONTENT_TYPE, "application/json");
    response.setHeader(CACHE_CONTROL, "no-cache");
    response.setContent(cb);
    ChannelFuture cf = Channels.future(channel);
    ctx.sendDownstream(new DownstreamMessageEvent(channel, cf, response, channel.getRemoteAddress()));
   
  }
View Full Code Here

        int metricCount = processMetric(request);
        HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
        response.setContent(ChannelBuffers.copiedBuffer("\n" + metricCount + "\n", CharsetUtil.UTF_8));
        response.setHeader(CONTENT_TYPE, "text/plain");
        ChannelFuture future = Channels.future(channel);
        ctx.sendDownstream(new DownstreamMessageEvent(channel, future, response, channel.getRemoteAddress()));
        future.addListener(ChannelFutureListener.CLOSE);       
      }
    }
    ctx.sendUpstream(e);
  }
View Full Code Here

    if(!(message instanceof JSONObject) && !(message instanceof CharSequence)) {
            ctx.sendDownstream(e);
            return;     
    }
    WebSocketFrame frame = new TextWebSocketFrame(message.toString());   
    ctx.sendDownstream(new DownstreamMessageEvent(channel, Channels.future(channel), frame, channel.getRemoteAddress()));   

  }
View Full Code Here

    Channel channel = e.getChannel();
    StringBuilder b = new StringBuilder("\n").append(message).append("--").append(channel.getId()).append("\n");
    HttpResponse response = new DefaultHttpResponse(HTTP_1_1, PARTIAL_CONTENT);
    response.setContent(ChannelBuffers.copiedBuffer(b, CharsetUtil.UTF_8));
    response.setHeader(CONTENT_TYPE, "application/json");
    ctx.sendDownstream(new DownstreamMessageEvent(channel, Channels.future(channel), response, channel.getRemoteAddress()));
  }
View Full Code Here

TOP

Related Classes of org.jboss.netty.channel.DownstreamMessageEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.