001/* 002 * Copyright 2002-2013 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.remoting.caucho; 018 019import org.springframework.aop.framework.ProxyFactory; 020import org.springframework.beans.factory.FactoryBean; 021 022/** 023 * {@link FactoryBean} for Hessian proxies. Exposes the proxied service 024 * for use as a bean reference, using the specified service interface. 025 * 026 * <p>Hessian is a slim, binary RPC protocol. 027 * For information on Hessian, see the 028 * <a href="http://hessian.caucho.com">Hessian website</a> 029 * <b>Note: As of Spring 4.0, this proxy factory requires Hessian 4.0 or above.</b> 030 * 031 * <p>The service URL must be an HTTP URL exposing a Hessian service. 032 * For details, see the {@link HessianClientInterceptor} javadoc. 033 * 034 * @author Juergen Hoeller 035 * @since 13.05.2003 036 * @see #setServiceInterface 037 * @see #setServiceUrl 038 * @see HessianClientInterceptor 039 * @see HessianServiceExporter 040 * @see org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean 041 * @see org.springframework.remoting.rmi.RmiProxyFactoryBean 042 */ 043public class HessianProxyFactoryBean extends HessianClientInterceptor implements FactoryBean<Object> { 044 045 private Object serviceProxy; 046 047 048 @Override 049 public void afterPropertiesSet() { 050 super.afterPropertiesSet(); 051 this.serviceProxy = new ProxyFactory(getServiceInterface(), this).getProxy(getBeanClassLoader()); 052 } 053 054 055 @Override 056 public Object getObject() { 057 return this.serviceProxy; 058 } 059 060 @Override 061 public Class<?> getObjectType() { 062 return getServiceInterface(); 063 } 064 065 @Override 066 public boolean isSingleton() { 067 return true; 068 } 069 070}