Package org.zkoss.web.util.resource
Class ServletLabelLocator
java.lang.Object
org.zkoss.web.util.resource.ServletLabelLocator
- All Implemented Interfaces:
org.zkoss.util.resource.LabelLocator
Used by Labels to load labels from a servlet context.
- Author:
- tomyeh
-
Constructor Summary
ConstructorsConstructorDescriptionServletLabelLocator(jakarta.servlet.ServletContext ctx) Constructs a locator where the properties file is decided by the library property called org.zkoss.util.label.web.location.ServletLabelLocator(jakarta.servlet.ServletContext ctx, String path) Constructs a locator for the given path. -
Method Summary
-
Constructor Details
-
ServletLabelLocator
public ServletLabelLocator(jakarta.servlet.ServletContext ctx) Constructs a locator where the properties file is decided by the library property called org.zkoss.util.label.web.location. If not defined, /WEB-INF/zk-label.properties is assumedThe library property accepts the same syntax as the path passed to
ServletLabelLocator(ServletContext, String). -
ServletLabelLocator
Constructs a locator for the given path.- Parameters:
path- the path of the properties file
Notice thatfile://pathis supported (but not http://).Since 11.0.0,
~./pathis also supported to load the properties file from the class path underClassWebResource.PATH_PREFIX(i.e./web). This is convenient for JAR-packaged applications (e.g. ZK Spring Boot) where label files are bundled inside the class path rather than under the servlet context.Caution: the class path's
/webdirectory is served as public static content (<ctx>/zkau/web/...), so a label file put there can be downloaded by anyone. Keep confidential labels under/WEB-INFinstead.- Since:
- 5.0.7
-
-
Method Details