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


Java Configuration.getProperty方法代码示例

本文整理汇总了Java中javax.ws.rs.core.Configuration.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getProperty方法的具体用法?Java Configuration.getProperty怎么用?Java Configuration.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.ws.rs.core.Configuration的用法示例。


在下文中一共展示了Configuration.getProperty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Security

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
@Inject
@SuppressWarnings("unchecked")
public Security(
        final SecurityDao dao,
        @Context final Configuration configuration,
        @HeaderParam(AUTHORIZATION) final String authorization,
        @CookieParam(COOKIE_NAME) final String cookie) {

    userClass = (Class<SecurityUser>) configuration.getProperty(MinijaxProperties.SECURITY_USER_CLASS);
    this.dao = dao;
    this.authorization = authorization;
    this.cookie = cookie;
    session = initUser();
    user = session != null ? session.getUser() : null;
}
 
开发者ID:minijax,项目名称:minijax,代码行数:16,代码来源:Security.java

示例2: getProperty

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
/**
 * Get the property value as boolean
 *
 * @param configuration the web configuration
 * @param name the property name
 * @return
 */
public static Boolean getProperty(Configuration configuration, String name) {
  Object property = configuration.getProperty(name);

  if (property == null) {
    return null;
  }

  if (property instanceof Boolean && (boolean) property) {
    return (boolean) property;
  }

  return Boolean.parseBoolean(property.toString());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:21,代码来源:PropertyHelper.java

示例3: getInjector

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
static Injector getInjector(Configuration configuration) {
	Injector injector = (Injector) configuration.getProperty(ClientGuiceBridgeFeature.INJECTOR_PROPERTY);
	if (injector == null) {
		throw new IllegalStateException("Injector is not available in JAX RS runtime. Use property '"
				+ ClientGuiceBridgeFeature.INJECTOR_PROPERTY + "' to set it");
	}

	return injector;
}
 
开发者ID:bootique,项目名称:bootique-jersey-client,代码行数:10,代码来源:ClientGuiceBridgeFeature.java

示例4: getInjector

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
static Injector getInjector(Configuration configuration) {
	Injector injector = (Injector) configuration.getProperty(GuiceBridgeFeature.INJECTOR_PROPERTY);
	if (injector == null) {
		throw new IllegalStateException("Injector is not available in JAX RS runtime. Use property '"
				+ GuiceBridgeFeature.INJECTOR_PROPERTY + "' to set it");
	}

	return injector;
}
 
开发者ID:bootique,项目名称:bootique-jersey,代码行数:10,代码来源:GuiceBridgeFeature.java

示例5: getAssetMap

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
/**
 * <p>getAssetMap.</p>
 *
 * @param configuration a {@link javax.ws.rs.core.Configuration} object.
 * @return a {@link java.util.Map} object.
 */
public static Map<String, String[]> getAssetMap(Configuration configuration) {
    Map<String, String[]> assetsMap = Maps.newLinkedHashMap();
    for (String key : configuration.getPropertyNames()) {
        if (key.startsWith(ASSETS_CONF_PREFIX) || key.equals("resource.assets")) {
            String routePath = key.replaceFirst("^resource\\.assets", "");
            if (routePath.startsWith(".")) {
                routePath = routePath.substring(1);
            } else if (StringUtils.isBlank(routePath)) {
                routePath = "assets";
            }

            if (routePath.endsWith("/")) {
                routePath = routePath.substring(0, routePath.lastIndexOf("/"));
            }

            String value = (String) configuration.getProperty(key);
            String[] uris = value.split(",");
            List<String> uriList = Lists.newArrayList();
            for (String uri : uris) {
                uriList.add(uri.endsWith("/") ? uri : uri + "/");
            }
            if (StringUtils.isNotBlank(value)) {
                String[] _uris = assetsMap.get(routePath);
                if (_uris == null) {
                    assetsMap.put(routePath, uriList.toArray(uris));
                } else {
                    assetsMap.put(routePath, ArrayUtils.addAll(_uris, uriList.toArray(uris)));
                }
            }

        }
    }
    return assetsMap;
}
 
开发者ID:icode,项目名称:ameba,代码行数:41,代码来源:AssetsFeature.java

示例6: service

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
/**
 * Returns a service of a specified type present in LinkRest container that
 * is stored in JAX RS Configuration.
 */
public static <T> T service(Class<T> type, Configuration config) {

    if (config == null) {
        throw new NullPointerException("Null config");
    }

    Injector injector = (Injector) config.getProperty(LINK_REST_CONTAINER_PROPERTY);
    if (injector == null) {
        throw new IllegalStateException(
                "LinkRest is misconfigured. No injector found for property: " + LINK_REST_CONTAINER_PROPERTY);
    }

    return injector.getInstance(type);
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:19,代码来源:LinkRestRuntime.java

示例7: getProperty

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
public static Object getProperty(Configuration config, String name,
        Object defaultValue) {
    final Object value = config.getProperty(name);
    return value != null ? value : defaultValue;
}
 
开发者ID:trimou,项目名称:trimou,代码行数:6,代码来源:DefaultTrimouConfiguration.java

示例8: getProperty

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
/**
 * Search for a property and return a default value if not found. Value
 * returned is of same type as default value.
 *
 * @param config configuration to search for property.
 * @param name property name.
 * @param defaultValue default value.
 * @param <T> type of default and return value.
 * @return property or default value.
 */
@SuppressWarnings("unchecked")
public static <T> T getProperty(Configuration config, String name, T defaultValue) {
    final Object obj = config.getProperty(name);
    return obj != null ? (T) obj : defaultValue;
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:16,代码来源:PropertyUtils.java


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