Package com.guxuede.mina.bean

Examples of com.guxuede.mina.bean.HttpMessage


  }

  @Override
  public void messageReceived(IoSession session, Object message) throws Exception {
    System.out.println("Server:接受消息:"+message);
    HttpMessage request=(HttpMessage)message;
    if(request.uri.endsWith("Hello.chat")){
      ChatPro.chatSessionReceived(request, session);
    }else{
      HttpMessage response=HttpMessage.getDefaultResponse();
      response.body=FileUtil.getFileIoBuffer(request.uri);
      session.write(response);
      session.close(true);
    }
  }
View Full Code Here


      it.remove();
    }
  }
 
  public void speakAll(String msg){
    HttpMessage hmsg=new HttpMessage();
    hmsg.body=IoBuffer.allocate(20).setAutoExpand(true).put(msg.getBytes());
    hmsg.body.flip();
    //System.out.println(x)
    IoUtil.broadcast(hmsg, members.values());
  }
View Full Code Here

    //System.out.println(x)
    IoUtil.broadcast(hmsg, members.values());
  }
 
  public static void speakTo(String msg,IoSession session){
    HttpMessage hmsg=new HttpMessage();
    hmsg.body=IoBuffer.allocate(20).setAutoExpand(true).put(msg.getBytes()).flip();
    session.write(hmsg);
  }
View Full Code Here

    this.charset=charset;
  }
 
  @Override
  public void encode(IoSession sessiom, Object message, ProtocolEncoderOutput out)throws Exception {
    HttpMessage response=(HttpMessage)message;
   
    CharsetEncoder ce = charset.newEncoder();
    IoBuffer buffer = IoBuffer.allocate(100).setAutoExpand(true);
    if(response.head!=null){
      buffer.putString(response.head, ce);
View Full Code Here

        data=to2==-1?"":head.substring(to2+1, to1);
        matchCount = 0;
        buffer.clear();
      }
    }
    HttpMessage message=new HttpMessage();
    message.head=head;
    message.uri=uri;
    message.data=parseData(data);
    out.write(message);
    return false;
View Full Code Here

TOP

Related Classes of com.guxuede.mina.bean.HttpMessage

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.