📄 servletlabellocator.java
字号:
/* ServletLabelLocator.java{{IS_NOTE Purpose: Description: History: Sat Apr 8 19:51:08 2006, Created by tomyeh}}IS_NOTECopyright (C) 2006 Potix Corporation. All Rights Reserved.{{IS_RIGHT This program is distributed under GPL Version 2.0 in the hope that it will be useful, but WITHOUT ANY WARRANTY.}}IS_RIGHT*/package org.zkoss.web.util.resource;import java.util.Locale;import java.io.IOException;import java.net.URL;import javax.servlet.ServletContext;import org.zkoss.util.resource.LabelLocator;/** * Used by Lables to load labels from a servlet context. * * @author tomyeh */public class ServletLabelLocator implements LabelLocator { private final ServletContext _ctx; public ServletLabelLocator(ServletContext ctx) { if (ctx == null) throw new IllegalArgumentException("null"); _ctx = ctx; } //-- LabelLocator --// public URL locate(Locale locale) throws IOException { return _ctx.getResource("/WEB-INF/"+getI3LabelName(locale)); } /** Returns the filename of i3-label.properties. */ private static final String getI3LabelName(Locale locale) { return locale.equals(Locale.ENGLISH) ? "i3-label.properties": "i3-label_" + locale + ".properties"; } //-- Object --// public int hashCode() { return _ctx.hashCode(); } public boolean equals(Object o) { return o instanceof ServletLabelLocator && ((ServletLabelLocator)o)._ctx.equals(_ctx); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -