本文整理汇总了Java中javax.faces.application.Application.getResourceHandler方法的典型用法代码示例。如果您正苦于以下问题:Java Application.getResourceHandler方法的具体用法?Java Application.getResourceHandler怎么用?Java Application.getResourceHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.application.Application
的用法示例。
在下文中一共展示了Application.getResourceHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encodeBegin
import javax.faces.application.Application; //导入方法依赖的package包/类
@Override
public void encodeBegin(FacesContext context) throws IOException {
Application app = context.getApplication();
ResourceHandler rh = app.getResourceHandler();
ResponseWriter responseWriter = context.getResponseWriter();
Resource h5s = rh.createResource("js/html5shiv.js", C.BSF_LIBRARY);
Resource rjs = rh.createResource("js/respond.js", C.BSF_LIBRARY);
responseWriter.write("<!--[if lt IE 9]>");
responseWriter.startElement("script", null);
responseWriter.writeAttribute("src", h5s.getRequestPath(), null);
responseWriter.endElement("script");
responseWriter.startElement("script", null);
responseWriter.writeAttribute("src", rjs.getRequestPath(), null);
responseWriter.endElement("script");
responseWriter.write("<![endif]-->");
}
示例2: Datepicker
import javax.faces.application.Application; //导入方法依赖的package包/类
public Datepicker() {
setRendererType(null); // this component renders itself
AddResourcesListener.addThemedCSSResource("core.css");
AddResourcesListener.addExtCSSResource("jq.ui.core.css");
AddResourcesListener.addExtCSSResource("jq.ui.theme.css");
AddResourcesListener.addExtCSSResource("jq.ui.datepicker.css");
AddResourcesListener.addResourceToHeadButAfterJQuery(C.BSF_LIBRARY, "jq/ui/core.js");
AddResourcesListener.addResourceToHeadButAfterJQuery(C.BSF_LIBRARY, "jq/ui/datepicker.js");
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ResourceHandler rh = app.getResourceHandler();
Resource rdp;
Iterator<Locale> preferredLanguages = context.getExternalContext().getRequestLocales();
while (preferredLanguages.hasNext()) {
String language = preferredLanguages.next().getLanguage();
if ("en".equals(language)) {
break;
}
final String jsl = "jq/ui/i18n/datepicker-" + language + ".js";
rdp = rh.createResource(jsl, C.BSF_LIBRARY);
if (rdp != null) { // rdp is null if the language .js is not present
// in jar
AddResourcesListener.addResourceToHeadButAfterJQuery(C.BSF_LIBRARY, jsl);
break;
}
}
Tooltip.addResourceFiles();
}