|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.el.ELResolver
org.apache.myfaces.el.unified.resolver.ManagedBeanResolver
org.apache.myfaces.el.unified.resolver.GuiceResolver
public class GuiceResolver
Register this ELResolver in faces-config.xml.
<application> <el-resolver>org.apache.myfaces.el.unified.resolver.GuiceResolver</el-resolver> </application>Implement and configure a ServletContextListener in web.xml .
<listener>Configure Guice in your ServletContextListener implementation, and place the Injector in application scope.
public class GuiceServletContextListener implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { ServletContext ctx = event.getServletContext(); //when on Java6, use ServiceLoader.load(com.google.inject.Module.class); Injector injector = Guice.createInjector(new YourModule()); ctx.setAttribute(GuiceResolver.KEY, injector); } public void contextDestroyed(ServletContextEvent event) { ServletContext ctx = event.getServletContext(); ctx.removeAttribute(GuiceResolver.KEY); } }
| Field Summary | |
|---|---|
static java.lang.String |
KEY
|
| Fields inherited from class org.apache.myfaces.el.unified.resolver.ManagedBeanResolver |
|---|
_scopes, s_standardScopes |
| Fields inherited from class javax.el.ELResolver |
|---|
RESOLVABLE_AT_DESIGN_TIME, TYPE |
| Constructor Summary | |
|---|---|
GuiceResolver()
|
|
| Method Summary | |
|---|---|
java.lang.Object |
getValue(javax.el.ELContext ctx,
java.lang.Object base,
java.lang.Object property)
|
| Methods inherited from class org.apache.myfaces.el.unified.resolver.ManagedBeanResolver |
|---|
getCommonPropertyType, getFeatureDescriptors, getType, isReadOnly, runtimeConfig, setValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String KEY
| Constructor Detail |
|---|
public GuiceResolver()
| Method Detail |
|---|
public java.lang.Object getValue(javax.el.ELContext ctx,
java.lang.Object base,
java.lang.Object property)
throws java.lang.NullPointerException,
javax.el.PropertyNotFoundException,
javax.el.ELException
getValue in class ManagedBeanResolverjava.lang.NullPointerException
javax.el.PropertyNotFoundException
javax.el.ELException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||