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


Java Application.getResourceHandler方法代码示例

本文整理汇总了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]-->");
  }
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:18,代码来源:InternalIE8CompatiblityLinks.java

示例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();
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:32,代码来源:Datepicker.java


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