Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,6 @@ public UIViewRoot getViewRoot()
{
return FacesContext.getCurrentInstance().getViewRoot();
}

@Produces
@Named("session")
@FacesScoped
public Object getSession()
{
return FacesContext.getCurrentInstance().getExternalContext().getSession(false);
}


/*
The spec actually forces us the use producers for "cc" and "component but it leads to a bad performance.
Expand Down Expand Up @@ -213,4 +204,29 @@ public Map<String, Object> getViewMap()
return FacesContext.getCurrentInstance().getViewRoot().getViewMap();
}


/*
The spec actually forces us the use producers for "session" and "request" but this conflicts with CDI spec actually,
because CDI is responsible for producing HttpServletRequest and HttpSession
We will still use ELResolvers for this - see ImplicitObjectResolver#makeResolverForFacesCDI().

See MYFACES-4432 / MYFACES-4394

/*
@Produces
@Named("session")
@FacesScoped
public Object getSession()
{
return FacesContext.getCurrentInstance().getExternalContext().getSession(false);
}
@Produces
@Named("request")
@FacesScoped
public Object getRequest()
{
return FacesContext.getCurrentInstance().getExternalContext().getRequest();
}
*/

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ public static ELResolver makeResolverForFacesCDI()

io = new CompositeComponentImplicitObject();
forFacesCDIList.put(io.getName(), io);

// see MYFACES-4432 / MYFACES-4394
io = new RequestImplicitObject();
forFacesCDIList.put(io.getName(), io);

io = new SessionImplicitObject();
forFacesCDIList.put(io.getName(), io);

return new ImplicitObjectResolver(forFacesCDIList);
}
Expand Down