java.net.CookieHandler Java Examples
The following examples show how to use
java.net.CookieHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayerActivity.java From leafpicrevived with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; updateTheme(); shouldAutoPlay = true; clearResumePosition(); mediaDataSourceFactory = buildDataSourceFactory(true); mainHandler = new Handler(); if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) { CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER); } setContentView(R.layout.activity_player); initUi(); rootView = findViewById(R.id.root); simpleExoPlayerView = findViewById(R.id.player_view); simpleExoPlayerView.setControllerVisibilityListener(this); simpleExoPlayerView.requestFocus(); }
Example #2
Source File: URLite.java From httplite with Apache License 2.0 | 6 votes |
void processCookie(String url, Map<String, List<String>> headers) { if (!isUseCookie()) { return; } try { CookieHandler cookieManager = getCookieHandler(); Map<String, List<String>> singleMap = cookieManager.get(URI.create(url), new HashMap<String, List<String>>(0)); List<String> cookies = singleMap.get("Cookie"); if (cookies != null) { headers.put("Cookie", Collections.singletonList(TextUtils.join(";", cookies))); } } catch (Throwable ex) { LogUtil.e(ex.getMessage(), ex); } }
Example #3
Source File: OkHttpClient.java From crosswalk-cordova-android with Apache License 2.0 | 6 votes |
/** * Returns a shallow copy of this OkHttpClient that uses the system-wide default for * each field that hasn't been explicitly configured. */ private OkHttpClient copyWithDefaults() { OkHttpClient result = new OkHttpClient(this); result.proxy = proxy; result.proxySelector = proxySelector != null ? proxySelector : ProxySelector.getDefault(); result.cookieHandler = cookieHandler != null ? cookieHandler : CookieHandler.getDefault(); result.responseCache = responseCache != null ? responseCache : ResponseCache.getDefault(); result.sslSocketFactory = sslSocketFactory != null ? sslSocketFactory : HttpsURLConnection.getDefaultSSLSocketFactory(); result.hostnameVerifier = hostnameVerifier != null ? hostnameVerifier : OkHostnameVerifier.INSTANCE; result.authenticator = authenticator != null ? authenticator : HttpAuthenticator.SYSTEM_DEFAULT; result.connectionPool = connectionPool != null ? connectionPool : ConnectionPool.getDefault(); result.followProtocolRedirects = followProtocolRedirects; result.transports = transports != null ? transports : DEFAULT_TRANSPORTS; result.connectTimeout = connectTimeout; result.readTimeout = readTimeout; return result; }
Example #4
Source File: CookieHttpClientTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
CookieHttpClientTest() throws Exception { /* start the server */ ss = new ServerSocket(0); (new Thread(this)).start(); URL url = new URL("http://localhost:" + ss.getLocalPort() +"/"); // Run without a CookieHandler first InputStream in = url.openConnection().getInputStream(); while (in.read() != -1); // read response body so connection can be reused // Set a CookeHandler and retest using the HttpClient from the KAC CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(manager); in = url.openConnection().getInputStream(); while (in.read() != -1); if (manager.getCookieStore().getCookies().isEmpty()) { throw new RuntimeException("Failed: No cookies in the cookie Handler."); } }
Example #5
Source File: OsioKeycloakTestAuthServiceClient.java From che with Eclipse Public License 2.0 | 6 votes |
private String loginAndGetFormPostURL() throws IOException, MalformedURLException, ProtocolException { CookieManager cookieManager = new CookieManager(); CookieHandler.setDefault(cookieManager); HttpURLConnection conn = (HttpURLConnection) new URL(osioAuthEndpoint + "/api/login?redirect=https://che.openshift.io") .openConnection(); conn.setRequestMethod("GET"); String htmlOutput = IOUtils.toString(conn.getInputStream()); Pattern p = Pattern.compile("action=\"(.*?)\""); Matcher m = p.matcher(htmlOutput); if (m.find()) { String formPostURL = StringEscapeUtils.unescapeHtml(m.group(1)); return formPostURL; } else { LOG.error("Unable to login - didn't find URL to send login form to."); throw new RuntimeException("Unable to login - didn't find URL to send login form to."); } }
Example #6
Source File: PlayerActivity.java From ExoPlayer-Offline with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); shouldAutoPlay = true; clearResumePosition(); mediaDataSourceFactory = buildDataSourceFactory(true); mainHandler = new Handler(); if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) { CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER); } setContentView(R.layout.player_activity); View rootView = findViewById(R.id.root); rootView.setOnClickListener(this); debugRootView = (LinearLayout) findViewById(R.id.controls_root); debugTextView = (TextView) findViewById(R.id.debug_text_view); retryButton = (Button) findViewById(R.id.retry_button); retryButton.setOnClickListener(this); simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view); simpleExoPlayerView.setControllerVisibilityListener(this); simpleExoPlayerView.requestFocus(); }
Example #7
Source File: CookieHttpClientTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
CookieHttpClientTest() throws Exception { /* start the server */ ss = new ServerSocket(0); (new Thread(this)).start(); URL url = new URL("http://localhost:" + ss.getLocalPort() +"/"); // Run without a CookieHandler first InputStream in = url.openConnection().getInputStream(); while (in.read() != -1); // read response body so connection can be reused // Set a CookeHandler and retest using the HttpClient from the KAC CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(manager); in = url.openConnection().getInputStream(); while (in.read() != -1); if (manager.getCookieStore().getCookies().isEmpty()) { throw new RuntimeException("Failed: No cookies in the cookie Handler."); } }
Example #8
Source File: CookieHttpClientTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
CookieHttpClientTest() throws Exception { /* start the server */ ss = new ServerSocket(0); (new Thread(this)).start(); URL url = new URL("http://localhost:" + ss.getLocalPort() +"/"); // Run without a CookieHandler first InputStream in = url.openConnection().getInputStream(); while (in.read() != -1); // read response body so connection can be reused // Set a CookeHandler and retest using the HttpClient from the KAC CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(manager); in = url.openConnection().getInputStream(); while (in.read() != -1); if (manager.getCookieStore().getCookies().isEmpty()) { throw new RuntimeException("Failed: No cookies in the cookie Handler."); } }
Example #9
Source File: HttpConnectorFactory.java From apiman with Apache License 2.0 | 6 votes |
/** * @return a new http client */ private OkHttpClient createHttpClient() { OkHttpClient client = new OkHttpClient(); client.setReadTimeout(connectorOptions.getReadTimeout(), TimeUnit.SECONDS); client.setWriteTimeout(connectorOptions.getWriteTimeout(), TimeUnit.SECONDS); client.setConnectTimeout(connectorOptions.getConnectTimeout(), TimeUnit.SECONDS); client.setFollowRedirects(connectorOptions.isFollowRedirects()); client.setFollowSslRedirects(connectorOptions.isFollowRedirects()); client.setProxySelector(ProxySelector.getDefault()); client.setCookieHandler(CookieHandler.getDefault()); client.setCertificatePinner(CertificatePinner.DEFAULT); client.setAuthenticator(AuthenticatorAdapter.INSTANCE); client.setConnectionPool(ConnectionPool.getDefault()); client.setProtocols(Util.immutableList(Protocol.HTTP_1_1)); client.setConnectionSpecs(DEFAULT_CONNECTION_SPECS); client.setSocketFactory(SocketFactory.getDefault()); Internal.instance.setNetwork(client, Network.DEFAULT); return client; }
Example #10
Source File: HttpOnly.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void test(String[] args) throws Exception { HttpServer server = startHttpServer(); CookieHandler previousHandler = CookieHandler.getDefault(); try { InetSocketAddress address = server.getAddress(); URI uri = new URI("http://" + InetAddress.getLocalHost().getHostAddress() + ":" + address.getPort() + URI_PATH); populateCookieStore(uri); doClient(uri); } finally { CookieHandler.setDefault(previousHandler); server.stop(0); } }
Example #11
Source File: IosHttpURLConnection.java From j2objc with Apache License 2.0 | 5 votes |
/** * Add any cookies for this URI to the request headers. */ private void loadRequestCookies() throws IOException { CookieHandler cookieHandler = CookieHandler.getDefault(); if (cookieHandler != null) { try { URI uri = getURL().toURI(); Map<String, List<String>> cookieHeaders = cookieHandler.get(uri, getHeaderFieldsDoNotForceResponse()); for (Map.Entry<String, List<String>> entry : cookieHeaders.entrySet()) { String key = entry.getKey(); if (("Cookie".equalsIgnoreCase(key) || "Cookie2".equalsIgnoreCase(key)) && !entry.getValue().isEmpty()) { List<String> cookies = entry.getValue(); StringBuilder sb = new StringBuilder(); for (int i = 0, size = cookies.size(); i < size; i++) { if (i > 0) { sb.append("; "); } sb.append(cookies.get(i)); } setHeader(key, sb.toString()); } } } catch (URISyntaxException e) { throw new IOException(e); } } }
Example #12
Source File: HttpOnly.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void test(String[] args) throws Exception { HttpServer server = startHttpServer(); CookieHandler previousHandler = CookieHandler.getDefault(); try { InetSocketAddress address = server.getAddress(); URI uri = new URI("http://" + InetAddress.getLocalHost().getHostAddress() + ":" + address.getPort() + URI_PATH); populateCookieStore(uri); doClient(uri); } finally { CookieHandler.setDefault(previousHandler); server.stop(0); } }
Example #13
Source File: CookieHttpsClientTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
void doClientSide() throws Exception { // Wait for server to get started. while (!serverReady) { Thread.sleep(50); } HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; }}); URL url = new URL("https://localhost:" + serverPort +"/"); // Run without a CookieHandler first InputStream in = url.openConnection().getInputStream(); while (in.read() != -1); // read response body so connection can be reused // Set a CookeHandler and retest using the HttpClient from the KAC CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(manager); in = url.openConnection().getInputStream(); while (in.read() != -1); if (manager.getCookieStore().getCookies().isEmpty()) { throw new RuntimeException("Failed: No cookies in the cookie Handler."); } }
Example #14
Source File: CookieHttpsClientTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void doClientSide() throws Exception { // Wait for server to get started. while (!serverReady) { Thread.sleep(50); } HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; }}); URL url = new URL("https://localhost:" + serverPort +"/"); // Run without a CookieHandler first InputStream in = url.openConnection().getInputStream(); while (in.read() != -1); // read response body so connection can be reused // Set a CookeHandler and retest using the HttpClient from the KAC CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(manager); in = url.openConnection().getInputStream(); while (in.read() != -1); if (manager.getCookieStore().getCookies().isEmpty()) { throw new RuntimeException("Failed: No cookies in the cookie Handler."); } }
Example #15
Source File: OrientDBHttpAPIResource.java From wicket-orientdb with Apache License 2.0 | 5 votes |
/** * Mounts OrientDB REST API Bridge to an app * @param resource {@link OrientDBHttpAPIResource} to mount * @param app {@link WebApplication} to mount to * @param mountPaths array of paths to mount to */ public static void mountOrientDbRestApi(OrientDBHttpAPIResource resource, WebApplication app, String... mountPaths) { app.getSharedResources().add(ORIENT_DB_KEY, resource); Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { String username; String password; OrientDbWebSession session = OrientDbWebSession.get(); if(session.isSignedIn()) { username = session.getUsername(); password = session.getPassword(); } else { IOrientDbSettings settings = OrientDbWebApplication.get().getOrientDbSettings(); username = settings.getGuestUserName(); password = settings.getGuestPassword(); } return new PasswordAuthentication (username, password.toCharArray()); } }); CookieHandler.setDefault(new PersonalCookieManager()); sun.net.www.protocol.http.AuthCacheValue.setAuthCache(new MultiUserCache()); for (String mountPath : mountPaths) { app.mountResource(mountPath, new SharedResourceReference(ORIENT_DB_KEY)); } }
Example #16
Source File: UTilitiesApplication.java From utexas-utilities with Apache License 2.0 | 5 votes |
public void logoutAll() { for (AuthCookie authCookie : authCookies.values()) { authCookie.logout(); } CookieStore cookies = ((CookieManager) CookieHandler.getDefault()).getCookieStore(); cookies.removeAll(); }
Example #17
Source File: BaseRetrofitClient.java From RxAndroidBootstrap with Apache License 2.0 | 5 votes |
public <T> T initRestAdapter(Context context, String endPoint, Class<T> restInterface) { okHttpClient = new OkHttpClient(); okHttpClient.setCookieHandler(CookieHandler.getDefault()); okHttpClient.setConnectTimeout(10, TimeUnit.MINUTES); connectivityAwareUrlClient = new ConnectivityAwareUrlClient(context, new OkClient(okHttpClient)); RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(endPoint) .setClient(connectivityAwareUrlClient) // .setLogLevel(RestAdapter.LogLevel.FULL) .build(); return restAdapter.create(restInterface); }
Example #18
Source File: VideoPlayerActivity.java From iview-android-tv with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EpisodeBaseModel episode = (EpisodeBaseModel) getIntent().getSerializableExtra(ContentManagerBase.CONTENT_ID); mOtherEpisodeUrls = Arrays.asList(getIntent().getStringArrayExtra(ContentManagerBase.OTHER_EPISODES)); resumePosition = getIntent().getLongExtra(RESUME_POSITION, 0); if (resumePosition <= 0 && episode.getResumePosition() > 0) { resumePosition = episode.getResumePosition(); Log.d(TAG, "Resume from recently played"); } setContentView(R.layout.video_player_activity); View root = findViewById(R.id.root); mediaController = new PlaybackControls(this); mediaController.setAnchorView(root); videoPlayerView = new VideoPlayerView(this, mediaController, root); audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(getApplicationContext(), this); CookieHandler currentHandler = CookieHandler.getDefault(); if (currentHandler != defaultCookieManager) { CookieHandler.setDefault(defaultCookieManager); } playEpisode(episode); }
Example #19
Source File: CookieHttpsClientTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void doClientSide() throws Exception { // Wait for server to get started. while (!serverReady) { Thread.sleep(50); } HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; }}); URL url = new URL("https://localhost:" + serverPort +"/"); // Run without a CookieHandler first InputStream in = url.openConnection().getInputStream(); while (in.read() != -1); // read response body so connection can be reused // Set a CookeHandler and retest using the HttpClient from the KAC CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(manager); in = url.openConnection().getInputStream(); while (in.read() != -1); if (manager.getCookieStore().getCookies().isEmpty()) { throw new RuntimeException("Failed: No cookies in the cookie Handler."); } }
Example #20
Source File: VideoPlayerActivity.java From droidkaigi2016 with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_player); View root = findViewById(R.id.root); root.setOnTouchListener((view, motionEvent) -> { if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { toggleControlsVisibility(); } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) { view.performClick(); } return true; }); root.setOnKeyListener((v, keyCode, event) -> !(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE || keyCode == KeyEvent.KEYCODE_MENU) && mediaController.dispatchKeyEvent(event)); shutterView = findViewById(R.id.shutter); videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame); surfaceView = (SurfaceView) findViewById(R.id.surface_view); surfaceView.getHolder().addCallback(this); subtitleLayout = (SubtitleLayout) findViewById(R.id.subtitles); mediaController = new KeyCompatibleMediaController(this); mediaController.setAnchorView(root); CookieHandler currentHandler = CookieHandler.getDefault(); if (currentHandler != defaultCookieManager) { CookieHandler.setDefault(defaultCookieManager); } audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this); audioCapabilitiesReceiver.register(); }
Example #21
Source File: HttpConfigFeature.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static CookieHandler getInternalCookieHandler() { try { return (CookieHandler)cookieManagerConstructor.newInstance(null, cookiePolicy); } catch(Exception e) { throw new WebServiceException(e); } }
Example #22
Source File: HttpConfigFeature.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static CookieHandler getInternalCookieHandler() { try { return (CookieHandler)cookieManagerConstructor.newInstance(null, cookiePolicy); } catch(Exception e) { throw new WebServiceException(e); } }
Example #23
Source File: HttpConfigFeature.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static CookieHandler getInternalCookieHandler() { try { return (CookieHandler)cookieManagerConstructor.newInstance(null, cookiePolicy); } catch(Exception e) { throw new WebServiceException(e); } }
Example #24
Source File: AbstractCookiesTest.java From j2objc with Apache License 2.0 | 5 votes |
public void testNetscapeResponse() throws Exception { CookieManager cookieManager = new CookieManager(createCookieStore(), ACCEPT_ORIGINAL_SERVER); CookieHandler.setDefault(cookieManager); server.play(); server.enqueue(new MockResponse().addHeader("Set-Cookie: a=android; " + "expires=Fri, 31-Dec-9999 23:59:59 GMT; " + "path=/path; " + "domain=" + server.getCookieDomain() + "; " + "secure")); get(server, "/path/foo"); List<HttpCookie> cookies = cookieManager.getCookieStore().getCookies(); assertEquals(1, cookies.size()); HttpCookie cookie = cookies.get(0); assertEquals("a", cookie.getName()); assertEquals("android", cookie.getValue()); assertEquals(null, cookie.getComment()); assertEquals(null, cookie.getCommentURL()); assertEquals(false, cookie.getDiscard()); assertEquals(server.getCookieDomain(), cookie.getDomain()); assertTrue(cookie.getMaxAge() > 100000000000L); assertEquals("/path", cookie.getPath()); assertEquals(true, cookie.getSecure()); assertEquals(0, cookie.getVersion()); }
Example #25
Source File: HttpOnly.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void populateCookieStore(URI uri) throws IOException { CookieManager cm = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(cm); Map<String,List<String>> header = new HashMap<>(); List<String> values = new ArrayList<>(); values.add("JSESSIONID=" + SESSION_ID + "; version=1; Path=" + URI_PATH +"; HttpOnly"); values.add("CUSTOMER=WILE_E_COYOTE; version=1; Path=" + URI_PATH); header.put("Set-Cookie", values); cm.put(uri, header); }
Example #26
Source File: CookieHttpClientTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
CookieHttpClientTest() throws Exception { /* start the server */ ss = new ServerSocket(0); (new Thread(this)).start(); URL url = new URL("http://localhost:" + ss.getLocalPort() +"/"); // Run without a CookieHandler first InputStream in = url.openConnection().getInputStream(); while (in.read() != -1); // read response body so connection can be reused // Set a CookeHandler and retest using the HttpClient from the KAC CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(manager); in = url.openConnection().getInputStream(); while (in.read() != -1); if (manager.getCookieStore().getCookies().isEmpty()) { throw new RuntimeException("Failed: No cookies in the cookie Handler."); } }
Example #27
Source File: CookieHttpsClientTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void doClientSide() throws Exception { // Wait for server to get started. while (!serverReady) { Thread.sleep(50); } HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; }}); URL url = new URL("https://localhost:" + serverPort +"/"); // Run without a CookieHandler first InputStream in = url.openConnection().getInputStream(); while (in.read() != -1); // read response body so connection can be reused // Set a CookeHandler and retest using the HttpClient from the KAC CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(manager); in = url.openConnection().getInputStream(); while (in.read() != -1); if (manager.getCookieStore().getCookies().isEmpty()) { throw new RuntimeException("Failed: No cookies in the cookie Handler."); } }
Example #28
Source File: HttpOnly.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void populateCookieStore(URI uri) throws IOException { CookieManager cm = new CookieManager(null, CookiePolicy.ACCEPT_ALL); CookieHandler.setDefault(cm); Map<String,List<String>> header = new HashMap<>(); List<String> values = new ArrayList<>(); values.add("JSESSIONID=" + SESSION_ID + "; version=1; Path=" + URI_PATH +"; HttpOnly"); values.add("CUSTOMER=WILE_E_COYOTE; version=1; Path=" + URI_PATH); header.put("Set-Cookie", values); cm.put(uri, header); }
Example #29
Source File: AbstractCookiesTest.java From j2objc with Apache License 2.0 | 5 votes |
public void testQuotedAttributeValues() throws Exception { CookieManager cookieManager = new CookieManager(createCookieStore(), ACCEPT_ORIGINAL_SERVER); CookieHandler.setDefault(cookieManager); server.play(); server.enqueue(new MockResponse().addHeader("Set-Cookie2: a=\"android\"; " + "Comment=\"this cookie is delicious\"; " + "CommentURL=\"http://google.com/\"; " + "Discard; " + "Domain=\"" + server.getCookieDomain() + "\"; " + "Max-Age=\"60\"; " + "Path=\"/path\"; " + "Port=\"80,443," + server.getPort() + "\"; " + "Secure; " + "Version=\"1\"")); get(server, "/path/foo"); List<HttpCookie> cookies = cookieManager.getCookieStore().getCookies(); assertEquals(1, cookies.size()); HttpCookie cookie = cookies.get(0); assertEquals("a", cookie.getName()); assertEquals("android", cookie.getValue()); assertEquals("this cookie is delicious", cookie.getComment()); assertEquals("http://google.com/", cookie.getCommentURL()); assertEquals(true, cookie.getDiscard()); assertEquals(server.getCookieDomain(), cookie.getDomain()); assertEquals(60, cookie.getMaxAge()); assertEquals("/path", cookie.getPath()); assertEquals("80,443," + server.getPort(), cookie.getPortlist()); assertEquals(true, cookie.getSecure()); assertEquals(1, cookie.getVersion()); }
Example #30
Source File: HttpConfigFeature.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static CookieHandler getInternalCookieHandler() { try { return (CookieHandler)cookieManagerConstructor.newInstance(null, cookiePolicy); } catch(Exception e) { throw new WebServiceException(e); } }