1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.myfaces.el.unified;
20
21 import javax.el.ELContext;
22 import javax.el.ELResolver;
23 import javax.el.FunctionMapper;
24 import javax.el.VariableMapper;
25 import javax.faces.context.FacesContext;
26
27 /**
28 * ELContext used for JSF.
29 *
30 * @author Stan Silvert
31 */
32 public class FacesELContext extends ELContext
33 {
34
35 private ELResolver _elResolver;
36 private FunctionMapper _functionMapper;
37 private VariableMapper _variableMapper;
38
39 public FacesELContext(ELResolver elResolver, FacesContext facesContext)
40 {
41 this._elResolver = elResolver;
42 putContext(FacesContext.class, facesContext);
43
44 // TODO: decide if we need to implement our own FunctionMapperImpl and
45 // VariableMapperImpl instead of relying on Tomcat's version.
46 // this.functionMapper = new FunctionMapperImpl();
47 // this.variableMapper = new VariableMapperImpl();
48 }
49
50 @Override
51 public VariableMapper getVariableMapper()
52 {
53 return _variableMapper;
54 }
55
56 public void setVariableMapper(VariableMapper varMapper)
57 {
58 _variableMapper = varMapper;
59 }
60
61 @Override
62 public FunctionMapper getFunctionMapper()
63 {
64 return _functionMapper;
65 }
66
67 public void setFunctionMapper(FunctionMapper functionMapper)
68 {
69 _functionMapper = functionMapper;
70 }
71
72 @Override
73 public ELResolver getELResolver()
74 {
75 return _elResolver;
76 }
77
78 }