Example usage for java.util Collections enumeration

List of usage examples for java.util Collections enumeration

Introduction

In this page you can find the example usage for java.util Collections enumeration.

Prototype

public static <T> Enumeration<T> enumeration(final Collection<T> c) 

Source Link

Document

Returns an enumeration over the specified collection.

Usage

From source file:org.opennms.netmgt.xml.eventconf.Correlation.java

/**
 * Method enumerateCuei.//from w  w w  .  j av a2  s . c om
 * 
 * @return an Enumeration over all possible elements of this
 * collection
 */
public Enumeration<String> enumerateCuei() {
    return Collections.enumeration(this.m_cueiList);
}

From source file:org.seasar.cadhelin.MultipartRequestWrapper.java

/**
 * Returns the names of the parameters for this request.
 * The enumeration consists of the normal request parameter
 * names plus the parameters read from the multipart request
 *///from  w  ww.j  a v  a 2 s. c o m
public Enumeration getParameterNames() {
    Enumeration baseParams = request.getParameterNames();
    Vector<String> list = new Vector<String>();
    while (baseParams.hasMoreElements()) {
        list.add((String) baseParams.nextElement());
    }
    Collection multipartParams = parameters.keySet();
    Iterator iterator = multipartParams.iterator();
    while (iterator.hasNext()) {
        list.add((String) iterator.next());
    }
    return Collections.enumeration(list);
}

From source file:org.jasig.springframework.web.portlet.upload.DefaultMultipartResourceRequest.java

@Override
public Enumeration<String> getParameterNames() {
    Set<String> paramNames = new HashSet<String>();
    Enumeration<String> paramEnum = super.getParameterNames();
    while (paramEnum.hasMoreElements()) {
        paramNames.add((String) paramEnum.nextElement());
    }/* w  w  w  . ja va 2  s  . co m*/
    paramNames.addAll(getMultipartParameters().keySet());
    return Collections.enumeration(paramNames);
}

From source file:it.unipmn.di.dcs.sharegrid.web.servlet.MultipartRequestWrapper.java

@Override
public Enumeration<String> getParameterNames() {
    return Collections.enumeration(this.params.keySet());
}

From source file:com.adobe.acs.commons.http.headers.impl.AbstractExpiresHeaderFilterTest.java

@Test
public void testAcceptsNoExpiresHeader() throws Exception {

    when(request.getHeaders(AbstractExpiresHeaderFilter.EXPIRES_NAME))
            .thenReturn(Collections.enumeration(expires));

    boolean result = filter.accepts(request);
    assertTrue(result);//from www.jav a2 s  .  c o  m

    verify(request).getHeaders(AbstractExpiresHeaderFilter.EXPIRES_NAME);
}

From source file:org.kawanfw.sql.tomcat.util.LinkedProperties.java

@Override
public synchronized Enumeration<Object> keys() {

    Set<Object> set = this.keySet();
    return Collections.enumeration(set);
}

From source file:org.sakaiproject.tool.syllabus.FileUploadFilter.java

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    if (!(request instanceof HttpServletRequest)) {
        chain.doFilter(request, response);
        return;/*  w  ww. j  a v a2 s .  c o m*/
    }

    HttpServletRequest httpRequest = (HttpServletRequest) request;

    boolean isMultipartContent = FileUpload.isMultipartContent(httpRequest);
    if (!isMultipartContent) {
        chain.doFilter(request, response);
        return;
    }

    DiskFileUpload upload = new DiskFileUpload();
    if (repositoryPath != null)
        upload.setRepositoryPath(repositoryPath);

    try {
        List list = upload.parseRequest(httpRequest);
        final Map map = new HashMap();
        for (int i = 0; i < list.size(); i++) {
            FileItem item = (FileItem) list.get(i);
            String str = item.getString();
            if (item.isFormField())
                map.put(item.getFieldName(), new String[] { str });
            else
                httpRequest.setAttribute(item.getFieldName(), item);
        }

        chain.doFilter(new HttpServletRequestWrapper(httpRequest) {
            public Map getParameterMap() {
                return map;
            }

            public String[] getParameterValues(String name) {
                Map map = getParameterMap();
                return (String[]) map.get(name);
            }

            public String getParameter(String name) {
                String[] params = getParameterValues(name);
                if (params == null)
                    return null;
                return params[0];
            }

            public Enumeration getParameterNames() {
                Map map = getParameterMap();
                return Collections.enumeration(map.keySet());
            }
        }, response);
    } catch (FileUploadException ex) {
        ServletException servletEx = new ServletException();
        servletEx.initCause(ex);
        throw servletEx;
    }
}

From source file:org.apache.pluto.driver.core.PortalServletRequest.java

/**
 * Get an enumeration which contains each of the names for which parameters
 * exist.//  ww  w  .j a  va 2  s.  c om
 * @return an enumeration of all names bound as parameters.
 */
public Enumeration getParameterNames() {
    return Collections.enumeration(getParameterMap().keySet());
}

From source file:org.dspace.statistics.util.DummyHttpServletRequest.java

@Override
public Enumeration getHeaders(String arg0) {
    return Collections.enumeration(Utils.emptyIfNull(headers.get(arg0)));
}

From source file:org.seasar.teeda.extension.filter.MultipartFormDataRequestWrapper.java

public Enumeration getParameterNames() {
    return Collections.enumeration(parameters.keySet());
}