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


Java CookiePolicy.ACCEPT_ORIGINAL_SERVER屬性代碼示例

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


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

示例1: newRequestQueue

private static RequestQueue newRequestQueue() {
        VolleyLog.DEBUG = true;
        RequestQueue requestQueue = new RequestQueue(openCache(), new BasicNetwork(new HurlStack()));
        requestQueue.start();
        CookieManager manager = new CookieManager(new SimpleCookieStore(), CookiePolicy.ACCEPT_ORIGINAL_SERVER);
        CookieHandler.setDefault(manager);

//        String userAgent = "volley/0";
//        try {
//            String packageName = BaseApplication.getBaseApplication().getPackageName();
//            PackageInfo info = BaseApplication.getBaseApplication().getPackageManager().getPackageInfo(packageName, 0);
//            userAgent = packageName + "/" + info.versionCode;
//        } catch (PackageManager.NameNotFoundException e) {}
//        android.net.http.AndroidHttpClient  httpClient = AndroidHttpClient.newInstance(userAgent);
//        HttpStack httpStack = new OwnHttpClientStack(httpClient);
//        RequestQueue requestQueue = Volley.newRequestQueue(BaseApplication.getBaseApplication(),
//                httpStack);


        return requestQueue;
    }
 
開發者ID:lofei117,項目名稱:TuChongAndroid,代碼行數:21,代碼來源:RequestManager.java

示例2: NetworkStore

NetworkStore() {

        kwalaCookieStore = new KwalaCookieStore(KwalaApplication.getInstance());
        CookieManager cookieManager = new CookieManager(kwalaCookieStore, CookiePolicy.ACCEPT_ORIGINAL_SERVER);
        CookieHandler.setDefault(cookieManager);

        okHttpClient = new OkHttpClient.Builder()
                .cookieJar(new JavaNetCookieJar(cookieManager))
                .authenticator(authenticator)
                .readTimeout(30, TimeUnit.SECONDS)
                .writeTimeout(30, TimeUnit.SECONDS)
                .build();

        KwalaApplication application = KwalaApplication.getInstance();

        // Initialize the Amazon Cognito credentials provider
        CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(application,
                KwalaConstants.Network.AWS_IDENTITY_POOL_ID,
                Regions.US_EAST_1
        );

        // Initialize Amazon S3 and transfer utility
        s3Client = new AmazonS3Client(credentialsProvider);
        transferUtility = new TransferUtility(s3Client, application);
    }
 
開發者ID:KwalaGroup,項目名稱:Android-Client,代碼行數:25,代碼來源:NetworkStore.java

示例3: onCreate

@Override
public void onCreate() {
    mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    // Display a notification about us starting.
    //showNotification();

    foregroundNotificationBuilder = getNotification();

 /**
  * If service runs in dedicated process it needs to load cookies from shared preferences
  */
    CookieManager cookieManager = new CookieManager(new PersistentCookieStore(this), CookiePolicy.ACCEPT_ORIGINAL_SERVER);
    CookieHandler.setDefault(cookieManager);

}
 
開發者ID:ITsvetkoFF,項目名稱:Kv-009,代碼行數:15,代碼來源:UploadingService.java

示例4: onCreate

@Override
public void onCreate() {
    super.onCreate();
    /**
     * If service runs in dedicated process it needs to load cookies from shared preferences
     */
    CookieManager cookieManager = new CookieManager(new PersistentCookieStore(this), CookiePolicy.ACCEPT_ORIGINAL_SERVER);
    CookieHandler.setDefault(cookieManager);
}
 
開發者ID:ITsvetkoFF,項目名稱:Kv-009,代碼行數:9,代碼來源:SendPendingProblemService.java

示例5: VolleyManager

/**
 * Private constructor to prevent that VolleyManager is instanciated outside this class. Uses
 * the {@link cl.magnet.magnetrestclient.utils.PersistentCookieStore} for reading and writing cookies.
 *
 * @param context The context of the controller
 */
private VolleyManager(Context context) {
    mContext = context;
    CookieManager cookieManager = new CookieManager(new PersistentCookieStore(mContext),
            CookiePolicy.ACCEPT_ORIGINAL_SERVER);
    CookieHandler.setDefault(cookieManager);
    mRequestQueue = getRequestQueue();
    mImageLoader = new ImageLoader(mRequestQueue, new LruBitmapCache(LruBitmapCache
            .getCacheSize(context)));

    // set USER AGENT
    mUserAgent = UserAgentUtils.getUserAgent(mContext);
}
 
