Java Code Examples for com.alipay.remoting.rpc.protocol.RpcResponseCommand#getHeader()
The following examples show how to use
com.alipay.remoting.rpc.protocol.RpcResponseCommand#getHeader() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomHeaderSerializer.java From sofa-bolt with Apache License 2.0 | 6 votes |
/** * @see com.alipay.remoting.CustomSerializer#deserializeHeader(com.alipay.remoting.rpc.ResponseCommand, InvokeContext) */ @Override public <T extends ResponseCommand> boolean deserializeHeader(T response, InvokeContext invokeContext) throws DeserializationException { if (response instanceof RpcResponseCommand) { RpcResponseCommand responseCommand = (RpcResponseCommand) response; byte[] header = responseCommand.getHeader(); try { responseCommand.setResponseHeader(new String(header, "UTF-8")); } catch (UnsupportedEncodingException e) { System.err.println("UnsupportedEncodingException"); } return true; } return false; }
Example 2
Source File: SofaRpcSerialization.java From sofa-rpc with Apache License 2.0 | 5 votes |
@Override public <Response extends ResponseCommand> boolean deserializeHeader(Response response, InvokeContext invokeContext) throws DeserializationException { if (response instanceof RpcResponseCommand) { RpcInternalContext.getContext().getStopWatch().tick(); RpcResponseCommand responseCommand = (RpcResponseCommand) response; byte[] header = responseCommand.getHeader(); responseCommand.setResponseHeader(mapSerializer.decode(header)); return true; } return false; }