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