本文整理汇总了Java中org.apache.commons.collections.EnumerationUtils类的典型用法代码示例。如果您正苦于以下问题:Java EnumerationUtils类的具体用法?Java EnumerationUtils怎么用?Java EnumerationUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnumerationUtils类属于org.apache.commons.collections包,在下文中一共展示了EnumerationUtils类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAliases
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<String> getAliases() {
LOGGER.entering(KeyStoreTool.class.getName(), "getAliases");
List<String> result = new LinkedList<String>();
try {
result.addAll(EnumerationUtils.toList(keyStore.aliases()));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Error while reading aliases.", e);
}
LOGGER.exiting(KeyStoreTool.class.getName(), "getAliases", result);
return result;
}
示例2: filter
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
/**
* Filter {@link JarEntry} list from {@link JarFile}
*
* @param jarFile
* {@link JarFile}
* @param jarEntryFilter
* {@link JarEntryFilter}
* @return Read-only List
*/
@Nonnull
public static List<JarEntry> filter(JarFile jarFile, JarEntryFilter jarEntryFilter) {
if (jarFile == null) {
return Collections.emptyList();
}
Enumeration<JarEntry> jarEntries = jarFile.entries();
List<JarEntry> jarEntriesList = EnumerationUtils.toList(jarEntries);
return doFilter(jarEntriesList, jarEntryFilter);
}
示例3: getCXFServletConfig
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
/**
* This is a workaround after upgrading to CXF 2.7.0 whereby we could no longer just call "setHideServiceList" on
* the ServletController. Instead, it is now reading this information from the ServletConfig, so wrapping the base
* ServletContext to return true or false for hide service list depending on whether or not we are in dev mode.
*/
protected ServletConfig getCXFServletConfig(final ServletConfig baseServletConfig) {
// disable handling of URLs ending in /services which display CXF generated service lists if we are not in dev mode
final String shouldHide = Boolean.toString(!ConfigContext.getCurrentContextConfig().getDevMode().booleanValue());
return new ServletConfig() {
private static final String HIDE_SERVICE_LIST_PAGE_PARAM = "hide-service-list-page";
@Override
public String getServletName() {
return baseServletConfig.getServletName();
}
@Override
public ServletContext getServletContext() {
return baseServletConfig.getServletContext();
}
@Override
public String getInitParameter(String parameter) {
if (HIDE_SERVICE_LIST_PAGE_PARAM.equals(parameter)) {
return shouldHide;
}
return baseServletConfig.getInitParameter(parameter);
}
@Override
public Enumeration<String> getInitParameterNames() {
List<String> initParameterNames = EnumerationUtils.toList(baseServletConfig.getInitParameterNames());
initParameterNames.add(HIDE_SERVICE_LIST_PAGE_PARAM);
return new Vector<String>(initParameterNames).elements();
}
};
}
示例4: read
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
@Read
public Patient read(@IdParam IdDt theId, HttpServletRequest theRequest) {
Patient retVal = new Patient();
retVal.setId(theId);
ourRequest = theRequest;
ourLog.info(EnumerationUtils.toList(ourRequest.getHeaderNames()).toString());
ourLog.info("Proxy-Connection: " + EnumerationUtils.toList(ourRequest.getHeaders("Proxy-Connection")));
ourLog.info("Host: " + EnumerationUtils.toList(ourRequest.getHeaders("Host")));
ourLog.info("User-Agent: " + EnumerationUtils.toList(ourRequest.getHeaders("User-Agent")));
return retVal;
}
示例5: read
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
@Read
public Patient read(@IdParam IdType theId, HttpServletRequest theRequest) {
Patient retVal = new Patient();
retVal.setId(theId);
ourRequest = theRequest;
ourLog.info(EnumerationUtils.toList(ourRequest.getHeaderNames()).toString());
ourLog.info("Proxy-Connection: " + EnumerationUtils.toList(ourRequest.getHeaders("Proxy-Connection")));
ourLog.info("Host: " + EnumerationUtils.toList(ourRequest.getHeaders("Host")));
ourLog.info("User-Agent: " + EnumerationUtils.toList(ourRequest.getHeaders("User-Agent")));
return retVal;
}
示例6: extractHeaders
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<Pair<String, String>> extractHeaders(HttpServletRequest httpServletRequest) {
List<Pair<String, String>> result = new ArrayList<>();
for (String headerName : (List<String>) EnumerationUtils.toList(httpServletRequest.getHeaderNames())) {
result.add(Pair.of(headerName, httpServletRequest.getHeader(headerName)));
}
return result;
}
示例7: getAliases
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
/**
* Gets all aliases in the {@link KeyStore}.
*/
@SuppressWarnings(UNCHECKED)
public Collection<String> getAliases() {
try {
return EnumerationUtils.toList(crypto.getKeyStore().aliases());
} catch (KeyStoreException e) {
// no way to recover
throw new RuntimeException(e);
}
}
示例8: doGet
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
resp.setContentType("text/html");
ServletOutputStream out = resp.getOutputStream();
List<String> list = EnumerationUtils.toList(req.getHeaderNames());
for (String key : list)
{
out.print(String.format("%s = %s <br>", key, req.getHeader(key)));
}
out.flush();
}
示例9: getAttributeKeys
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
@Override
public Collection<Object> getAttributeKeys() throws InvalidSessionException {
return EnumerationUtils.toList( request.getAttributeNames() );
}
示例10: getResources
import org.apache.commons.collections.EnumerationUtils; //导入依赖的package包/类
/**
* Get the resource URLs Set under specified resource name and type
*
* @param classLoader
* ClassLoader
* @param resourceType
* {@link ResourceType} Enum
* @param resourceName
* resource name ,e.g : <br /> <ul> <li>Resource Name :<code>"/com/abc/def.log"</code></li> <li>Class Name :
* <code>"java.lang.String"</code></li> </ul>
* @return the resource URL under specified resource name and type
* @throws NullPointerException
* If any argument is <code>null</code>
* @throws IOException
* @version 1.0.0
* @since 1.0.0
*/
public static Set<URL> getResources(ClassLoader classLoader, ResourceType resourceType, String resourceName) throws NullPointerException, IOException {
String normalizedResourceName = resourceType.resolve(resourceName);
Enumeration<URL> resources = classLoader.getResources(normalizedResourceName);
return resources != null && resources.hasMoreElements() ? Sets.newLinkedHashSet(EnumerationUtils.toList(resources)) : Collections.<URL>emptySet();
}