當前位置: 首頁>>代碼示例>>Java>>正文


Java CookieHandler.getDefault方法代碼示例

本文整理匯總了Java中java.net.CookieHandler.getDefault方法的典型用法代碼示例。如果您正苦於以下問題:Java CookieHandler.getDefault方法的具體用法?Java CookieHandler.getDefault怎麽用?Java CookieHandler.getDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.net.CookieHandler的用法示例。


在下文中一共展示了CookieHandler.getDefault方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: copyWithDefaults

import java.net.CookieHandler; //導入方法依賴的package包/類
OkHttpClient copyWithDefaults() {
    OkHttpClient result = new OkHttpClient(this);
    if (result.proxySelector == null) {
        result.proxySelector = ProxySelector.getDefault();
    }
    if (result.cookieHandler == null) {
        result.cookieHandler = CookieHandler.getDefault();
    }
    if (result.socketFactory == null) {
        result.socketFactory = SocketFactory.getDefault();
    }
    if (result.sslSocketFactory == null) {
        result.sslSocketFactory = getDefaultSSLSocketFactory();
    }
    if (result.hostnameVerifier == null) {
        result.hostnameVerifier = OkHostnameVerifier.INSTANCE;
    }
    if (result.certificatePinner == null) {
        result.certificatePinner = CertificatePinner.DEFAULT;
    }
    if (result.authenticator == null) {
        result.authenticator = AuthenticatorAdapter.INSTANCE;
    }
    if (result.connectionPool == null) {
        result.connectionPool = ConnectionPool.getDefault();
    }
    if (result.protocols == null) {
        result.protocols = DEFAULT_PROTOCOLS;
    }
    if (result.connectionSpecs == null) {
        result.connectionSpecs = DEFAULT_CONNECTION_SPECS;
    }
    if (result.dns == null) {
        result.dns = Dns.SYSTEM;
    }
    return result;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:38,代碼來源:OkHttpClient.java

示例2: copyWithDefaults

import java.net.CookieHandler; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:27,代碼來源:OkHttpClient.java

示例3: createViews

import java.net.CookieHandler; //導入方法依賴的package包/類
private void createViews() {
    mediaDataSourceFactory = buildDataSourceFactory(true);
    mainHandler = new Handler();
    window = new Timeline.Window();
    if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
        CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
    }

    LayoutParams layoutParams = new LayoutParams(
            LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);
    exoPlayerView = new ExoPlayerView(getContext());
    exoPlayerView.setLayoutParams(layoutParams);

    addView(exoPlayerView, 0, layoutParams);
}
 
開發者ID:12d,項目名稱:react-native-videoplayer,代碼行數:17,代碼來源:ReactExoplayerView.java

示例4: onCreate

import java.net.CookieHandler; //導入方法依賴的package包/類
@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();
}
 
開發者ID:ashwanijanghu,項目名稱:ExoPlayer-Offline,代碼行數:24,代碼來源:PlayerActivity.java

示例5: initCookieManager

import java.net.CookieHandler; //導入方法依賴的package包/類
public static void initCookieManager() {

        CookieHandler cookieHandler = CookieHandler.getDefault();

        if (cookieHandler == null) {
            // CookieStore cookieStore = CookieStoreHolder.initInMemoryCookieStore();
            // CookieManager cm = new CookieManager(cookieStore, CookiePolicy.ACCEPT_ALL);
            CookieManager cm = new CookieManager();
            cm.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
            CookieHandler.setDefault(cm);
        }
        // else {
        // CookieStoreHolder.initInMemoryCookieStore();
        // }

    }
 
開發者ID:clstoulouse,項目名稱:motu,代碼行數:17,代碼來源:CookieStoreHolder.java

示例6: printCookieInfo

import java.net.CookieHandler; //導入方法依賴的package包/類
static private void printCookieInfo(URI uri) throws IOException {
    CookieHandler handler = CookieHandler.getDefault();
    Map<String, List<String>> cookieMap = null;

    if (handler == null) {
        System.out.println("Failing due to lack of CookieHandler class!");
        return;
    }
    System.out.println("Using CookieHandler class: " + handler.getClass().getCanonicalName());

    cookieMap = handler.get(uri, new HashMap<String, List<String>>());
    for (Map.Entry<String, List<String>> entry : cookieMap.entrySet()) {
        System.out.println("Iterating cookiemap with " + entry.getKey() + " => " + entry.getValue());
        if (entry.getKey().contains("Cookie")) {
            for (String cookie : entry.getValue()) {
                System.out.println("Found cookie: " + cookie);
            }
        }
    }
}
 
開發者ID:GITNE,項目名稱:icedtea-web,代碼行數:21,代碼來源:CheckingCookies.java

示例7: onCreate

import java.net.CookieHandler; //導入方法依賴的package包/類
@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 = findViewById(R.id.controls_root);
  debugTextView = findViewById(R.id.debug_text_view);
  retryButton = findViewById(R.id.retry_button);
  retryButton.setOnClickListener(this);

  simpleExoPlayerView = findViewById(R.id.player_view);
  simpleExoPlayerView.setControllerVisibilityListener(this);
  simpleExoPlayerView.requestFocus();
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:24,代碼來源:PlayerActivity.java

