List of usage examples for org.apache.http.cookie SetCookie getPath
String getPath();
From source file:org.sonatype.nexus.testsuite.security.SimpleSessionCookieIT.java
/** * Validate standard session cookie properties *///w ww . j av a2s .c om private void assertCommonSessionCookieAttributes(final URL baseUrl, final SetCookie serverCookie, final String headerText) { assertThat(serverCookie, notNullValue()); assertThat("cookie value must be present", serverCookie.getValue(), notNullValue()); assertThat("cookie name mismatch", serverCookie.getName(), equalTo(DEFAULT_SESSION_COOKIE_NAME)); assertThat("not expecting to get ports since they are generally ignored", serverCookie.getPorts(), nullValue()); assertThat( "session cookie does not currently set the domain leaving it to the Browser to do the right thing", headerText, not(containsString("; Domain="))); assertThat("browser should interpret domain as same as origin", serverCookie.getDomain(), equalTo(baseUrl.getHost())); assertThat("cookie path should match Nexus context path", serverCookie.getPath(), equalTo(cookiePath(baseUrl))); if (baseUrl.getProtocol().equalsIgnoreCase("https")) { assertThat("session cookie should be marked Secure when cookies are served by https URLs", headerText, containsString("; Secure")); } else { assertThat("session cookie should not be marked Secure when cookies are served by http URLs", headerText, not(containsString("; Secure"))); } }