当前位置: 首页>>代码示例>>Java>>正文


Java Localizer类代码示例

本文整理汇总了Java中org.apache.jasper.compiler.Localizer的典型用法代码示例。如果您正苦于以下问题:Java Localizer类的具体用法?Java Localizer怎么用?Java Localizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Localizer类属于org.apache.jasper.compiler包,在下文中一共展示了Localizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
public Class<?> load() throws JasperException {
    try {
        getJspLoader();

        String name = getFQCN();
        servletClass = jspLoader.loadClass(name);
    } catch (ClassNotFoundException cex) {
        throw new JasperException(Localizer.getMessage("jsp.error.unable.load"),
                                  cex);
    } catch (Exception ex) {
        throw new JasperException(Localizer.getMessage("jsp.error.unable.compile"),
                                  ex);
    }
    removed = 0;
    return servletClass;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:JspCompilationContext.java

示例2: createOutputDir

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
protected void createOutputDir() {
    String path = null;
    if (isTagFile()) {
        String tagName = tagInfo.getTagClassName();
        path = tagName.replace('.', File.separatorChar);
        path = path.substring(0, path.lastIndexOf(File.separatorChar));
    } else {
        path = getServletPackageName().replace('.',File.separatorChar);
    }

        // Append servlet or tag handler path to scratch dir
        try {
            File base = options.getScratchDir();
            baseUrl = base.toURI().toURL();
            outputDir = base.getAbsolutePath() + File.separator + path +
                File.separator;
            if (!makeOutputDir()) {
                throw new IllegalStateException(Localizer.getMessage("jsp.error.outputfolder"));
            }
        } catch (MalformedURLException e) {
            throw new IllegalStateException(Localizer.getMessage("jsp.error.outputfolder"), e);
        }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:JspCompilationContext.java

示例3: initWebXml

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
protected void initWebXml() {
    try {
        if (webxmlLevel >= INC_WEBXML) {
            mapout = openWebxmlWriter(new File(webxmlFile));
            servletout = new CharArrayWriter();
            mappingout = new CharArrayWriter();
        } else {
            mapout = null;
            servletout = null;
            mappingout = null;
        }
        if (webxmlLevel >= ALL_WEBXML) {
            mapout.write(Localizer.getMessage("jspc.webxml.header"));
            mapout.flush();
        } else if ((webxmlLevel>= INC_WEBXML) && !addWebXmlMappings) {
            mapout.write(Localizer.getMessage("jspc.webinc.header"));
            mapout.flush();
        }
    } catch (IOException ioe) {
        mapout = null;
        servletout = null;
        mappingout = null;
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:25,代码来源:JspC.java

示例4: completeWebXml

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
protected void completeWebXml() {
    if (mapout != null) {
        try {
            servletout.writeTo(mapout);
            mappingout.writeTo(mapout);
            if (webxmlLevel >= ALL_WEBXML) {
                mapout.write(Localizer.getMessage("jspc.webxml.footer"));
            } else if ((webxmlLevel >= INC_WEBXML) && !addWebXmlMappings) {
                mapout.write(Localizer.getMessage("jspc.webinc.footer"));
            }
            mapout.close();
        } catch (IOException ioe) {
            // noting to do if it fails since we are done with it
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:JspC.java

示例5: findAttribute

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
@Override
public Object findAttribute(String name) {

    if (name == null) {
        throw new NullPointerException(Localizer
                .getMessage("jsp.error.attribute.null_name"));
    }

    Object o = pageAttributes.get(name);
    if (o == null) {
        o = rootJspCtxt.getAttribute(name, REQUEST_SCOPE);
        if (o == null) {
            if (getSession() != null) {
                o = rootJspCtxt.getAttribute(name, SESSION_SCOPE);
            }
            if (o == null) {
                o = rootJspCtxt.getAttribute(name, APPLICATION_SCOPE);
            }
        }
    }

    return o;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:JspContextWrapper.java

示例6: findAttribute

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
@Override
public Object findAttribute(final String name) {
    if (SecurityUtil.isPackageProtectionEnabled()) {
        return AccessController.doPrivileged(
                new PrivilegedAction<Object>() {
            @Override
            public Object run() {
                if (name == null) {
                    throw new NullPointerException(Localizer
                            .getMessage("jsp.error.attribute.null_name"));
                }

                return doFindAttribute(name);
            }
        });
    } else {
        if (name == null) {
            throw new NullPointerException(Localizer
                    .getMessage("jsp.error.attribute.null_name"));
        }

        return doFindAttribute(name);
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:25,代码来源:PageContextImpl.java

示例7: handleGetProperty

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
public static Object handleGetProperty(Object o, String prop)
throws JasperException {
    if (o == null) {
        throw new JasperException(
                Localizer.getMessage("jsp.error.beans.nullbean"));
    }
    Object value = null;
    try {
        Method method = getReadMethod(o.getClass(), prop);
        value = method.invoke(o, (Object[]) null);
    } catch (Exception ex) {
        Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
        ExceptionUtils.handleThrowable(thr);
        throw new JasperException (ex);
    }
    return value;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:JspRuntimeLibrary.java

示例8: completeWebXml

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
protected void completeWebXml() {
	if (mapout != null) {
		try {
			servletout.writeTo(mapout);
			mappingout.writeTo(mapout);
			if (webxmlLevel >= ALL_WEBXML) {
				mapout.write(Localizer.getMessage("jspc.webxml.footer"));
			} else if ((webxmlLevel >= INC_WEBXML) && !addWebXmlMappings) {
				mapout.write(Localizer.getMessage("jspc.webinc.footer"));
			}
			mapout.close();
		} catch (IOException ioe) {
			// noting to do if it fails since we are done with it
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:JspC.java

示例9: getValueFromPropertyEditorManager

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
public static Object getValueFromPropertyEditorManager(
                 Class<?> attrClass, String attrName, String attrValue) 
    throws JasperException 
{
    try {
        PropertyEditor propEditor = 
            PropertyEditorManager.findEditor(attrClass);
        if (propEditor != null) {
            propEditor.setAsText(attrValue);
            return propEditor.getValue();
        } else {
            throw new IllegalArgumentException(
                Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
        }
    } catch (IllegalArgumentException ex) {
        throw new JasperException(
            Localizer.getMessage("jsp.error.beans.property.conversion",
                                 attrValue, attrClass.getName(), attrName,
                                 ex.getMessage()));
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:22,代码来源:JspRuntimeLibrary.java

示例10: getValueFromBeanInfoPropertyEditor

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
public static Object getValueFromBeanInfoPropertyEditor(
                       Class<?> attrClass, String attrName, String attrValue,
                       Class<?> propertyEditorClass) 
    throws JasperException 
{
    try {
        PropertyEditor pe =
            (PropertyEditor)propertyEditorClass.newInstance();
        pe.setAsText(attrValue);
        return pe.getValue();
    } catch (Exception ex) {
        throw new JasperException(
            Localizer.getMessage("jsp.error.beans.property.conversion",
                                 attrValue, attrClass.getName(), attrName,
                                 ex.getMessage()));
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:JspRuntimeLibrary.java

示例11: getAttribute

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
@Override
public Object getAttribute(final String name) {

    if (name == null) {
        throw new NullPointerException(Localizer
                .getMessage("jsp.error.attribute.null_name"));
    }

    if (SecurityUtil.isPackageProtectionEnabled()) {
        return AccessController.doPrivileged(
                new PrivilegedAction<Object>() {
            @Override
            public Object run() {
                return doGetAttribute(name);
            }
        });
    } else {
        return doGetAttribute(name);
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:PageContextImpl.java

示例12: doGetAttribute

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
private Object doGetAttribute(String name, int scope) {
    switch (scope) {
    case PAGE_SCOPE:
        return attributes.get(name);

    case REQUEST_SCOPE:
        return request.getAttribute(name);

    case SESSION_SCOPE:
        if (session == null) {
            throw new IllegalStateException(Localizer
                    .getMessage("jsp.error.page.noSession"));
        }
        return session.getAttribute(name);

    case APPLICATION_SCOPE:
        return context.getAttribute(name);

    default:
        throw new IllegalArgumentException("Invalid scope");
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:23,代码来源:PageContextImpl.java

示例13: handleMissingResource

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
private void handleMissingResource(HttpServletRequest request, HttpServletResponse response, String jspUri)
		throws ServletException, IOException {

	String includeRequestUri = (String) request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI);

	if (includeRequestUri != null) {
		// This file was included. Throw an exception as
		// a response.sendError() will be ignored
		String msg = Localizer.getMessage("jsp.error.file.not.found", jspUri);
		// Strictly, filtering this is an application
		// responsibility but just in case...
		throw new ServletException(SecurityUtil.filter(msg));
	} else {
		try {
			response.sendError(HttpServletResponse.SC_NOT_FOUND, request.getRequestURI());
		} catch (IllegalStateException ise) {
			log.error(Localizer.getMessage("jsp.error.file.not.found", jspUri));
		}
	}
	return;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:22,代码来源:JspServlet.java

示例14: setAttribute

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
@Override
public void setAttribute(String name, Object value, int scope) {

	if (name == null) {
		throw new NullPointerException(Localizer.getMessage("jsp.error.attribute.null_name"));
	}

	if (scope == PAGE_SCOPE) {
		if (value != null) {
			pageAttributes.put(name, value);
		} else {
			removeAttribute(name, PAGE_SCOPE);
		}
	} else {
		rootJspCtxt.setAttribute(name, value, scope);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:18,代码来源:JspContextWrapper.java

示例15: doRemoveAttribute

import org.apache.jasper.compiler.Localizer; //导入依赖的package包/类
private void doRemoveAttribute(String name, int scope) {
	switch (scope) {
	case PAGE_SCOPE:
		attributes.remove(name);
		break;

	case REQUEST_SCOPE:
		request.removeAttribute(name);
		break;

	case SESSION_SCOPE:
		if (session == null) {
			throw new IllegalStateException(Localizer.getMessage("jsp.error.page.noSession"));
		}
		session.removeAttribute(name);
		break;

	case APPLICATION_SCOPE:
		context.removeAttribute(name);
		break;

	default:
		throw new IllegalArgumentException("Invalid scope");
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:26,代码来源:PageContextImpl.java


注:本文中的org.apache.jasper.compiler.Localizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。