当前位置: 首页>>代码示例>>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;未经允许,请勿转载。