All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.antelopeframework.httpinvoker.client.HessianProxy Maven / Gradle / Ivy

package com.github.antelopeframework.httpinvoker.client;

import java.net.URL;

import com.caucho.hessian.client.HessianConnection;
import com.caucho.hessian.client.HessianProxyFactory;
import com.github.antelopeframework.httpinvoker.server.HessianServiceExporter;

import lombok.Setter;

@Setter
public class HessianProxy extends com.caucho.hessian.client.HessianProxy {
	private static final long serialVersionUID = 1L;

	private String user;
	private String password;
	private String app;

	protected HessianProxy(URL url, HessianProxyFactory factory) {
		super(url, factory);
	}

	protected HessianProxy(URL url, HessianProxyFactory factory, Class type) {
		super(url, factory, type);
	}

	@Override
	protected void addRequestHeaders(HessianConnection conn) {
		conn.addHeader("Content-Type", "x-application/hessian");
		conn.addHeader("Accept-Encoding", "deflate");

//		String basicAuth = _factory.getBasicAuth();
//
//		if (basicAuth != null) {
//			conn.addHeader("Authorization", basicAuth);
//		} else {
			conn.addHeader(HessianServiceExporter.HTTPINVOKER_PARAM_APP, this.app);
			conn.addHeader(HessianServiceExporter.HTTPINVOKER_PARAM_USER, this.user);
			conn.addHeader(HessianServiceExporter.HTTPINVOKER_PARAM_PASSWORD, this.password);
			conn.addHeader(HessianServiceExporter.HTTPINVOKER_PARAM_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
//		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy