Example usage for javax.servlet.http HttpSession getValueNames

List of usage examples for javax.servlet.http HttpSession getValueNames

Introduction

In this page you can find the example usage for javax.servlet.http HttpSession getValueNames.

Prototype

@Deprecated
public String[] getValueNames();

Source Link

Usage

From source file:org.codehaus.wadi.web.TestHttpSession.java

public void testCreateHttpSession(Manager manager) {
    events.clear();/*  w ww  .  j a va  2s  .  c  o  m*/

    // create a session
    HttpSession session = ((WADIHttpSession) manager.create(null)).getWrapper();
    assertTrue(!session.getAttributeNames().hasMoreElements());
    assertTrue(session.getValueNames().length == 0);
    Pair pair = (Pair) events.remove(0);
    assertTrue(pair != null);
    assertTrue(pair.getType().equals("sessionCreated"));
    assertTrue(pair.getEvent().getSession() == session);
    assertTrue(events.size() == 0);
}

From source file:org.codehaus.wadi.web.TestHttpSession.java

public void testGetValueNames(Manager manager) {
    HttpSession session = ((WADIHttpSession) manager.create(null)).getWrapper();
    assertTrue(session.getValueNames().length == 0);
    session.setAttribute("foo", "bar");
    assertTrue(session.getValueNames().length == 1);
    session.setAttribute("bar", "baz");
    assertTrue(session.getValueNames().length == 2);
    session.setAttribute("baz", "foo");
    assertTrue(session.getValueNames().length == 3);
    session.setAttribute("baz", null);
    assertTrue(session.getValueNames().length == 2);
    session.setAttribute("bar", null);
    assertTrue(session.getValueNames().length == 1);
    session.setAttribute("foo", null);
    assertTrue(session.getValueNames().length == 0);
}