import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import com.fujitsu.uji.ext.Call;
import com.fujitsu.uji.ext.CallFactory;
import com.fujitsu.uji.ext.InitialCallFactory;
import com.fujitsu.uji.ResponseBean;
public class MyBean {
public String doAction(){
...
try{
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ec = fc.getExternalContext();
ServletContext sc = (ServletContext)ec.getContext();
CallFactory factory = (CallFactory)InitialCallFactory.createFactory(sc, this.getClass().getClassLoader());
Call call = factory.createCall("myejb");
ResponseBean responseBean = (ResponseBean)call.invoke(dataBean, "verb");
} catch(Throwable e){
...
}
...
}
}
|