List of usage examples for java.util Collections enumeration
public static <T> Enumeration<T> enumeration(final Collection<T> c)
From source file:edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.MultipartHttpServletRequest.java
@Override public Enumeration<?> getParameterNames() { return Collections.enumeration(parameters.keySet()); }
From source file:org.impalaframework.classloader.graph.GraphClassLoader.java
/** * Returns enumeration of local resources, combined with those of parent * class loader.//from ww w.j a v a 2 s .c o m * * The implementation of {@link #getResources(String)} is pretty * conservative. For a given resource name, only one resource URL will ever * be found from within the module hierarchy. Also, only the current module * is searched. It's ancestor and dependent modules are not searched for the * resource. * * The module resource, if found, is returned as an {@link Enumeration} * which also includes the resources obtained from the standard or * application class loader via the super{@link #getResources(String)} call. */ @Override public Enumeration<URL> getResources(String name) throws IOException { Enumeration<URL> resources = super.getResources(name); Enumeration<URL> localResources = getLocalResources(name); if (localResources != null) { List<URL> combined = new ArrayList<URL>(); combined.addAll(Collections.list(localResources)); combined.addAll(Collections.list(resources)); return Collections.enumeration(combined); } return resources; }
From source file:nl.armatiek.xslweb.web.servlet.XSLWebHttpServletRequest.java
@Override public Enumeration<String> getHeaderNames() { return Collections.enumeration(new ArrayList<String>()); }
From source file:com.stratuscom.harvester.classloading.VirtualFileSystemClassLoader.java
@Override public Enumeration<URL> findResources(final String name) throws IOException { if (log.isLoggable(Level.FINE)) { log.fine("findResourceFileObjects(" + name + ")"); }//w ww.j av a 2 s . c o m Enumeration result = (Enumeration) Security.doPrivileged(new PrivilegedAction<Enumeration>() { public Enumeration run() { List<URL> urlList = new ArrayList<URL>(); try { List<FileObject> foList = findResourceFileObjects(name); for (FileObject fo : foList) { urlList.add(fo.getURL()); if (log.isLoggable(Level.FINE)) { log.fine("..found file object with URL:" + fo.getURL()); log.fine("..trying to open it"); } /* For unknown reasons, actually getting the resources will fail iff the target folder is not under the current working directory, unless we try to open it while we're here. */ InputStream in = null; //BufferedReader r = null; try { in = fo.getURL().openStream(); //r = new BufferedReader(new InputStreamReader(in, "utf-8")); } catch (Exception x) { log.log(Level.FINE, "..Got an exception:" + x); } finally { try { // if (r != null) { // r.close(); // } if (in != null) { in.close(); } } catch (IOException y) { log.log(Level.FINE, "..Additionally, got an exception on close:" + y); } } } } catch (FileSystemException ex) { Logger.getLogger(VirtualFileSystemClassLoader.class.getName()).log(Level.SEVERE, null, ex); } return Collections.enumeration(urlList); } }); return result; }
From source file:org.betaconceptframework.astroboa.portal.managedbean.RepositoryResourceBundle.java
@Override public Enumeration<String> getKeys() { return Collections.enumeration(resourcesPerKey.keySet()); }
From source file:org.apache.hadoop.gateway.AuditLoggingTest.java
@Test /**/*from w ww. j a va 2s. com*/ * Dispatching outbound request. Remote host is unreachable. Two log events is expected: * * action=dispatch request_type=uri outcome=FAILED * action=dispatch request_type=uri outcome=unavailable */ public void testHttpClientOutboundException() throws IOException, URISyntaxException { String uri = "http://outbound-host:port/path"; HttpServletRequest inboundRequest = EasyMock.createNiceMock(HttpServletRequest.class); EasyMock.expect(inboundRequest.getHeaderNames()).andReturn(Collections.enumeration(new ArrayList<String>())) .anyTimes(); EasyMock.replay(inboundRequest); HttpServletResponse outboundResponse = EasyMock.createNiceMock(HttpServletResponse.class); EasyMock.replay(outboundResponse); DefaultDispatch dispatch = new DefaultDispatch(); dispatch.setHttpClient(new DefaultHttpClient()); try { dispatch.doGet(new URI(uri), inboundRequest, outboundResponse); fail("Expected exception while accessing to unreachable host"); } catch (IOException e) { Iterator<LoggingEvent> iterator = CollectAppender.queue.iterator(); LoggingEvent unavailableEvent = iterator.next(); verifyValue((String) unavailableEvent.getMDC(AuditConstants.MDC_RESOURCE_NAME_KEY), uri); verifyValue((String) unavailableEvent.getMDC(AuditConstants.MDC_RESOURCE_TYPE_KEY), ResourceType.URI); verifyValue((String) unavailableEvent.getMDC(AuditConstants.MDC_ACTION_KEY), Action.DISPATCH); verifyValue((String) unavailableEvent.getMDC(AuditConstants.MDC_OUTCOME_KEY), ActionOutcome.UNAVAILABLE); LoggingEvent failureEvent = iterator.next(); verifyValue((String) failureEvent.getMDC(AuditConstants.MDC_RESOURCE_NAME_KEY), uri); verifyValue((String) failureEvent.getMDC(AuditConstants.MDC_RESOURCE_TYPE_KEY), ResourceType.URI); verifyValue((String) failureEvent.getMDC(AuditConstants.MDC_ACTION_KEY), Action.DISPATCH); verifyValue((String) failureEvent.getMDC(AuditConstants.MDC_OUTCOME_KEY), ActionOutcome.FAILURE); } }
From source file:com.manydesigns.elements.servlet.MutableHttpServletRequest.java
public Enumeration getAttributeNames() { return Collections.enumeration(attributeMap.keySet()); }
From source file:io.wcm.caravan.io.http.impl.servletclient.HttpServletRequestMapper.java
@Override public Enumeration<String> getHeaders(String name) { return Collections.enumeration(request.getHeaders().get(name)); }
From source file:wicket.protocol.http.MockHttpServletRequest.java
/** * Get enumeration of all header values with the given name. * /*from w w w . j a v a 2s .co m*/ * @param name * The name * @return The header values */ public Enumeration getHeaders(final String name) { List<String> list = headers.get(name); if (list == null) { list = new ArrayList<String>(); } return Collections.enumeration(list); }
From source file:org.springframework.mock.web.portlet.MockPortletContext.java
@Override public Enumeration<String> getContainerRuntimeOptions() { return Collections.enumeration(this.containerRuntimeOptions); }