001/* 002 * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Thierry Delprat 016 */ 017package org.nuxeo.apidoc.seam; 018 019import java.util.List; 020 021import javax.faces.context.FacesContext; 022import javax.servlet.http.HttpServletRequest; 023 024import org.jboss.seam.ScopeType; 025import org.jboss.seam.annotations.Factory; 026import org.jboss.seam.annotations.Name; 027import org.jboss.seam.annotations.Scope; 028import org.jboss.seam.annotations.Startup; 029import org.nuxeo.apidoc.api.SeamComponentInfo; 030 031@Startup 032@Name("nuxeoSeamIntrospector") 033@Scope(ScopeType.APPLICATION) 034public class SeamComponentIntrospector { 035 036 protected HttpServletRequest getRequest() { 037 FacesContext fContext = FacesContext.getCurrentInstance(); 038 if (fContext == null) { 039 return null; 040 } 041 return (HttpServletRequest) fContext.getExternalContext().getRequest(); 042 } 043 044 @Factory(value = "nuxeoSeamComponents", scope = ScopeType.EVENT) 045 public List<SeamComponentInfo> getNuxeoComponents() { 046 return SeamRuntimeIntrospector.listNuxeoComponents(); 047 } 048}