本文整理汇总了Java中org.apache.jasper.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.apache.jasper包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.jasper.Constants; //导入依赖的package包/类
@Override
protected void init(ServletConfig config) {
maxSize = Constants.MAX_POOL_SIZE;
String maxSizeS = getOption(config, OPTION_MAXSIZE, null);
if (maxSizeS != null) {
maxSize = Integer.parseInt(maxSizeS);
if (maxSize < 0) {
maxSize = Constants.MAX_POOL_SIZE;
}
}
perThread = new ThreadLocal<PerThreadData>() {
@Override
protected PerThreadData initialValue() {
PerThreadData ptd = new PerThreadData();
ptd.handlers = new Tag[maxSize];
ptd.current = -1;
perThreadDataVector.addElement(ptd);
return ptd;
}
};
}
示例2: getPageContext
import org.apache.jasper.Constants; //导入依赖的package包/类
@Override
public PageContext getPageContext(Servlet servlet, ServletRequest request,
ServletResponse response, String errorPageURL, boolean needsSession,
int bufferSize, boolean autoflush) {
if( Constants.IS_SECURITY_ENABLED ) {
PrivilegedGetPageContext dp = new PrivilegedGetPageContext(
this, servlet, request, response, errorPageURL,
needsSession, bufferSize, autoflush);
return AccessController.doPrivileged(dp);
} else {
return internalGetPageContext(servlet, request, response,
errorPageURL, needsSession,
bufferSize, autoflush);
}
}
示例3: getCanonicalName
import org.apache.jasper.Constants; //导入依赖的package包/类
/**
* Convert a binary class name into a canonical one that can be used
* when generating Java source code.
*
* @param className Binary class name
* @return Canonical equivalent
*/
private String getCanonicalName(String className) throws JasperException {
Class<?> clazz;
ClassLoader tccl;
if (Constants.IS_SECURITY_ENABLED) {
PrivilegedAction<ClassLoader> pa = new PrivilegedGetTccl();
tccl = AccessController.doPrivileged(pa);
} else {
tccl = Thread.currentThread().getContextClassLoader();
}
try {
clazz = Class.forName(className, false, tccl);
} catch (ClassNotFoundException e) {
throw new JasperException(e);
}
return clazz.getCanonicalName();
}
示例4: PageInfo
import org.apache.jasper.Constants; //导入依赖的package包/类
PageInfo(BeanRepository beanRepository, String jspFile, boolean isTagFile) {
this.isTagFile = isTagFile;
this.jspFile = jspFile;
this.beanRepository = beanRepository;
this.varInfoNames = new HashSet<String>();
this.taglibsMap = new HashMap<String, TagLibraryInfo>();
this.jspPrefixMapper = new HashMap<String, String>();
this.xmlPrefixMapper = new HashMap<String, LinkedList<String>>();
this.nonCustomTagPrefixMap = new HashMap<String, Mark>();
this.imports = new Vector<String>();
this.dependants = new HashMap<String,Long>();
this.includePrelude = new Vector<String>();
this.includeCoda = new Vector<String>();
this.pluginDcls = new Vector<String>();
this.prefixes = new HashSet<String>();
// Enter standard imports
imports.addAll(Constants.STANDARD_IMPORTS);
}
示例5: writeNewInstance
import org.apache.jasper.Constants; //导入依赖的package包/类
private void writeNewInstance(String tagHandlerVar, String tagHandlerClassName) {
out.printin(tagHandlerClassName);
out.print(" ");
out.print(tagHandlerVar);
out.print(" = ");
if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
out.print("(");
out.print(tagHandlerClassName);
out.print(")");
out.print("_jsp_getInstanceManager().newInstance(\"");
out.print(tagHandlerClassName);
out.println("\", this.getClass().getClassLoader());");
} else {
out.print("new ");
out.print(tagHandlerClassName);
out.println("();");
out.printin("_jsp_getInstanceManager().newInstance(");
out.print(tagHandlerVar);
out.println(");");
}
}
示例6: init
import org.apache.jasper.Constants; //导入依赖的package包/类
protected void init(ServletConfig config) {
maxSize = Constants.MAX_POOL_SIZE;
String maxSizeS = getOption(config, OPTION_MAXSIZE, null);
if (maxSizeS != null) {
maxSize = Integer.parseInt(maxSizeS);
if (maxSize < 0) {
maxSize = Constants.MAX_POOL_SIZE;
}
}
perThread = new ThreadLocal() {
protected Object initialValue() {
PerThreadData ptd = new PerThreadData();
ptd.handlers = new Tag[maxSize];
ptd.current = -1;
perThreadDataVector.addElement(ptd);
return ptd;
}
};
}
示例7: get
import org.apache.jasper.Constants; //导入依赖的package包/类
/**
* Gets the next available tag handler from this tag handler pool,
* instantiating one if this tag handler pool is empty.
*
* @param handlerClass Tag handler class
*
* @return Reused or newly instantiated tag handler
*
* @throws JspException if a tag handler cannot be instantiated
*/
public Tag get(Class handlerClass) throws JspException {
Tag handler;
synchronized( this ) {
if (current >= 0) {
handler = handlers[current--];
return handler;
}
}
// Out of sync block - there is no need for other threads to
// wait for us to construct a tag for this thread.
try {
if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
return (Tag) instanceManager.newInstance(handlerClass.getName(), handlerClass.getClassLoader());
} else {
Tag instance = (Tag) handlerClass.newInstance();
if (Constants.INJECT_TAGS) {
instanceManager.newInstance(instance);
}
return instance;
}
} catch (Exception e) {
throw new JspException(e.getMessage(), e);
}
}
示例8: reuse
import org.apache.jasper.Constants; //导入依赖的package包/类
/**
* Adds the given tag handler to this tag handler pool, unless this tag
* handler pool has already reached its capacity, in which case the tag
* handler's release() method is called.
*
* @param handler Tag handler to add to this tag handler pool
*/
public void reuse(Tag handler) {
synchronized( this ) {
if (current < (handlers.length - 1)) {
handlers[++current] = handler;
return;
}
}
// There is no need for other threads to wait for us to release
handler.release();
if (Constants.INJECT_TAGS) {
try {
instanceManager.destroyInstance(handler);
} catch (Exception e) {
log.warn("Error processing preDestroy on tag instance of "
+ handler.getClass().getName(), e);
}
}
}
示例9: resolveEntity
import org.apache.jasper.Constants; //导入依赖的package包/类
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException {
for (int i = 0; i < Constants.CACHED_DTD_PUBLIC_IDS.length; i++) {
String cachedDtdPublicId = Constants.CACHED_DTD_PUBLIC_IDS[i];
if (cachedDtdPublicId.equals(publicId)) {
String resourcePath = Constants.CACHED_DTD_RESOURCE_PATHS[i];
InputStream input = this.getClass().getResourceAsStream(
resourcePath);
if (input == null) {
throw new SAXException(Localizer.getMessage(
"jsp.error.internal.filenotfound", resourcePath));
}
InputSource isrc = new InputSource(input);
return isrc;
}
}
Logger log = Logger.getLogger(MyEntityResolver.class);
if (log.isDebugEnabled())
log.debug("Resolve entity failed" + publicId + " " + systemId);
log.error(Localizer.getMessage("jsp.error.parse.xml.invalidPublicId",
publicId));
return null;
}
示例10: PageInfo
import org.apache.jasper.Constants; //导入依赖的package包/类
PageInfo(BeanRepository beanRepository, String jspFile) {
this.jspFile = jspFile;
this.beanRepository = beanRepository;
this.taglibsMap = new HashMap();
this.jspPrefixMapper = new HashMap();
this.xmlPrefixMapper = new HashMap();
this.nonCustomTagPrefixMap = new HashMap();
this.imports = new Vector();
this.dependants = new Vector();
this.includePrelude = new Vector();
this.includeCoda = new Vector();
this.pluginDcls = new Vector();
this.prefixes = new HashSet();
// Enter standard imports
for(int i = 0; i < Constants.STANDARD_IMPORTS.length; i++)
imports.add(Constants.STANDARD_IMPORTS[i]);
}
示例11: init
import org.apache.jasper.Constants; //导入依赖的package包/类
protected void init(ServletConfig config) {
int maxSize = -1;
String maxSizeS = getOption(config, OPTION_MAXSIZE, null);
if (maxSizeS != null) {
try {
maxSize = Integer.parseInt(maxSizeS);
} catch (Exception ex) {
maxSize = -1;
}
}
if (maxSize < 0) {
maxSize = Constants.MAX_POOL_SIZE;
}
this.handlers = new Tag[maxSize];
this.current = -1;
instanceManager = InstanceManagerFactory.getInstanceManager(config);
}
示例12: writeNewInstance
import org.apache.jasper.Constants; //导入依赖的package包/类
private void writeNewInstance(String tagHandlerVar, String tagHandlerClassName) {
if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
out.printin(tagHandlerClassName);
out.print(" ");
out.print(tagHandlerVar);
out.print(" = (");
out.print(tagHandlerClassName);
out.print(")");
out.print("_jsp_getInstanceManager().newInstance(\"");
out.print(tagHandlerClassName);
out.println("\", this.getClass().getClassLoader());");
} else {
out.printin(tagHandlerClassName);
out.print(" ");
out.print(tagHandlerVar);
out.print(" = (");
out.print("new ");
out.print(tagHandlerClassName);
out.println("());");
out.printin("_jsp_getInstanceManager().newInstance(");
out.print(tagHandlerVar);
out.println(");");
}
}
示例13: init
import org.apache.jasper.Constants; //导入依赖的package包/类
@Override
protected void init(ServletConfig config) {
maxSize = Constants.MAX_POOL_SIZE;
String maxSizeS = getOption(config, OPTION_MAXSIZE, null);
if (maxSizeS != null) {
maxSize = Integer.parseInt(maxSizeS);
if (maxSize < 0) {
maxSize = Constants.MAX_POOL_SIZE;
}
}
perThread = new ThreadLocal<PerThreadData>() {
@Override
protected PerThreadData initialValue() {
PerThreadData ptd = new PerThreadData();
ptd.handlers = new Tag[maxSize];
ptd.current = -1;
perThreadDataVector.addElement(ptd);
return ptd;
}
};
}
示例14: init
import org.apache.jasper.Constants; //导入依赖的package包/类
protected void init(ServletConfig config) {
int maxSize = -1;
String maxSizeS = getOption(config, OPTION_MAXSIZE, null);
if (maxSizeS != null) {
try {
maxSize = Integer.parseInt(maxSizeS);
} catch (Exception ex) {
maxSize = -1;
}
}
if (maxSize < 0) {
maxSize = Constants.MAX_POOL_SIZE;
}
this.handlers = new Tag[maxSize];
this.current = -1;
instanceManager = InstanceManagerFactory.getInstanceManager(config);
}
示例15: get
import org.apache.jasper.Constants; //导入依赖的package包/类
/**
* Gets the next available tag handler from this tag handler pool,
* instantiating one if this tag handler pool is empty.
*
* @param handlerClass
* Tag handler class
* @return Reused or newly instantiated tag handler
* @throws JspException
* if a tag handler cannot be instantiated
*/
public Tag get(Class<? extends Tag> handlerClass) throws JspException {
Tag handler;
synchronized (this) {
if (current >= 0) {
handler = handlers[current--];
return handler;
}
}
// Out of sync block - there is no need for other threads to
// wait for us to construct a tag for this thread.
try {
if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
return (Tag) instanceManager.newInstance(handlerClass.getName(), handlerClass.getClassLoader());
} else {
Tag instance = handlerClass.newInstance();
instanceManager.newInstance(instance);
return instance;
}
} catch (Exception e) {
Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
ExceptionUtils.handleThrowable(t);
throw new JspException(e.getMessage(), t);
}
}