Java源码示例:com.caucho.hessian.client.HessianConnection
示例1
@Override
protected HessianConnectionFactory createHessianConnectionFactory() {
return new HessianURLConnectionFactory() {
@Override
public HessianConnection open(URL url) throws IOException {
HessianConnection connection = super.open(url);
String interfaze = HessianUrlUtil.extractInterface(url.toString());
ReferenceConfig referenceConfig = referenceConfigMap.get(interfaze);
String secretKey = referenceConfig.getSecretKey();
int version = referenceConfig.getVersion();
connection.addHeader(ThunderConstant.INTERFACE_ATTRIBUTE_NAME, interfaze);
connection.addHeader(ThunderConstant.SECRET_KEY_ATTRIBUTE_NAME, secretKey);
connection.addHeader(ThunderConstant.VERSION_ATTRIBUTE_NAME, String.valueOf(version));
return connection;
}
};
}
示例2
@Override
public HessianConnection open(URL url) throws IOException {
HttpClientConnection httpClientConnection = new HttpClientConnection(httpClient, url);
RpcContext context = RpcContext.getContext();
for (String key : context.getAttachments().keySet()) {
httpClientConnection.addHeader(Constants.DEFAULT_EXCHANGER + key, context.getAttachment(key));
}
return httpClientConnection;
}
示例3
@Override
public HessianConnection open(URL url) throws IOException {
HessianConnection connection = super.open(url);
RpcContext context = RpcContext.getContext();
for (String key : context.getAttachments().keySet()) {
connection.addHeader(Constants.DEFAULT_EXCHANGER + key, context.getAttachment(key));
}
return connection;
}
示例4
@Override
protected void addRequestHeaders(HessianConnection conn) {
super.addRequestHeaders(conn);
if (this.context == null || this.context.size() < 1) {
return;
}
for (Entry<String, String> e : this.context.entrySet()) {
conn.addHeader(e.getKey(), e.getValue());
}
}
示例5
/**
* Custom headers, specific to {@link ProcessContext} are added in this method.
*/
protected void addRequestHeaders(HessianConnection connection) {
super.addRequestHeaders(connection);
String processId = ProcessContext.getInstance().getProcessIdentifier();
if (processId != null) {
connection.addHeader(TracingFilter.RATEL_HEADER_PROCESS_ID, processId);
}
}
示例6
public HessianConnection open(URL url) throws IOException {
return new HttpClientConnection(httpClient, url);
}
示例7
public HessianConnection open(URL url) throws IOException {
return new HttpClientConnection(httpClient, url);
}
示例8
public HessianConnection open(URL url) throws IOException {
return new HttpClientConnection(httpClient, url);
}
示例9
public HessianConnection open(URL url) throws IOException {
return new HttpClientConnection(httpClient, url);
}