AnsweredAssumed Answered

ExternalAccessServlet and portlets

Question asked by doblek on Mar 6, 2007

I've made a portlet that connects to the Alfresco webapp through the ExternalAccessServlet, IFrames and WebServices. The portlet manages the sessions and redirects to the appropiate node thanks to the ExternalAccessServlet.

Everything works fine except in one case: some registered user makes the portlet render, and then is the guest user who is willing to access the portlet. In that case, Alfresco throws an exception (saying "Failed to authenticate as Guest User" because "session is not valid" —see the quoted text—), though if I make the portal to render the portal page again, it works.
It's weird because if it's another registered user who is accessing the portlet after the first registered user, it works…

16:50:59,406 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/alfresco].[externalAccess]] Servlet.service() para servlet externalAccess lanzó excepción
org.alfresco.error.AlfrescoRuntimeException: Failed to authenticate as Guest user.
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(
at org.apache.tomcat.util.threads.ThreadPool$
Caused by: java.lang.IllegalStateException: setAttribute: La Sesión ya ha sido invalidada
at org.apache.catalina.session.StandardSession.setAttribute(
at org.apache.catalina.session.StandardSessionFacade.setAttribute(
… 17 more

To sum up portlet functionality (supposed that Alfresco webapp is deployed in the same machine where the portal is deployed and it's accessible at "http://localhost:8080/alfresco"):

portlet detects if the user who is viewing the portlet has changed since the last render phase. If so:
     - if there is a session opened, logout:
               send in response an IFRAME html tag with src="http://localhost:8080/alfresco/navigate/logout"
               end the session using the webservices (the ticket created is no more needed)
     - if there is no session opened (the user was "guest user"), just send an IFRAME html tag with src="http://localhost:8080/alfresco/navigate/logout"
     - Then, in both cases, creates the ticket needed:
               · if actual user is guest: ?guest=true
               · if actual user is a registered user: starts a new session using web services and retrieves the new ticket
     - Finally, the URL we want to navigate is created using the ticket, and it's sended using an IFRAME html tag:
          <IFRAME SRC="http://localhost:8080/alfresco/navigate/browse/workspace/store/uuid?guest=true">
          <IFRAME SRC="http://localhost:8080/alfresco/navigate/browse/workspace/store/uuid?ticket=TICKET_xxxxxxxxxx">

If it detects no user change, it does nothing.

Am I seeing the expected behaviour of the servlet? If I navigate that URLs in the web browser I get a different result   :cry:

Does anyone know how can I solve this issue?

Please, respond as soon as possible… it's some kind of urgent =(

Thanks in advance for the advices.


PS: I'm using Alfresco 1.3 for the moment…