當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。