MCPcopy Create free account
hub / github.com/apache/thrift / thriftRequest

Method thriftRequest

tutorial/js/src/Httpd.java:185–209  ·  view source on GitHub ↗
(byte[] input)

Source from the content-addressed store, hash-verified

183 }
184
185 private String thriftRequest(byte[] input){
186 try{
187
188 //Input
189 TMemoryBuffer inbuffer = new TMemoryBuffer(input.length);
190 inbuffer.write(input);
191 TProtocol inprotocol = new TJSONProtocol(inbuffer);
192
193 //Output
194 TMemoryBuffer outbuffer = new TMemoryBuffer(100);
195 TProtocol outprotocol = new TJSONProtocol(outbuffer);
196
197 TProcessor processor = new Calculator.Processor(new CalculatorHandler());
198 processor.process(inprotocol, outprotocol);
199
200 byte[] output = new byte[outbuffer.length()];
201 outbuffer.readAll(output, 0, output.length);
202
203 return new String(output,"UTF-8");
204 }catch(Throwable t){
205 return "Error:"+t.getMessage();
206 }
207
208
209 }
210
211 }
212

Callers 1

handleMethod · 0.95

Calls 5

writeMethod · 0.95
processMethod · 0.95
lengthMethod · 0.95
readAllMethod · 0.95
getMessageMethod · 0.45

Tested by

no test coverage detected