001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS <http://nuxeo.com> and others 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Jean-Marc Orliaguet, Chalmers 011 * 012 * $Id$ 013 */ 014 015package org.nuxeo.theme.jsf.negotiation.theme; 016 017import java.util.Map; 018 019import javax.faces.context.FacesContext; 020 021import org.nuxeo.theme.Manager; 022import org.nuxeo.theme.elements.PageElement; 023import org.nuxeo.theme.negotiation.Scheme; 024 025public final class RequestParameter implements Scheme { 026 027 public String getOutcome(final Object context) { 028 final Map<String, String> parameters = ((FacesContext) context).getExternalContext().getRequestParameterMap(); 029 final String path = parameters.get("theme"); 030 final PageElement page = Manager.getThemeManager().getPageByPath(path); 031 if (page != null) { 032 return path; 033 } 034 return null; 035 } 036 037}