当前位置: 首页>>代码示例>>Java>>正文


Java HessianInput类代码示例

本文整理汇总了Java中com.caucho.hessian.io.HessianInput的典型用法代码示例。如果您正苦于以下问题:Java HessianInput类的具体用法?Java HessianInput怎么用?Java HessianInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HessianInput类属于com.caucho.hessian.io包,在下文中一共展示了HessianInput类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserialize

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
public static <T> Object deserialize(byte[] bytes, Class<T> clazz) {
	ByteArrayInputStream is = new ByteArrayInputStream(bytes);
	HessianInput hi = new HessianInput(is);
	try {
		return hi.readObject();
	} catch (IOException e) {
		throw new IllegalStateException(e.getMessage(), e);
	}
}
 
开发者ID:mmwhd,项目名称:stage-job,代码行数:10,代码来源:HessianSerializer.java

示例2: deserialize

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
public <T> T deserialize(byte[] data, Class<T> clazz) {
    if (data == null)
        throw new NullPointerException();

    try {
        ByteArrayInputStream is = new ByteArrayInputStream(data);
        HessianInput hi = new HessianInput(is);
        return (T) hi.readObject();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}
 
开发者ID:linuer,项目名称:nan,代码行数:14,代码来源:HessianSerializer.java

示例3: getHessianInput

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
public AbstractHessianInput getHessianInput(InputStream is)
{
  AbstractHessianInput in = new HessianInput(is);
  in.setRemoteResolver(getRemoteResolver());

  return in;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:HessianProxyFactory.java

示例4: copy

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
public void copy(final String remoteFileName, final OutputStream outputTo) throws IOException {
  InputStream responceIS = null;
  OutputStream connectionOS = null;
  InputStream connectionIS = null;
  try {
    // call backend
    final URLConnection conn = proxyFactory.openConnection(new URL(webServiceLocator.getURL()));
    conn.addRequestProperty(WebServiceConstants.REQUEST_HEADER_CUSTOM_PROTOCOL, Boolean.toString(true));
    conn.connect();
    connectionOS = conn.getOutputStream();
    final HessianOutput ho = proxyFactory.getHessianOutput(connectionOS);
    ho.startCall(WebServiceConstants.METHOD_GET_FILE);
    ho.writeString(remoteFileName);
    ho.completeCall();
    connectionOS.close();

    // read response
    connectionIS = conn.getInputStream();
    final HessianInput hin = new HessianInput(connectionIS);
    try {
      hin.startReply();
    } catch (Throwable throwable) { // NOPMD - because startReply, thanks to caucho, declares Throwable
      if (throwable instanceof IOException) throw (IOException)throwable; // NOPMD - we still have to know what is the exception
      final IOException e = new IOException(StringUtils.toString(throwable));
      e.initCause(throwable);
      throw e;
    }
    responceIS = hin.readInputStream();
    IoUtils.copyInputToOuputStream(responceIS, outputTo);
    hin.completeReply();
  } finally {
    IoUtils.closeHard(connectionIS);
    IoUtils.closeHard(connectionOS);
    IoUtils.closeHard(responceIS);
  }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:RemoteFileGetter.java

示例5: deserialize

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
@Override
public <T> Object deserialize(byte[] bytes, Class<T> clazz) {
	ByteArrayInputStream is = new ByteArrayInputStream(bytes);
	HessianInput hi = new HessianInput(is);
	try {
		return hi.readObject();
	} catch (IOException e) {
		throw new IllegalStateException(e.getMessage(), e);
	}
}
 
开发者ID:xuxueli,项目名称:xxl-incubator,代码行数:11,代码来源:HessianSerializer.java

示例6: beforeProviderInvokeForSVC

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
private void beforeProviderInvokeForSVC(Invocation invocation, TransactionRequestImpl request,
		TransactionResponseImpl response) {
	CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
	CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
	TransactionInterceptor transactionInterceptor = beanFactory.getTransactionInterceptor();

	RemotingException rpcError = null;
	String transactionContextContent = invocation.getAttachment(TransactionContext.class.getName());
	String propagatedBy = invocation.getAttachment(RemoteCoordinator.class.getName());
	if (StringUtils.isNotBlank(transactionContextContent)) {
		byte[] requestByteArray = ByteUtils.stringToByteArray(transactionContextContent);
		ByteArrayInputStream bais = new ByteArrayInputStream(requestByteArray);
		HessianInput input = new HessianInput(bais);
		try {
			TransactionContext remoteTransactionContext = (TransactionContext) input.readObject();
			remoteTransactionContext.setPropagatedBy(propagatedBy);
			request.setTransactionContext(remoteTransactionContext);
		} catch (IOException ex) {
			logger.error("Error occurred in remote call!", ex);
			rpcError = new RemotingException(ex.getMessage());
		}
	}

	try {
		transactionInterceptor.afterReceiveRequest(request);
	} catch (RuntimeException rex) {
		logger.error("Error occurred in remote call!", rex);
		throw new RemotingException(rex.getMessage());
	}

	if (rpcError != null) {
		throw rpcError;
	}

}
 
开发者ID:liuyangming,项目名称:ByteTCC,代码行数:36,代码来源:CompensableServiceFilter.java

示例7: afterConsumerInvokeForSVC

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
private void afterConsumerInvokeForSVC(Invocation invocation, TransactionRequestImpl request,
		TransactionResponseImpl response) {
	CompensableBeanRegistry beanRegistry = CompensableBeanRegistry.getInstance();
	CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory();
	TransactionInterceptor transactionInterceptor = beanFactory.getTransactionInterceptor();

	RemotingException rpcError = null;
	try {
		if (request.getTransactionContext() != null) {
			String transactionContextContent = invocation.getAttachment(TransactionContext.class.getName());
			byte[] byteArray = ByteUtils.stringToByteArray(transactionContextContent);
			ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
			HessianInput input = new HessianInput(bais);
			TransactionContext remoteTransactionContext = (TransactionContext) input.readObject();
			response.setTransactionContext(remoteTransactionContext);
		}
	} catch (IOException ex) {
		logger.error("Error occurred in remote call!", ex);
		rpcError = new RemotingException(ex.getMessage());
	}

	try {
		transactionInterceptor.afterReceiveResponse(response);
	} catch (RuntimeException rex) {
		logger.error("Error occurred in remote call!", rex);
		throw new RemotingException(rex.getMessage());
	}

	if (rpcError != null) {
		throw rpcError;
	}

}
 
开发者ID:liuyangming,项目名称:ByteTCC,代码行数:34,代码来源:CompensableServiceFilter.java

示例8: deserialize

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
@Override
public  Object deserialize(byte[] data) {
	ByteArrayInputStream is = new ByteArrayInputStream(data);
	HessianInput hi = new HessianInput(is);  
	Object obj=null;
	try {
		obj = hi.readObject();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return obj;
}
 
开发者ID:addisonli,项目名称:addison-common-cached,代码行数:14,代码来源:HessianSerialize.java

示例9: beforeProviderInvokeForSVC

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
private void beforeProviderInvokeForSVC(Invocation invocation, TransactionRequestImpl request,
		TransactionResponseImpl response) {
	TransactionBeanRegistry beanRegistry = TransactionBeanRegistry.getInstance();
	TransactionBeanFactory beanFactory = beanRegistry.getBeanFactory();
	TransactionInterceptor transactionInterceptor = beanFactory.getTransactionInterceptor();

	RpcException rpcError = null;
	String transactionContextContent = invocation.getAttachment(TransactionContext.class.getName());
	String propagatedBy = invocation.getAttachment(RemoteCoordinator.class.getName());
	if (StringUtils.isNotBlank(transactionContextContent)) {
		byte[] requestByteArray = ByteUtils.stringToByteArray(transactionContextContent);
		ByteArrayInputStream bais = new ByteArrayInputStream(requestByteArray);
		HessianInput input = new HessianInput(bais);
		try {
			TransactionContext remoteTransactionContext = (TransactionContext) input.readObject();
			remoteTransactionContext.setPropagatedBy(propagatedBy);
			request.setTransactionContext(remoteTransactionContext);
		} catch (IOException ex) {
			logger.error("Error occurred in remote call!", ex);
			rpcError = new RpcException("Error occurred in remote call!", ex);
		}
	}

	try {
		transactionInterceptor.afterReceiveRequest(request);
	} catch (RuntimeException rex) {
		logger.error("Error occurred in remote call!", rex);
		throw new RpcException("Error occurred in remote call!", rex);
	}

	if (rpcError != null) {
		throw rpcError;
	}

}
 
开发者ID:liuyangming,项目名称:ByteJTA,代码行数:36,代码来源:TransactionServiceFilter.java

示例10: afterConsumerInvokeForSVC

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
private void afterConsumerInvokeForSVC(Invocation invocation, TransactionRequestImpl request,
		TransactionResponseImpl response) {
	TransactionBeanRegistry beanRegistry = TransactionBeanRegistry.getInstance();
	TransactionBeanFactory beanFactory = beanRegistry.getBeanFactory();
	TransactionInterceptor transactionInterceptor = beanFactory.getTransactionInterceptor();

	RpcException rpcError = null;
	try {
		if (request.getTransactionContext() != null) {
			String transactionContextContent = invocation.getAttachment(TransactionContext.class.getName());
			byte[] byteArray = ByteUtils.stringToByteArray(transactionContextContent);
			ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
			HessianInput input = new HessianInput(bais);
			TransactionContext remoteTransactionContext = (TransactionContext) input.readObject();
			response.setTransactionContext(remoteTransactionContext);
		}
	} catch (IOException ex) {
		logger.error("Error occurred in remote call!", ex);
		rpcError = new RpcException("Error occurred in remote call!", ex);
	}

	try {
		transactionInterceptor.afterReceiveResponse(response);
	} catch (RuntimeException rex) {
		logger.error("Error occurred in remote call!", rex);
		throw new RpcException("Error occurred in remote call!", rex);
	}

	if (rpcError != null) {
		throw rpcError;
	}

}
 
开发者ID:liuyangming,项目名称:ByteJTA,代码行数:34,代码来源:TransactionServiceFilter.java

示例11: deserializeObject

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
public static Serializable deserializeObject(byte[] bytes) throws IOException {
	ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
	HessianInput hi = new HessianInput(bais);
	Object result;
	try {
		result = hi.readObject();
		return (Serializable) result;
	} finally {
		CommonUtils.closeQuietly(bais);
	}
}
 
开发者ID:liuyangming,项目名称:ByteJTA,代码行数:12,代码来源:CommonUtils.java

示例12: decode

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
@Override
public Object decode(InputStream in, ClassResolver classResolver) throws Exception
{
	HessianInput hi = new HessianInput(in);
	Object result = hi.readObject();
	hi.close();
    return result;
}
 
开发者ID:liulhdarks,项目名称:darks-grid,代码行数:9,代码来源:HessianCodec.java

示例13: invoke

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
/**
  * Invoke the object with the request from the input stream.
  *
  * @param in the Hessian input stream
  * @param out the Hessian output stream
  */
 public void invoke(HessianInput in, HessianOutput out)
   throws Throwable
 {
   in.startCall();

   Method method = getMethod(in.getMethod());

   if (method != null) {
   }
   else if ("_hessian_getAttribute".equals(in.getMethod())) {
     String attrName = in.readString();
     in.completeCall();

     String value = null;

     if ("java.api.class".equals(attrName))
value = getAPIClassName();
     else if ("java.home.class".equals(attrName))
value = getHomeClassName();
     else if ("java.object.class".equals(attrName))
value = getObjectClassName();

     out.startReply();

     out.writeObject(value);

     out.completeReply();
     return;
   }
   else if (method == null) {
     out.startReply();
     out.writeFault("NoSuchMethodException",
	     "The service has no method named: " + in.getMethod(),
	     null);
     out.completeReply();
     return;
   }

   Class []args = method.getParameterTypes();
   Object []values = new Object[args.length];

   for (int i = 0; i < args.length; i++)
     values[i] = in.readObject(args[i]);

   in.completeCall();

   Object result = null;
   
   try {
     result = method.invoke(_service, values);
   } catch (Throwable e) {
     if (e instanceof InvocationTargetException)
       e = ((InvocationTargetException) e).getTargetException();
     out.startReply();
     out.writeFault("ServiceException", e.getMessage(), e);
     out.completeReply();
     return;
   }

   out.startReply();

   out.writeObject(result);
   
   out.completeReply();
 }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:72,代码来源:HessianSkeleton.java

示例14: createInput

import com.caucho.hessian.io.HessianInput; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see marshalsec.AbstractHessianBase#createInput(java.io.ByteArrayInputStream)
 */
@Override
protected AbstractHessianInput createInput ( ByteArrayInputStream bos ) {
    return new HessianInput(bos);
}
 
开发者ID:mbechler,项目名称:marshalsec,代码行数:10,代码来源:Hessian.java


注:本文中的com.caucho.hessian.io.HessianInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。