一个jsf的face-config.xml看不懂

刚学习jsf,公司一个jsf工程里的face-config.xml看不懂,请大家指点一下!

<?xml version="1.0"?>
<!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>
    <application>
        <view-handler>com.xxx.framework.jsf.viewhandler.XxxJspDynamicViewerHandler</view-handler>
        <state-manager>com.xxx.framework.jsf.XxxAjaxStateManager</state-manager>
    </application>
</faces-config>


package com.Xxx.framework.jsf.viewhandler;

import javax.faces.context.FacesContext;
import org.apache.myfaces.application.jsp.JspViewHandlerImpl;
import com.xxx.framework.constant.FwkConstant;
import com.xxx.framework.logging.AppLogFactory;
import com.xxx.framework.logging.ILog;

public class XxxJspDynamicViewerHandler extends JspViewHandlerImpl {

	
	// For logging:
	private final ILog log = AppLogFactory.getLog(XxxJspDynamicViewerHandler.class, FwkConstant.MODULE_SECURITY);
	
	public String getActionURL(FacesContext facesContext, String viewId) {
	    String path = "";
	    int nIndexOfFollowingParamSign = -1;
	    if ( XxxJspDynamicViewerHandler.containsXxxJspViewHandlerImpIndicator(viewId) ) {

	        nIndexOfFollowingParamSign = viewId.indexOf("?");
	        if ( -1 != nIndexOfFollowingParamSign) {
	            path = super.getActionURL(facesContext, viewId) + viewId.substring(nIndexOfFollowingParamSign);
	        } // end if
	    } // end if


	    if ( path != null && path.length() == 0 ) {
	        path = super.getActionURL(facesContext, viewId);
	    }

	    return path;
	}
	
	public static boolean containsXxxJspViewHandlerImpIndicator(String paramStr)  {
	    return ((null != paramStr) && (paramStr.indexOf(FwkConstant.Xxx_VIEWHANDLER_INDICATOR) != -1)) ? true : false;
	}		
	
}


package com.Xxx.framework.jsf;

import javax.faces.application.StateManager;
import javax.faces.context.ExternalContext;

import org.ajax4jsf.application.AjaxStateManager;

public class XxxAjaxStateManager extends AjaxStateManager{
	private static final String VIEW_PARAM_KEY = "com.wtt.framework.NUMBER_OF_STATES_IN_VIEW";
	private int numberOfViews = -1;
	
	public XxxAjaxStateManager(StateManager stateManager) {
		super(stateManager);
	}
	
	@Override
	protected int getNumberOfViews(ExternalContext externalContext) {
		if (this.numberOfViews == -1) {
			if (externalContext.getInitParameter(VIEW_PARAM_KEY) != null) {
				try {
					this.numberOfViews = Integer.valueOf(externalContext.getInitParameter(VIEW_PARAM_KEY));
				} catch (NumberFormatException nfe) {
					this.numberOfViews = super.getNumberOfViews(externalContext);
				}
			}
		}
		return this.numberOfViews;
	}
}

你可能感兴趣的:(xml,jsp,JSF,Security,sun)