示例8: test

import java.net.CookieHandler; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:HttpOnly.java

示例9: onCreate

import java.net.CookieHandler; //導入方法依賴的package包/類
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        shouldAutoPlay = true;
        mediaDataSourceFactory = buildDataSourceFactory(true);
        mainHandler = new Handler();
        window = new Timeline.Window();
        if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
            CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
        }

        setContentView(R.layout.player_activity_v2);
//        View rootView = findViewById(root);

        simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
//        simpleExoPlayerView.setControllerVisibilityListener(this);
        simpleExoPlayerView.requestFocus();

        /**不使用ExoPlayer自帶的mediaController**/
        simpleExoPlayerView.setUseController(false);

        controller = (MediaControlView) findViewById(R.id.player_control);
        controller.setVisibilityListener(new MediaControlView.VisibilityListener() {
            @Override
            public void onVisibilityChange(int visibility) {

            }
        });
        EventBus.getDefault().register(this);
    }
 
開發者ID:AndroidTips,項目名稱:MDVideo,代碼行數:31,代碼來源:PlayerActivityV2.java

示例10: onCreate

import java.net.CookieHandler; //導入方法依賴的package包/類
@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);
}
 
開發者ID:nextux,項目名稱:sbs-android-tv,代碼行數:29,代碼來源:VideoPlayerActivity.java

示例11: onCreate

import java.net.CookieHandler; //導入方法依賴的package包/類
@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();
}
 
開發者ID:konifar,項目名稱:droidkaigi2016,代碼行數:37,代碼來源:VideoPlayerActivity.java

示例12: onCreate

import java.net.CookieHandler; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  shouldAutoPlay = true;
  mediaDataSourceFactory = buildDataSourceFactory(true);
  mainHandler = new Handler();
  window = new Timeline.Window();
  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();

  String title = getIntent().getStringExtra(PLAYER_TITLE);
  setTitle(title);
  tracker.setScreenName("播放器: " + title);
  tracker.send(new HitBuilders.ScreenViewBuilder().build());
}
 
開發者ID:TakumaMochizuki,項目名稱:Komica,代碼行數:29,代碼來源:PlayerActivity.java

示例13: printEnvironment

import java.net.CookieHandler; //導入方法依賴的package包/類
private void printEnvironment() {
	Version version = new Version();
	addDetailMessage("eID browser applet version: " + version.getVersion());
	addDetailMessage("Java version: " + System.getProperty("java.version"));
	addDetailMessage("Java vendor: " + System.getProperty("java.vendor"));
	addDetailMessage("OS: " + System.getProperty("os.name"));
	addDetailMessage("OS version: " + System.getProperty("os.version"));
	addDetailMessage("OS arch: " + System.getProperty("os.arch"));
	addDetailMessage("Web application URL: " + this.runtime.getDocumentBase());
	addDetailMessage("Current time: " + new Date());

	/*
	 * Next we check for the presence of the session cookie.
	 */
	CookieHandler cookieHandler = CookieHandler.getDefault();
	if (null != cookieHandler) {
		URL documentBase = this.runtime.getApplet().getDocumentBase();
		try {
			Map<String, List<String>> headers = cookieHandler.get(documentBase.toURI(),
					new HashMap<String, List<String>>());
			List<String> cookieHeaderValues = headers.get("Cookie");
			if (null == cookieHeaderValues || cookieHeaderValues.isEmpty()) {
				addDetailMessage("ERROR: no session cookie detected!");
			} else {
				/*
				 * Of course we don't print out the session cookie...
				 */
				addDetailMessage("session cookie detected");
			}
		} catch (Exception e) {
			addDetailMessage("error getting cookies from default cookie handler");
		}
	}
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:35,代碼來源:Controller.java

示例14: clearDownloaderCookies

import java.net.CookieHandler; //導入方法依賴的package包/類
private static void clearDownloaderCookies() {
  CookieHandler handler = CookieHandler.getDefault();
  if (handler != null && handler instanceof CookieManager) {
    CookieStore cookies = ((CookieManager) handler).getCookieStore();
    cookies.removeAll();
    CookieHandler.setDefault(null);
  }
}
 
開發者ID:paristote,項目名稱:mobile-android-studio,代碼行數:9,代碼來源:ExoPicasso.java

示例15: ensureCookieManager

import java.net.CookieHandler; //導入方法依賴的package包/類
/**
 * Initialize the app-wide {@link CookieManager}. This is all that's
 * necessary to enable all Web requests within the app to automatically send
 * and receive cookies.
 */
protected static void ensureCookieManager() {
    if (CookieHandler.getDefault() == null) {
        CookieHandler.setDefault(new CookieManager());
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:11,代碼來源:AbstractHttpClient.java


注:本文中的java.net.CookieHandler.getDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。