Codota Logo
Cookie.getName
Code IndexAdd Codota to your IDE (free)

How to use
getName
method
in
ro.polak.http.servlet.Cookie

Best Java code snippets using ro.polak.http.servlet.Cookie.getName (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: piotrpolak/android-http-server

  /**
   * Parses cookie string, returns an array representing cookies read.
   *
   * @param input
   * @return
   * @throws MalformedInputException
   */
  @Override
  public Map<String, Cookie> parse(final String input) throws MalformedInputException {
    Map<String, Cookie> cookies = new HashMap<>();

    // Splitting separate cookies array
    String[] cookiesStr = input.split(COOKIE_SEPARATOR);
    for (int i = 0; i < cookiesStr.length; i++) {
      // Splitting cookie name=value pair
      String[] cookieValues = cookiesStr[i].split(VALUE_SEPARATOR, 2);
      String cookieName = cookieValues[0].trim();
      if (cookieValues.length > 1 && cookieName.length() > 0) {
        Cookie cookie = new Cookie(cookieName, StringUtilities.urlDecode(cookieValues[1]));
        cookies.put(cookie.getName(), cookie);
      }
    }

    return cookies;
  }
}
origin: piotrpolak/android-http-server

public String serialize(final Cookie cookie) {
  StringBuilder sb = new StringBuilder();
  sb.append(cookie.getName())
      .append(EQUALS)
      .append(StringUtilities.urlEncode(cookie.getValue()));
origin: piotrpolak/android-http-server

@Test
public void shouldSetCookieAndPersistForValidSession() throws IOException {
  HttpSessionImpl session = new HttpSessionImpl("123", System.currentTimeMillis());
  servletContext.handleSession(session, response);
  verify(sessionStorage, times(1)).persistSession(session);
  assertThat(response.getCookies().size(), is(greaterThan(0)));
  for (Cookie cookie : response.getCookies()) {
    if (cookie.getName().equals(HttpSessionImpl.COOKIE_NAME)) {
      assertThat(cookie.getValue(), is(not(nullValue())));
      return;
    }
  }
  fail("Session cookie was not set.");
}
origin: piotrpolak/android-http-server

@Test
public void shouldWorkGettersAndSetters() {
  Cookie cookie = new Cookie("someName", "someValue");
  cookie.setComment("comment");
  cookie.setDomain("example.com");
  cookie.setPath("/somepath");
  cookie.setSecure(true);
  cookie.setHttpOnly(true);
  assertThat(cookie.getName(), is("someName"));
  assertThat(cookie.getValue(), is("someValue"));
  cookie.setValue("SomeValue2");
  assertThat(cookie.getValue(), is("SomeValue2"));
  assertThat(cookie.getComment(), is("comment"));
  assertThat(cookie.getDomain(), is("example.com"));
  assertThat(cookie.getPath(), is("/somepath"));
  assertThat(cookie.isSecure(), is(true));
  assertThat(cookie.isHttpOnly(), is(true));
  assertThat(cookie.getMaxAge(), is(-1));
  cookie.setMaxAge(125);
  assertThat(cookie.getMaxAge(), is(125));
}
origin: piotrpolak/android-http-server

@Test
public void shouldEraseCookieAndRemoveForInvalidatedSession() throws IOException {
  HttpSessionImpl session = new HttpSessionImpl("123", System.currentTimeMillis());
  session.invalidate();
  servletContext.handleSession(session, response);
  verify(sessionStorage, times(1)).removeSession(session);
  assertThat(response.getCookies().size(), is(greaterThan(0)));
  for (Cookie cookie : response.getCookies()) {
    if (cookie.getName().equals(HttpSessionImpl.COOKIE_NAME)) {
      assertThat(cookie.getMaxAge(), lessThan(-1));
      return;
    }
  }
  fail("Session DELETE cookie was not set.");
}
ro.polak.http.servletCookiegetName

Javadoc

Returns cookie name.

Popular methods of Cookie

  • <init>
  • getComment
    Return cookie comment.
  • getDomain
    Returns cookie domain pattern.
  • getMaxAge
    Returns cookie max age in seconds.
  • getPath
    Returns cookie path.
  • getValue
    Returns cookie value.
  • isHttpOnly
    Tells whether the cookie is http only.
  • isSecure
    Tells whether the cookie is secure.
  • setMaxAge
    Sets cookie max age in seconds. Set negative value less than -1 to remove cookie.
  • setValue
    Sets cookie value.
  • checkNameForIllegalCharacters
  • setComment
    Sets cookie comment.
  • checkNameForIllegalCharacters,
  • setComment,
  • setDomain,
  • setHttpOnly,
  • setPath,
  • setSecure

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now