ASF Bugzilla – Attachment 29685 Details for
Bug 54239
Extensible EL Interpreter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
ELInterpreterFactory
ELInterpreterFactory.java (text/plain), 3.15 KB, created by
Sheldon Shao
on 2012-12-04 06:56:48 UTC
(
hide
)
Description:
ELInterpreterFactory
Filename:
MIME Type:
Creator:
Sheldon Shao
Created:
2012-12-04 06:56:48 UTC
Size:
3.15 KB
patch
obsolete
>package org.apache.jasper.compiler; > >import javax.servlet.ServletContext; > >import org.apache.jasper.JspCompilationContext; > >public class ELInterpreterFactory { > > private ELInterpreterFactory() { > } > > public static final String EL_INTERPRETER_CLASS = System.getProperty(ELInterpreter.class.getName()); > > private static enum DefaultELInterpreter implements ELInterpreter { > INSTANCE; > > /** > * Produces a String representing a call to the EL interpreter. > * > * @param context JspCompilationContext > * @param expression > * a String containing zero or more "${}" expressions > * @param expectedType > * the expected type of the interpreted result > * @param fnmapvar > * Variable pointing to a function map. > * @param XmlEscape > * True if the result should do XML escaping > * @return a String representing a call to the EL interpreter. > */ > @Override > public String interpreterCall(JspCompilationContext context, > boolean isTagFile, String expression, > Class<?> expectedType, String fnmapvar, boolean xmlEscape) { > return JspUtil.interpreterCall(isTagFile, expression, expectedType, fnmapvar, xmlEscape); > } > } > > private static ELInterpreter interpreter; > > public static ELInterpreter getELInterpreter(ServletContext context) { > if (interpreter == null) { > Object conf = context.getAttribute(ELInterpreter.class.getName()); > if (conf == null) { > if (EL_INTERPRETER_CLASS != null) { > interpreter = toInterpreter(context, EL_INTERPRETER_CLASS); > } > else { > interpreter = DefaultELInterpreter.INSTANCE; > } > } > else if (conf instanceof ELInterpreter) { > interpreter = (ELInterpreter)conf; > } > else if (conf instanceof String) { > interpreter = toInterpreter(context, (String)conf); > } > return interpreter; > } > return interpreter; > } > > private static ELInterpreter toInterpreter(ServletContext context, String className) { > try { > Object instance = context.getClassLoader().loadClass(className).newInstance(); > if (instance instanceof ELInterpreter) { > return (ELInterpreter)instance; > } > else { > throw new IllegalStateException("The class for ELInterpreter doesn't implement org.apache.jasper.compiler.ELInterpreter:" + className); > } > } catch (ClassNotFoundException e) { > throw new IllegalStateException("The class for ELInterpreter can't be found:" + className); > } catch (IllegalAccessException e) { > throw new IllegalStateException("Can't create ELInterpreter:" + className); > } catch (InstantiationException e) { > throw new IllegalStateException("Can't create ELInterpreter:" + className); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 54239
:
29684
|
29685
|
29686
|
29693
|
29694
|
29695
|
29696
|
29704
|
29705
|
29706
|
29707
|
29708