開發者ID:magnet-cl,項目名稱:MagnetRestClient,代碼行數:18,代碼來源:VolleyManager.java

示例6: Api

private Api() {

		HttpLoggingInterceptor logging = new HttpLoggingInterceptor(RBLog::v);
		if (BuildConfig.DEBUG)
			logging.setLevel(HttpLoggingInterceptor.Level.BODY);
		cookieManager = new CookieManager(new PersistentCookieStore(), CookiePolicy.ACCEPT_ORIGINAL_SERVER);
		OkHttpClient httpclient = new OkHttpClient.Builder()
				.connectTimeout(8, TimeUnit.SECONDS)
				.writeTimeout(8, TimeUnit.SECONDS)
				.readTimeout(12, TimeUnit.SECONDS)
				.cookieJar(new JavaNetCookieJar(cookieManager))
				.addInterceptor(logging)
				.addNetworkInterceptor(new ResponseInterceptor())
				.build();
		Gson gson = new GsonBuilder()
				.disableHtmlEscaping()
				.registerTypeAdapter(FeedItem.class, new FeedItemDeserializer())
				.registerTypeAdapter(UserInfo.class, new UserInfoDeserializer())
				.registerTypeAdapter(UserRateCount.class, new UserRateCountDeserializer())
				.registerTypeAdapter(UserRating.class, new UserRatingDeserializer())
				.registerTypeAdapter(BeerSearchResult.class, new BeerSearchResultDeserializer())
				.registerTypeAdapter(BarcodeSearchResult.class, new BarcodeSearchResultDeserializer())
				.registerTypeAdapter(BeerDetails.class, new BeerDetailsDeserializer())
				.registerTypeAdapter(BeerRating.class, new BeerRatingDeserializer())
				.registerTypeAdapter(BrewerySearchResult.class, new BrewerySearchResultDeserializer())
				.registerTypeAdapter(BreweryDetails.class, new BreweryDetailsDeserializer())
				.registerTypeAdapter(BreweryBeer.class, new BreweryBeerDeserializer())
				.registerTypeAdapter(PlaceSearchResult.class, new PlaceSearchResultDeserializer())
				.registerTypeAdapter(PlaceNearby.class, new PlaceNearbyDeserializer())
				.registerTypeAdapter(PlaceDetails.class, new PlaceDetailsDeserializer())
				.registerTypeAdapter(PlaceCheckinResult.class, new PlaceCheckinResultDeserializer())
				.registerTypeAdapter(BeerOnTopList.class, new BeerOnTopListDeserializer())
				.registerTypeAdapter(CountryInfo.class, new CountryInfoDeserializer())
				.registerTypeAdapter(StateInfo.class, new StateInfoDeserializer())
				.registerTypeAdapter(StyleInfo.class, new StyleInfoDeserializer())
				.create();
		Retrofit retrofit = new Retrofit.Builder()
				.baseUrl(ENDPOINT)
				.client(httpclient)
				.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
				.addConverterFactory(new HtmlConverterFactory())
				.addConverterFactory(GsonConverterFactory.create(gson))
				.build();
		routes = retrofit.create(Routes.class);

	}
 
開發者ID:erickok,項目名稱:ratebeer,代碼行數:46,代碼來源:Api.java

示例7: RequestService

private RequestService( Context context, RequestServiceOptions requestServiceOptions )
{
	this.context = context;

	this.requestServiceOptions = requestServiceOptions;

	requestQueue = getRequestQueue();

	persistentCookieStore = new PersistentCookieStore( context );

	cookieManager = new CookieManager( persistentCookieStore, CookiePolicy.ACCEPT_ORIGINAL_SERVER );

	CookieHandler.setDefault( cookieManager );

	requestDelayedBroadcast = new RequestDelayedBroadcast();
	requestResponseProcessor = new RequestResponseProcessor( context );
}
 
開發者ID:SpartanJ,項目名稱:restafari,代碼行數:17,代碼來源:RequestService.java

示例8: SessionManager

public SessionManager(CookieStore cookieJar) {
    cookieManager = new CookieManager(cookieJar, CookiePolicy.ACCEPT_ORIGINAL_SERVER);
    // Making sure cookies are enabled
    CookieHandler.setDefault(cookieManager);

}
 
開發者ID:kylemsguy,項目名稱:tcas-mobile,代碼行數:6,代碼來源:SessionManager.java


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