Foros de discusión

Views not Resolving when using PortalDelegateServlet to expose FacesServlet

Jason Hodge, modificado hace 6 años.

Views not Resolving when using PortalDelegateServlet to expose FacesServlet

New Member Mensajes: 13 Fecha de incorporación: 24/04/17 Mensajes recientes
We are attempting to deploy a plain-ol-JSF-app by exposing it in DXP using Liferay's PortalDelegateServlet. The PortalDelegateServlet requires an HttpServlet rather than a simple Servlet. Since FacesServlet implements javax.servelet.Servlet, rather than extending HttpServlet, we have to wrap the FacesServlet in an HttpServlet implementation and simply forward the init() and service() calls to the wrapped FacesServlet instance.

web.xml snippet:
================
<servlet>
<servlet-name>delegate</servlet-name>
<servlet-class>com.liferay.portal.kernel.servlet.PortalDelegateServlet</servlet-class>
<init-param>
<param-name>servlet-class</param-name>
<param-value>com.excellus.faces.servlet.FacesServletWrapper</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</init-param>
<init-param>
<param-name>sub-context</param-name>
<param-value>faces</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</init-param>
<init-param>
<param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
<param-value>/WEB-INF/resources</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>delegate</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

If we write a response to the output stream in the FacesServletWrapper, the delegate -> wrapper setup works cleanly. We call http://localhost:8080/delegate/faces and get back the written response. But we need it to resolve xhtml facelet views using the FacesServlet implementation.

When we forward the service(req, resp) call to the wrapped facesServlet.service(req, resp) implementation, we get a 404 not found response. We have set the default view in the webapp in the web.xml like this:

web.xml snippet:
===================
<welcome-file-list>
<welcome-file>/views/view.xhtml</welcome-file>
</welcome-file-list>

Though, in this configuration, I'm not sure that this will be used. Whether we call

http://localhost:8080/delegate/faces

or

http://localhost:8080/delegate/faces/views/view.xhtml

...a 404 is getting returned.

What am I missing to get the wrapped FacesServlet instance to resolve our views properly?
thumbnail
Neil Griffin, modificado hace 6 años.

RE: Views not Resolving when using PortalDelegateServlet to expose FacesSer

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Hi Jason,

We haven't tested this use-case before. May I ask, is there a reason why you are not deploying the JSF webapp as a portlet using Liferay Faces Bridge?

Thanks,

Neil
Jason Hodge, modificado hace 6 años.

RE: Views not Resolving when using PortalDelegateServlet to expose FacesSer

New Member Mensajes: 13 Fecha de incorporación: 24/04/17 Mensajes recientes
Hi Neil,

Thanks for taking the time to read my post!

We are migrating a large JSF-based application and need to share the session. If this fails, we will try to wrap it in a JSF portlet extending GenericFacesPortlet, but the app was developed as a stand-alone app and iFramed in. New developments require a session-sharing scenario as we migrate from IBM Portal to DXP.

Jason
Jason Hodge, modificado hace 6 años.

RE: Views not Resolving when using PortalDelegateServlet to expose FacesSer

New Member Mensajes: 13 Fecha de incorporación: 24/04/17 Mensajes recientes
FYI, that is, we need to share the session with 100+ other proper portlets. I should have been more clear.

Thanks,

Jason
thumbnail
Neil Griffin, modificado hace 6 años.

RE: Views not Resolving when using PortalDelegateServlet to expose FacesSer

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Hi Jason,

Is the HttpSession sharing the only thing preventing you from deploying as a JSF portlet? Or are there other servlet-API dependencies as well?

Thanks,

Neil
Jason Hodge, modificado hace 6 años.

RE: Views not Resolving when using PortalDelegateServlet to expose FacesSer

New Member Mensajes: 13 Fecha de incorporación: 24/04/17 Mensajes recientes
Hi Neil,

If possible, we would like to re-host the application un-edited. That said, if we are forced to refactor it into a portlet, I think it would succeed. The effort would be much greater, and there is risk due to the legacy components being used. If it's possible to expose it through the delegate servlet, that is preferable, but not our only option.

Jason
thumbnail
Neil Griffin, modificado hace 6 años.

RE: Views not Resolving when using PortalDelegateServlet to expose FacesSer

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Hi Jason,

The only JSF application deployment that we can officially support is as a portlet using Liferay Faces Bridge. We would be happy to help you with that if you decide to go down that path.

But if you attach an SSCCE of your webapp (preferably a project we can build with Maven or Gradle) then we can take a look and see if there is anything we can offer in the way of advice.

Kind Regards,

Neil
thumbnail
Kyle Joseph Stiemann, modificado hace 6 años.

RE: Views not Resolving when using PortalDelegateServlet to expose FacesSer

Liferay Master Mensajes: 760 Fecha de incorporación: 14/01/13 Mensajes recientes