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


Java Localizer.getMessage方法代码示例

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


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

示例1: 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:lamsfoundation,项目名称:lams,代码行数:23,代码来源:PageContextImpl.java

示例2: removeAttribute

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

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

	if (SecurityUtil.isPackageProtectionEnabled()) {
		AccessController.doPrivileged(new PrivilegedAction<Void>() {
			@Override
			public Void run() {
				doRemoveAttribute(name);
				return null;
			}
		});
	} else {
		doRemoveAttribute(name);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:20,代码来源:PageContextImpl.java

示例3: read

import org.apache.jasper.compiler.Localizer; //导入方法依赖的package包/类
/**
 * Read characters into a portion of an array.  This method will block
 * until some input is available, an I/O error occurs, or the end of the
 * stream is reached.
 *
 * @param      ch     Destination buffer
 * @param      offset Offset at which to start storing characters
 * @param      length Maximum number of characters to read
 *
 * @return     The number of characters read, or -1 if the end of the
 *             stream has been reached
 *
 * @exception  IOException  If an I/O error occurs
 */
@Override
public int read(char ch[], int offset, int length) throws IOException {
    if (length > fBuffer.length) {
        length = fBuffer.length;
    }
    int count = fInputStream.read(fBuffer, 0, length);
    for (int i = 0; i < count; i++) {
        int b0 = (0xff & fBuffer[i]); // Convert to unsigned
        if (b0 > 0x80) {
            throw new IOException(Localizer.getMessage("jsp.error.xml.invalidASCII",
                                                       Integer.toString(b0)));
        }
        ch[offset + i] = (char)b0;
    }
    return count;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:31,代码来源:ASCIIReader.java

示例4: findAttribute

import org.apache.jasper.compiler.Localizer; //导入方法依赖的package包/类
public Object findAttribute(final String name) {
	if (SecurityUtil.isPackageProtectionEnabled()) {
		return AccessController.doPrivileged(new PrivilegedAction() {
			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:lamsfoundation,项目名称:lams,代码行数:22,代码来源:PageContextImpl.java

示例5: 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:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:PageContextImpl.java

示例6: 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:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:19,代码来源:JspContextWrapper.java

示例7: 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:how2j,项目名称:lazycat,代码行数:23,代码来源:JspCompilationContext.java

示例8: setAttribute

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

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

	if (SecurityUtil.isPackageProtectionEnabled()) {
		AccessController.doPrivileged(new PrivilegedAction<Void>() {
			@Override
			public Void run() {
				doSetAttribute(name, o, scope);
				return null;
			}
		});
	} else {
		doSetAttribute(name, o, scope);
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:PageContextImpl.java

示例9: doForward

import org.apache.jasper.compiler.Localizer; //导入方法依赖的package包/类
private void doForward(String relativeUrlPath) throws ServletException,
		IOException {

	// JSP.4.5 If the buffer was flushed, throw IllegalStateException
	try {
		out.clear();
	} catch (IOException ex) {
		IllegalStateException ise = new IllegalStateException(Localizer
				.getMessage("jsp.error.attempt_to_clear_flushed_buffer"));
		ise.initCause(ex);
		throw ise;
	}

	// Make sure that the response object is not the wrapper for include
	while (response instanceof ServletResponseWrapperInclude) {
		response = ((ServletResponseWrapperInclude) response).getResponse();
	}

	final String path = getAbsolutePathRelativeToContext(relativeUrlPath);
	String includeUri = (String) request
			.getAttribute(Constants.INC_SERVLET_PATH);

	if (includeUri != null)
		request.removeAttribute(Constants.INC_SERVLET_PATH);
	try {
		context.getRequestDispatcher(path).forward(request, response);
	} finally {
		if (includeUri != null)
			request.setAttribute(Constants.INC_SERVLET_PATH, includeUri);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:PageContextImpl.java

示例10: doSetAttribute

import org.apache.jasper.compiler.Localizer; //导入方法依赖的package包/类
private void doSetAttribute(String name, Object o, int scope) {
    if (o != null) {
        switch (scope) {
        case PAGE_SCOPE:
            attributes.put(name, o);
            break;

        case REQUEST_SCOPE:
            request.setAttribute(name, o);
            break;

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

        case APPLICATION_SCOPE:
            context.setAttribute(name, o);
            break;

        default:
            throw new IllegalArgumentException("Invalid scope");
        }
    } else {
        removeAttribute(name, scope);
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:31,代码来源:PageContextImpl.java

示例11: removeAttribute

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

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

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

示例12: createCompiler

import org.apache.jasper.compiler.Localizer; //导入方法依赖的package包/类
/**
 * Create a "Compiler" object based on some init param data. This is not
 * done yet. Right now we're just hardcoding the actual compilers that are
 * created.
 */
public Compiler createCompiler() {
	if (jspCompiler != null) {
		return jspCompiler;
	}
	jspCompiler = null;
	if (options.getCompilerClassName() != null) {
		jspCompiler = createCompiler(options.getCompilerClassName());
	} else {
		if (options.getCompiler() == null) {
			jspCompiler = createCompiler("org.apache.jasper.compiler.JDTCompiler");
			if (jspCompiler == null) {
				jspCompiler = createCompiler("org.apache.jasper.compiler.AntCompiler");
			}
		} else {
			jspCompiler = createCompiler("org.apache.jasper.compiler.AntCompiler");
			if (jspCompiler == null) {
				jspCompiler = createCompiler("org.apache.jasper.compiler.JDTCompiler");
			}
		}
	}
	if (jspCompiler == null) {
		throw new IllegalStateException(Localizer.getMessage("jsp.error.compiler"));
	}
	jspCompiler.init(this, jsw);
	return jspCompiler;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:JspCompilationContext.java

示例13: getReadMethod

import org.apache.jasper.compiler.Localizer; //导入方法依赖的package包/类
public static Method getReadMethod(Class beanClass, String prop)
    throws JasperException {

       Method method = null;        
       Class type = null;
       try {
           java.beans.BeanInfo info
               = java.beans.Introspector.getBeanInfo(beanClass);
           if ( info != null ) {
               java.beans.PropertyDescriptor pd[]
                   = info.getPropertyDescriptors();
               for (int i = 0 ; i < pd.length ; i++) {
                   if ( pd[i].getName().equals(prop) ) {
                       method = pd[i].getReadMethod();
                       type   = pd[i].getPropertyType();
                       break;
                   }
               }
           } else {        
               // just in case introspection silently fails.
	throw new JasperException(
                   Localizer.getMessage("jsp.error.beans.nobeaninfo",
				 beanClass.getName()));
    }
} catch (Exception ex) {
    throw new JasperException (ex);
}
       if (method == null) {
           if (type == null) {
	throw new JasperException(
                   Localizer.getMessage("jsp.error.beans.noproperty", prop,
				 beanClass.getName()));
           } else {
	throw new JasperException(
                   Localizer.getMessage("jsp.error.beans.nomethod", prop,
				 beanClass.getName()));
           }
       }

return method;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:JspRuntimeLibrary.java

示例14: getWriteMethod

import org.apache.jasper.compiler.Localizer; //导入方法依赖的package包/类
public static Method getWriteMethod(Class beanClass, String prop)
   throws JasperException {
Method method = null;	
       Class type = null;
try {
    java.beans.BeanInfo info
               = java.beans.Introspector.getBeanInfo(beanClass);
    if ( info != null ) {
	java.beans.PropertyDescriptor pd[]
	    = info.getPropertyDescriptors();
	for (int i = 0 ; i < pd.length ; i++) {
	    if ( pd[i].getName().equals(prop) ) {
		method = pd[i].getWriteMethod();
		type   = pd[i].getPropertyType();
		break;
	    }
	}
           } else {        
               // just in case introspection silently fails.
               throw new JasperException(
                   Localizer.getMessage("jsp.error.beans.nobeaninfo",
				 beanClass.getName()));
           }
       } catch (Exception ex) {
           throw new JasperException (ex);
       }
       if (method == null) {
           if (type == null) {
	throw new JasperException(
                       Localizer.getMessage("jsp.error.beans.noproperty",
				     prop,
				     beanClass.getName()));
           } else {
	throw new JasperException(
	    Localizer.getMessage("jsp.error.beans.nomethod.setproperty",
				 prop,
				 type.getName(),
				 beanClass.getName()));
           }
       }
       return method;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:JspRuntimeLibrary.java

示例15: createInitialReader

import org.apache.jasper.compiler.Localizer; //导入方法依赖的package包/类
private void createInitialReader() throws IOException, JasperException {

		// wrap this stream in RewindableInputStream
		stream = new RewindableInputStream(stream);

		// perform auto-detect of encoding if necessary
		if (encoding == null) {
			// read first four bytes and determine encoding
			final byte[] b4 = new byte[4];
			int count = 0;
			for (; count < 4; count++) {
				b4[count] = (byte) stream.read();
			}
			if (count == 4) {
				Object[] encodingDesc = getEncodingName(b4, count);
				encoding = (String) (encodingDesc[0]);
				isBigEndian = (Boolean) (encodingDesc[1]);

				if (encodingDesc.length > 3) {
					isBomPresent = ((Boolean) (encodingDesc[2])).booleanValue();
					skip = ((Integer) (encodingDesc[3])).intValue();
				} else {
					isBomPresent = true;
					skip = ((Integer) (encodingDesc[2])).intValue();
				}

				stream.reset();
				// Special case UTF-8 files with BOM created by Microsoft
				// tools. It's more efficient to consume the BOM than make
				// the reader perform extra checks. -Ac
				if (encoding.equals("UTF-8")) {
					int b0 = b4[0] & 0xFF;
					int b1 = b4[1] & 0xFF;
					int b2 = b4[2] & 0xFF;
					if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) {
						// ignore first three bytes...
						long skipped = stream.skip(3);
						if (skipped != 3) {
							throw new IOException(Localizer.getMessage("xmlParser.skipBomFail"));
						}
					}
				}
				reader = createReader(stream, encoding, isBigEndian);
			} else {
				reader = createReader(stream, encoding, isBigEndian);
			}
		}
	}
 
开发者ID:how2j,项目名称:lazycat,代码行数:49,代码来源:XMLEncodingDetector.java


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