Ok,
After getting the sources for jsf-portet.jar (com.sun.faces.portlet) I
managed to make same progress. I've get output from XHTML!
There's couple issues with com.sun.faces.portlet.FacesPortlet. First the method
getFacesContextFactory() always uses
com.sun.faces.context.FacesContextFactoryImpl instead of
com.sun.faces.portlet.FacesContextFactory. This causes issues and has to be
fixed.
Broken getFacesContextFactory() from com.sun.faces.portlet.FacesPortlet. I just
don't know to to wire FactoryFinder to use
com.sun.faces.portlet.FacesContextFactory.
| public FacesContextFactory getFacesContextFactory() throws
PortletException{
| if (facesContextFactory != null) {
| return facesContextFactory;
| }
| // Acquire our FacesContextFactory instance
| try {
| facesContextFactory = (FacesContextFactory)
| FactoryFinder.getFactory
| (FactoryFinder.FACES_CONTEXT_FACTORY);
| logger.log(Level.FINEST, "PS_CSFP0010", facesContextFactory);
| } catch (FacesException e) {
| Throwable rootCause = e.getCause();
| if (rootCause == null) {
| throw e;
| } else {
| throw new PortletException(e.getMessage(), rootCause);
| }
| }
| return facesContextFactory;
| }
|
So I overrided the methodin custom portlet class:
| @Override
| public FacesContextFactory getFacesContextFactory() throws
PortletException {
|
| if (facesContextFactory != null) {
| return facesContextFactory;
| }
|
| facesContextFactory = new
com.sun.faces.portlet.FacesContextFactoryImpl();
|
| return facesContextFactory;
| }
|
Also FacesPortlet.getLifecycle() uses the same javax.faces.FactoryFinder which
has hardcoded/or just I known know how names for factories.
I also override getLifecycleFactory() and getLifecycle() to return classes from
com.sun.faces.portlet.
In getLifecycle() copy the phaselisteners from super.getLifecycle() to here.
super.lifecycle has all the phaselisteners EL,Seam, and our custom phaselister
from faces-config.
| Lifecycle superLifecycle = super.getLifecycle();
| PhaseListener phs[] =
superLifecycle.getPhaseListeners();
| for (PhaseListener phaseListener : phs) {
| lifecycle.addPhaseListener(phaseListener);
| }
|
Then I simply make kick Seam with this new portlet lifecycle stuff in my
portlet class:
| @Override
| protected void doDispatch(RenderRequest request, RenderResponse
response)
| throws PortletException, PortletSecurityException,
IOException {
|
| FacesContext context = getFacesContextFactory().getFacesContext(
| getPortletConfig().getPortletContext(),
request, response,
| getLifecycle());
|
| ExternalContext externalContext = context.getExternalContext();
|
| // Kick start Seam Contextes
| FacesLifecycle.beginRequest(externalContext);
|
| super.doDispatch(request, response);
|
| // Tell Seam Lifecycle manager that're about to end request
| FacesLifecycle.endRequest(externalContext);
|
| }
|
I also've custom FaceletViewHandler with modified createResponseWriter, which
is related to facelets and available from Facelets site.
So, basic stuff seems to work now. Let's see how conversations and others work.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097172#4097172
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097172
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user