本文整理汇总了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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}