Examples of RequestProtocol


Examples of com.bj58.spat.gaea.protocol.sdp.RequestProtocol

    System.out.println("state:" + this.getState().toString());
    System.out.println("errorMsg:" + this.getErrorMsg());
    System.out.println("MessageBodyBase:");
   
    if(sdp.getClass() == RequestProtocol.class) {
      RequestProtocol request = (RequestProtocol)this.sdp;
      System.out.println("Server.Lookup:" + request.getLookup());
      System.out.println("Server.MethodName:" + request.getMethodName());
      System.out.println("Server.ParaKVList:");
      for(KeyValuePair kv : request.getParaKVList()){
        System.out.println("key:" + kv.getKey() + "---value:"+kv.getValue());
      }
    }
        super.printStackTrace();
        System.out.println("--------------------------end------------------------------");
View Full Code Here

Examples of com.bj58.spat.gaea.protocol.sdp.RequestProtocol

public class ProtocolHelperTest {

  @Test
  public void testFromBytes() throws Exception {
    RequestProtocol rp = new RequestProtocol("lookup", "methodname", null);
    Protocol p = new Protocol(101001, (byte)1, SDPType.Request, rp);
   
    byte[] buffer = p.toBytes();
   
    Protocol p2 = (Protocol)ProtocolHelper.fromBytes(buffer);
    Assert.assertEquals(rp.getLookup(), ((RequestProtocol)p2.getSdpEntity()).getLookup());
    Assert.assertEquals(rp.getMethodName(), ((RequestProtocol)p2.getSdpEntity()).getMethodName());
  }
View Full Code Here

Examples of com.bj58.spat.gaea.protocol.sdp.RequestProtocol

  }
 
 
  @Test
  public void testToBytes() throws Exception {
    RequestProtocol rp = new RequestProtocol("lookup", "methodname", null);
    Protocol p = new Protocol(101001, (byte)1, SDPType.Request, rp);
   
    byte[] buffer = p.toBytes();
    StringBuilder sbBuf = new StringBuilder();
    for(byte b : buffer) {
View Full Code Here

Examples of com.bj58.spat.gaea.protocol.sdp.RequestProtocol

    Object response = null;
    Protocol protocol = null;
   
    try {
        protocol = context.getGaeaRequest().getProtocol();
      RequestProtocol request = (RequestProtocol)protocol.getSdpEntity();
     
      sbInvokerMsg.append("protocol version:");
      sbInvokerMsg.append(protocol.getVersion());
      sbInvokerMsg.append("\nfromIP:");
      sbInvokerMsg.append(context.getChannel().getRemoteIP());
      sbInvokerMsg.append("\nlookUP:");
      sbInvokerMsg.append(request.getLookup());
      sbInvokerMsg.append("\nmethodName:");
      sbInvokerMsg.append(request.getMethodName());
      sbInvokerMsg.append("\nparams:");
     
      if(request.getParaKVList() != null){
        for (KeyValuePair kv : request.getParaKVList()) {
          if(kv != null) {
            sbInvokerMsg.append("\n--key:");
            sbInvokerMsg.append(kv.getKey());
            sbInvokerMsg.append("\n--value:");
            sbInvokerMsg.append(kv.getValue());
          } else {
            logger.error("KeyValuePair is null  Lookup:" + request.getLookup() + "--MethodName:" + request.getMethodName());
          }
        }
      }
     
      logger.debug(sbInvokerMsg.toString());
      logger.debug("begin get proxy factory");
     
      // get local proxy
      IProxyStub localProxy = Global.getSingleton().getProxyFactory().getProxy(request.getLookup());
      logger.debug("proxyFactory.getProxy finish");

      if (localProxy == null) {
        ServiceFrameException sfe = new ServiceFrameException(
            "method:ProxyHandle.invoke--msg:" + request.getLookup() + "." + request.getMethodName() + " not fond",
            context.getChannel().getRemoteIP(),
            context.getChannel().getLocalIP(),
            request,
            ErrorState.NotFoundServiceException,
            null);
        response = ExceptionHelper.createError(sfe);
        logger.error("localProxy is null", sfe);
      } else {
        logger.debug("begin localProxy.invoke");
        String swInvoderKey = "InvokeRealService_" + request.getLookup() + "." + request.getMethodName();
        sw.startNew(swInvoderKey, sbInvokerMsg.toString());
        sw.setFromIP(context.getChannel().getRemoteIP());
        sw.setLocalIP(context.getChannel().getLocalIP());
       
        //invoker real service
View Full Code Here

Examples of com.bj58.spat.gaea.protocol.sdp.RequestProtocol

  }

  public void setGaeaRequest(GaeaRequest gaeaRequest) {
    this.gaeaRequest = gaeaRequest;
   
    RequestProtocol r = (RequestProtocol)gaeaRequest.getProtocol().getSdpEntity();
    this.stopWatch.setLookup(r.getLookup());
    this.stopWatch.setMethodName(r.getMethodName());
  }
View Full Code Here

Examples of com.bj58.spat.gaea.protocol.sdp.RequestProtocol

      //当前服务启动权限认证,并且当前channel通过校验,则进行方法校验
      SecureContext securecontext = global.getGlobalSecureContext(context.getChannel().getNettyChannel());
      if(global.getGlobalSecureIsRights()){
        //当前服务启用权限认证,判断当前channel是否通过授权
        if(securecontext.isRights()){
          RequestProtocol request = (RequestProtocol)p.getSdpEntity();
          if(request != null){
            StringBuffer buff = new StringBuffer(request.getLookup() + "." +request.getMethodName());//接口实现类.方法名(参数序列)
            buff.append("(");
            List<KeyValuePair> list = request.getParaKVList();
            if(list != null){
              int i=0;
              for(KeyValuePair k : list){
                if(k != null){
                  if(i > 0){
View Full Code Here

Examples of com.bj58.spat.gaea.protocol.sdp.RequestProtocol

        long watcher = System.currentTimeMillis();
        List<KeyValuePair> listPara = new ArrayList<KeyValuePair>();
        for (Parameter p : paras) {
            listPara.add(new KeyValuePair(p.getSimpleName(), p.getValue()));
        }
        RequestProtocol requestProtocol = new RequestProtocol(typeName, methodName, listPara);
        Protocol sendP = new Protocol(createSessionId(),
            (byte) config.getServiceid(),
            SDPType.Request,
            CompressType.UnCompress,
            config.getProtocol().getSerializerType(),
View Full Code Here

Examples of com.bj58.spat.gaea.protocol.sdp.RequestProtocol

        gaeaContext.setServerType(ServerType.HTTP);
        gaeaContext.setServerHandler(this);
        gaeaContext.setChannel(new GaeaChannel(e.getChannel()));
      /**协议*/
      Protocol protocol = new Protocol();
      RequestProtocol request = new RequestProtocol();
      request.setLookup(action.getLookup());
      request.setMethodName(action.getMethodName());
      request.setParaKVList(paraKVList);
      protocol.setSdpEntity(request);
      gaeaContext.getGaeaRequest().setProtocol(protocol);
      /**HttpContext 上下文*/
      com.bj58.spat.gaea.server.contract.http.HttpContext httpcontext = new com.bj58.spat.gaea.server.contract.http.HttpContext();
      com.bj58.spat.gaea.server.contract.http.HttpRequest httpRequest = new com.bj58.spat.gaea.server.contract.http.HttpRequest();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.