cancel
Showing results for 
Search instead for 
Did you mean: 

ExternalAccessServlet problem

doblek
Champ in-the-making
Champ in-the-making
Hi,

I've made a portlet that points to the node we want to navigate to using the ExternalAccessServlet and shows the content provided by the Alfresco WebClient using an IFrame html tag…
In order to do so, the appropiate AuthenticationResult object (from which I can extract the ticket) is also created.

Everything works fine for the first time it runs… but it's always displaying wrong nodes and/or users for subsequents portlet renderings…

I mean…
I create the following URL for a user:
http://localhost:8080/alfresco/navigate/browse/workspace/SpacesStore/81ac88b1-c031-11db-8d91-6d811b5...
Then the portlet renders the right content, since Alfresco WebClient navigates to the right node and recognizes the right user…

But then I want the portlet to navigate to the user's home-folder, so I create the following URL:
http://localhost:8080/alfresco/navigate/browse?ticket=TICKET_85e82f42-c5b5-11db-8bf8-1d74e7ea091b
And I'm getting the same result as if I were at the previous node…

Though it's some kind of weird since I open a new browser window, I paste that URL and I navigate to the correct folder (that is, the user's home folder)  Smiley Sad

Something similar happens if the user logs out from the portal… the portlet recognizes the situation, so it ends the session previously opened and builds the right URL:
http://localhost:8080/alfresco/navigate/browse?guest=true
but then the iframe portlet renders the same content again (as if I were the previous user trying to navigate to the initial node) =/
And, as in the former case, if i paste the url to a new browser I get the right node and authentication…

The only explanation I'm able to think of is that my portlet is going through some cache problems…
Does anyone know if I'm wrong? If there is any Alfresco cache problem, how can I solve it?

Thanks in advance =D

Regards,
Enrique
2 REPLIES 2

doblek
Champ in-the-making
Champ in-the-making
Hi,

I've made some tests and I think the problem is related to the logout action. It's like if Alfresco didn't realize that the session has ended… =/

Everytime the portlet detects the portal user changes, the portlet ends the session using webservices:
WebServiceFactory.getAuthenticationService().endSession(session.getTicket());
where session is the AuthenticationResult object returned when the session was started (using web services as well).
But, as I've said, it seems that Alfresco doesn't realize of the fact…

If I click on the Alfresco Web Client link that let the user logout, and refresh the page, the right content is displayed…

I'm thinking in force the logout using the ExternalAccessServlet functionality… Though it looks not too elegant, and besides, ending the session through web wervice should be enough, shouldn't it?

Am I wrong?

Any help would be very much appreciated. 😃

Regards,
Enrique

PS: sorry for my English

doblek
Champ in-the-making
Champ in-the-making
Hi again,

I finally almost solved the problem forcing the logout through the ExternalAccessServlet… using:
//Logout WebClient + WebServices
     private void web_client_logout(RenderResponse response)
        throws IOException{

               String logout_str;
                   logout_str = "http://";
                   logout_str += alfresco_server_address;
                   logout_str += ":" + alfresco_server_port;
                   logout_str += "/alfresco/navigate/logout";

               response.getWriter().println(logout_str);
               response.getWriter().println("<IFRAME SRC=\""+logout_str+"\" HEIGHT=\"0px\" WIDTH=\"0px\"></IFRAME>");
      
               if (session != null){
                    WebServiceFactory.getAuthenticationService().endSession(session.getTicket());
                    session = null;
   }
}

Everything works fine except one case:
A user has been using the ExternalAccessServlet with a ticket. Then that user logs out, so the "guest" user tries to access the Servlet…
I see the following error message:
Estado HTTP 500 -

——————————————————————————–

type Informe de Excepción

mensaje

descripción El servidor encontró un error interno () que hizo que no pudiera rellenar este requerimiento.

excepción

org.alfresco.error.AlfrescoRuntimeException: Failed to authenticate as Guest user.
   org.alfresco.web.app.servlet.AuthenticationHelper.authenticate(AuthenticationHelper.java:209)
   org.alfresco.web.app.servlet.BaseServlet.servletAuthenticate(BaseServlet.java:124)
   org.alfresco.web.app.servlet.ExternalAccessServlet.service(ExternalAccessServlet.java:82)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/5.5.17.

This is the complete error trace:
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 org.alfresco.web.app.servlet.AuthenticationHelper.authenticate(AuthenticationHelper.java:209)
   at org.alfresco.web.app.servlet.BaseServlet.servletAuthenticate(BaseServlet.java:124)
   at org.alfresco.web.app.servlet.ExternalAccessServlet.service(ExternalAccessServlet.java:82)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalStateException: setAttribute: La Sesión ya ha sido invalidada
   at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1247)
   at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:129)
   at org.alfresco.web.app.servlet.AuthenticationHelper.authenticate(AuthenticationHelper.java:180)
   … 17 more
But If I click on "refresh" button on navigator it displays the Homefolder for user "guest"…
Maybe I'm trying to access the ExternalAccessServlet too soon?

Why am I getting such error? It recognizes the "guest" user when nobody has accessed the servlet yet…

Can anyone help me?

Thanks in advance,
Enrique

PS: I'm using Alfresco 1.3, could this problem be solved in a later version?