本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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 );
}
示例8: SessionManager
public SessionManager(CookieStore cookieJar) {
cookieManager = new CookieManager(cookieJar, CookiePolicy.ACCEPT_ORIGINAL_SERVER);
// Making sure cookies are enabled
CookieHandler.setDefault(cookieManager);
}