001/* 002 * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Thierry Delprat 018 */ 019package org.nuxeo.apidoc.seam; 020 021import java.util.List; 022 023import javax.faces.context.FacesContext; 024import javax.servlet.http.HttpServletRequest; 025 026import org.jboss.seam.ScopeType; 027import org.jboss.seam.annotations.Factory; 028import org.jboss.seam.annotations.Name; 029import org.jboss.seam.annotations.Scope; 030import org.jboss.seam.annotations.Startup; 031import org.nuxeo.apidoc.api.SeamComponentInfo; 032 033@Startup 034@Name("nuxeoSeamIntrospector") 035@Scope(ScopeType.APPLICATION) 036public class SeamComponentIntrospector { 037 038 protected HttpServletRequest getRequest() { 039 FacesContext fContext = FacesContext.getCurrentInstance(); 040 if (fContext == null) { 041 return null; 042 } 043 return (HttpServletRequest) fContext.getExternalContext().getRequest(); 044 } 045 046 @Factory(value = "nuxeoSeamComponents", scope = ScopeType.EVENT) 047 public List<SeamComponentInfo> getNuxeoComponents() { 048 return SeamRuntimeIntrospector.listNuxeoComponents(); 049 } 050}