• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SharedResourceReference类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.wicket.request.resource.SharedResourceReference的典型用法代码示例。如果您正苦于以下问题:Java SharedResourceReference类的具体用法?Java SharedResourceReference怎么用?Java SharedResourceReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SharedResourceReference类属于org.apache.wicket.request.resource包,在下文中一共展示了SharedResourceReference类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: mountFiles

点赞 3

import org.apache.wicket.request.resource.SharedResourceReference; //导入依赖的package包/类
private void mountFiles(String path, Class<?> clazz) {
    try {
        List<Resource> list = new ArrayList<>();
        String packagePath = clazz.getPackage().getName().replace('.', '/');

        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
        Resource[] res = resolver.getResources("classpath:" + packagePath + "/*.png");
        if (res != null) {
            list.addAll(Arrays.asList(res));
        }
        res = resolver.getResources("classpath:" + packagePath + "/*.gif");
        if (res != null) {
            list.addAll(Arrays.asList(res));
        }

        for (Resource resource : list) {
            URI uri = resource.getURI();
            File file = new File(uri.toString());
            mountResource(path + "/" + file.getName(), new SharedResourceReference(clazz, file.getName()));
        }
    } catch (Exception ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't mount files", ex);
    }
}
 

开发者ID:Pardus-Engerek,
项目名称:engerek,
代码行数:25,
代码来源:MidPointApplication.java

示例2: initLogoReference

点赞 2

import org.apache.wicket.request.resource.SharedResourceReference; //导入依赖的package包/类
protected void initLogoReference()
{
    Properties settings = SettingsUtil.getSettings();
    String logoValue = settings.getProperty(SettingsUtil.CFG_STYLE_LOGO);
    if (StringUtils.isNotBlank(logoValue) && new File(logoValue).canRead()) {
        getSharedResources().add("logo", new FileSystemResource(new File(logoValue)));
        mountResource("/assets/logo.png", new SharedResourceReference("logo"));
    }
    else {
        mountResource("/assets/logo.png", new PackageResourceReference(getLogoLocation()));
    }
}
 

开发者ID:webanno,
项目名称:webanno,
代码行数:13,
代码来源:WicketApplicationBase.java

示例3: mountOrientDbRestApi

点赞 2

import org.apache.wicket.request.resource.SharedResourceReference; //导入依赖的package包/类
/**
 * Mounts OrientDB REST API Bridge to an app
 * @param resource {@link OrientDBHttpAPIResource} to mount
 * @param app {@link WebApplication} to mount to
 * @param mountPaths array of paths to mount to
 */
@SuppressWarnings("restriction")
public static void mountOrientDbRestApi(OrientDBHttpAPIResource resource, WebApplication app, String... mountPaths)
{
	app.getSharedResources().add(ORIENT_DB_KEY, resource);
	Authenticator.setDefault(new Authenticator() {
		@Override
		protected PasswordAuthentication getPasswordAuthentication() {
			String username;
			String password;
			OrientDbWebSession session = OrientDbWebSession.get();
			if(session.isSignedIn())
			{
				username = session.getUsername();
				password = session.getPassword();
			}
			else
			{
				IOrientDbSettings settings = OrientDbWebApplication.get().getOrientDbSettings();
				username = settings.getGuestUserName();
				password = settings.getGuestPassword();
			}
			return new PasswordAuthentication (username, password.toCharArray());
		}
		
	});
	 CookieHandler.setDefault(new PersonalCookieManager());
	 sun.net.www.protocol.http.AuthCacheValue.setAuthCache(new MultiUserCache());
	 for (String mountPath : mountPaths) {
		 app.mountResource(mountPath, new SharedResourceReference(ORIENT_DB_KEY));
	}
}
 

开发者ID:OrienteerBAP,
项目名称:wicket-orientdb,
代码行数:38,
代码来源:OrientDBHttpAPIResource.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)