void send(Object[] args, TProtocol protocol, int seqid) throws TException { protocol.writeMessageBegin(new TMessage(methodName, TMessageType.CALL, seqid)); protocol.writeStructBegin(argsStruct); // method with no parameters if (null != args) { for (int i = 0, n = args.length; i < n; i++) { FieldSpec fieldSpec = requestTypeList.get(i); Object value = args[i]; if (value == null) { if (fieldSpec.required) { throw new TProtocolException( "Required field '" + fieldSpec.name + "' was not present! Struct: " + argsStruct.name); } } else { protocol.writeFieldBegin(fieldSpec.tField); fieldSpec.typeAdapter.write(value, protocol); protocol.writeFieldEnd(); } } } protocol.writeFieldStop(); protocol.writeStructEnd(); protocol.writeMessageEnd(); protocol.getTransport().flush(); }
@Override public boolean process(TProtocol in, TProtocol out) throws TException { TMessage msg = in.readMessageBegin(); String name = msg.name; int idx = name.indexOf('.'); if (idx != -1) { name = name.substring(idx + 1); } TDynamicFunction f = descManager.getFunction(name); if (f == null) throw new TException("unknow function '" + name + "'"); Reader reader = new Reader(f.getManager()); Xdom param = reader.readStruct(f.getParamStruct(), in); in.readMessageEnd(); if (!f.isOneway()) { XdomMap rep; TDynamicField retf = f.getReturnStruct().getField("success"); if (retf.getTypeValue() != TType.VOID) { Xdom ret = handle(name, param); rep = new XdomMap(); rep.put("success", ret); } else { rep = new XdomMap(); } TMessage repmsg = new TMessage(name, TMessageType.REPLY, msg.seqid); out.writeMessageBegin(repmsg); Writer writer = new Writer(f.getManager()); writer.writeStruct(f.getReturnStruct(), rep, out); out.writeMessageEnd(); out.getTransport().flush(); } return true; }
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin( new org.apache.thrift.protocol.TMessage( "hi", org.apache.thrift.protocol.TMessageType.CALL, 0)); hi_args args = new hi_args(); args.write(prot); prot.writeMessageEnd(); }
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin( new org.apache.thrift.protocol.TMessage( "getStruct", org.apache.thrift.protocol.TMessageType.CALL, 0)); getStruct_args args = new getStruct_args(); args.setKey(key); args.write(prot); prot.writeMessageEnd(); }
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin( new org.apache.thrift.protocol.TMessage( "show", org.apache.thrift.protocol.TMessageType.CALL, 0)); show_args args = new show_args(); args.setUser(user); args.write(prot); prot.writeMessageEnd(); }
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin( new org.apache.thrift.protocol.TMessage( "call", org.apache.thrift.protocol.TMessageType.CALL, 0)); call_args args = new call_args(); args.setRequest(request); args.write(prot); prot.writeMessageEnd(); }
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin( new org.apache.thrift.protocol.TMessage( "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); sayHello_args args = new sayHello_args(); args.setName(name); args.write(prot); prot.writeMessageEnd(); }
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin( new org.apache.thrift.protocol.TMessage( "getDecision", org.apache.thrift.protocol.TMessageType.CALL, 0)); getDecision_args args = new getDecision_args(); args.setRequest(request); args.setSessionId(sessionId); args.write(prot); prot.writeMessageEnd(); }
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin( new org.apache.thrift.protocol.TMessage( "tokenize", org.apache.thrift.protocol.TMessageType.CALL, 0)); tokenize_args args = new tokenize_args(); args.setDocument(document); args.setWordGran(wordGran); args.write(prot); prot.writeMessageEnd(); }
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin( new org.apache.thrift.protocol.TMessage( "execute", org.apache.thrift.protocol.TMessageType.CALL, 0)); execute_args args = new execute_args(); args.set_functionName(functionName); args.set_funcArgs(funcArgs); args.write(prot); prot.writeMessageEnd(); }
public boolean process(TProtocol iprot, TProtocol oprot) throws TException { String ip = getClientIp(iprot); if (!whiteListHelper.check(ip)) { System.out.println( "------------ customized secure check, client ip (" + ip + ") not allowed"); TMessage msg = iprot.readMessageBegin(); TProtocolUtil.skip(iprot, TType.STRUCT); iprot.readMessageEnd(); TApplicationException appException = new TApplicationException(TApplicationException.UNKNOWN, "Invalid ip: " + ip); oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid)); appException.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return false; } System.out.println("------------ customized secure check, client ip (" + ip + ") allowed"); boolean result = super.process(iprot, oprot); return result; }
public void writeMessageEnd() throws TException { delegate.writeMessageEnd(); }
protected void sendBase(String methodName, TBase args) throws TException { oprot_.writeMessageBegin(new TMessage(methodName, TMessageType.CALL, ++seqid_)); args.write(oprot_); oprot_.writeMessageEnd(); oprot_.getTransport().flush(); }