AnsweredAssumed Answered

AMP Customising The Login Page

Question asked by dfernandezgonzalez on Jun 14, 2011
Latest reply on Jul 8, 2011 by dfernandezgonzalez
Hola muy buenas, he seguido las instrucciones de  http://wiki.alfresco.com/wiki/Customising_The_Login_Page, pero quiero meterlo en un AMP.
El problema es que no me sobreescribe el faces-config-custom.xml.


En la carpeta META-INF  faces-config.xml


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                              "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>

   <!– *************************************************************** –>
   <!– Empty JSF config file to prevent errors being thrown during JSF –>
   <!– initialisation. Overwrite this file with your custom version.   –>
   <!– *************************************************************** –>
   <navigation-rule>
      <description>
         The decision rule used by the NavigationHandler to
         determine which view must be displayed after the
         current view, login.jsp is processed.
      </description>
      <from-view-id>/jsp/extension/login.jsp</from-view-id>
      <navigation-case>
         <description>
             Indicates to the NavigationHandler that the browse.jsp
             view must be displayed if the Action referenced by a
             UICommand component on the login.jsp view returns
             the outcome "success".
         </description>
         <from-outcome>success</from-outcome>
         <to-view-id>/jsp/browse/browse.jsp</to-view-id>
      </navigation-case>
   </navigation-rule>

   <!– rule to get back to the login page from anywhere –>
   <navigation-rule>
      <from-view-id>/jsp/*</from-view-id>
      <navigation-case>
         <from-outcome>logout</from-outcome>
         <to-view-id>/jsp/extension/login.jsp</to-view-id>
      </navigation-case>
      <navigation-case>
         <from-outcome>relogin</from-outcome>
         <to-view-id>/jsp/extension/relogin.jsp</to-view-id>
      </navigation-case>
   </navigation-rule>
 
</faces-config>



en la carpeta WEB -INF  faces-config-custom.xml


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                              "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>

    <managed-bean>
      <description>
         The bean that backs up the Login screen
      </description>
      <managed-bean-name>LoginBean</managed-bean-name>
      <managed-bean-class>org.alfresco.module.CustomLoginBean</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
         <property-name>nodeService</property-name>
         <value>#{NodeService}</value>
      </managed-property>
      <managed-property>
         <property-name>authenticationService</property-name>
         <value>#{AuthenticationService}</value>
      </managed-property>
      <managed-property>
         <property-name>personService</property-name>
         <value>#{PersonService}</value>
      </managed-property>
      <managed-property>
         <property-name>navigator</property-name>
         <value>#{NavigationBean}</value>
      </managed-property>
      <managed-property>
         <property-name>browseBean</property-name>
         <value>#{BrowseBean}</value>
      </managed-property>
      <managed-property>
         <property-name>userPreferencesBean</property-name>
         <value>#{UserPreferencesBean}</value>
      </managed-property>
   </managed-bean>

</faces-config>



Despues de compilar y añadir el modulo al archivo war, el archivo

tomcat/webapps/alfresco/WEB-INF/faces-config-custom.xml  está vacío.

La clase CustomLoginBean



package org.alfresco.module;

import java.util.Date;

import org.alfresco.web.bean.LoginBean;
import org.apache.log4j.Logger;

public class CustomLoginBean extends LoginBean
{
 
   /**
   * Log variable
   */
   private Logger logger = Logger.getLogger(CustomLoginBean.class);

   @Override
   public String login()
   {
      logger.debug("LOGIN has logged in at " + new Date());

      String outcome = super.login();

      // log to the console who logged in and when
      String username = this.getUsername();
      if (username == null)
      {
         username = "Guest";
      }

     

      return outcome;
   }

   @Override
   public String logout()
   {
      String outcome = super.logout();

      // log to the console who logged out and when
      String username = this.getUsername();
      if (username == null)
      {
         username = "Guest";
      }

      logger.debug(username + " logged out at " + new Date());

      return outcome;
   }
}


y el archivo log4j.properties dentro del AMP

log4j.logger.org.alfresco.module.CustomLoginBean=debug

Cuando hago login no me imprime nada, estuve buscando pero no encuentro nada.

No sé sobreescribir los beans desde un modulo AMP.

Alguna sugerencia?

Graciñas por adelantado

Outcomes