List of usage examples for org.apache.http.client.params CookiePolicy NETSCAPE
String NETSCAPE
To view the source code for org.apache.http.client.params CookiePolicy NETSCAPE.
Click Source Link
From source file:org.vietspider.net.client.impl.AnonymousHttpClient.java
@Override protected CookieSpecRegistry createCookieSpecRegistry() { CookieSpecRegistry registry = new CookieSpecRegistry(); registry.register(CookiePolicy.BEST_MATCH, new BestMatchSpecFactory()); registry.register(CookiePolicy.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory()); registry.register(CookiePolicy.NETSCAPE, new NetscapeDraftSpecFactory()); registry.register(CookiePolicy.RFC_2109, new RFC2109SpecFactory()); registry.register(CookiePolicy.RFC_2965, new RFC2965SpecFactory()); return registry; }
From source file:vitkin.sfdc.mojo.wsdl.WsdlDownloadlMojo.java
/** * Get an existing HTTP client for the current instance or create a new * one.<br/>/*from w w w . j ava2s . c om*/ * When creating a new HTTP client, try to load previously saved cookies. * * @return HTTP client for the current environment and username. */ private InnerHttpClient getHttpClient() { final String env = useSandbox ? "sanbox" : "dev-prod"; final String clientId = env + '/' + username; InnerHttpClient client = clients.get(clientId); if (client == null) { client = new InnerHttpClient(env); final HttpParams params = client.getParams(); HttpClientParams.setCookiePolicy(params, CookiePolicy.NETSCAPE); params.setParameter(HttpConnectionParams.CONNECTION_TIMEOUT, 30000); clients.put(clientId, client); } return client; }
From source file:org.osiam.client.LoginOAuth2IT.java
private String givenValidAuthCode(String username, String password, String provider) throws IOException { String currentRedirectUri;/*from ww w .j a v a2s . com*/ { HttpGet httpGet = new HttpGet(loginUri); defaultHttpClient.execute(httpGet); httpGet.releaseConnection(); } { HttpPost httpPost = new HttpPost(AUTH_ENDPOINT_ADDRESS + "/login/check"); List<NameValuePair> loginCredentials = new ArrayList<>(); loginCredentials.add(new BasicNameValuePair("username", username)); loginCredentials.add(new BasicNameValuePair("password", password)); loginCredentials.add(new BasicNameValuePair("provider", provider)); UrlEncodedFormEntity loginCredentialsEntity = new UrlEncodedFormEntity(loginCredentials, "UTF-8"); httpPost.setEntity(loginCredentialsEntity); HttpResponse response = defaultHttpClient.execute(httpPost); currentRedirectUri = response.getLastHeader("Location").getValue(); httpPost.releaseConnection(); } { HttpGet httpGet = new HttpGet(currentRedirectUri); httpGet.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.NETSCAPE); httpGet.getParams().setBooleanParameter("http.protocol.handle-redirects", false); defaultHttpClient.execute(httpGet); httpGet.releaseConnection(); } { HttpPost httpPost = new HttpPost(AUTH_ENDPOINT_ADDRESS + "/oauth/authorize"); List<NameValuePair> loginCredentials = new ArrayList<>(); loginCredentials.add(new BasicNameValuePair("user_oauth_approval", "true")); UrlEncodedFormEntity loginCredentialsEntity = new UrlEncodedFormEntity(loginCredentials, "UTF-8"); httpPost.setEntity(loginCredentialsEntity); authCodeResponse = defaultHttpClient.execute(httpPost); httpPost.releaseConnection(); } return currentRedirectUri; }
From source file:org.apache.http.impl.client.AbstractHttpClient.java
protected CookieSpecRegistry createCookieSpecRegistry() { final CookieSpecRegistry registry = new CookieSpecRegistry(); registry.register(CookiePolicy.BEST_MATCH, new BestMatchSpecFactory()); registry.register(CookiePolicy.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory()); registry.register(CookiePolicy.NETSCAPE, new NetscapeDraftSpecFactory()); registry.register(CookiePolicy.RFC_2109, new RFC2109SpecFactory()); registry.register(CookiePolicy.RFC_2965, new RFC2965SpecFactory()); registry.register(CookiePolicy.IGNORE_COOKIES, new IgnoreSpecFactory()); return registry; }
From source file:org.apache.http.impl.client.AbstractStatisticsGatheringHttpClient.java
protected CookieSpecRegistry createCookieSpecRegistry() { CookieSpecRegistry registry = new CookieSpecRegistry(); registry.register(CookiePolicy.BEST_MATCH, new BestMatchSpecFactory()); registry.register(CookiePolicy.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory()); registry.register(CookiePolicy.NETSCAPE, new NetscapeDraftSpecFactory()); registry.register(CookiePolicy.RFC_2109, new RFC2109SpecFactory()); registry.register(CookiePolicy.RFC_2965, new RFC2965SpecFactory()); registry.register(CookiePolicy.IGNORE_COOKIES, new IgnoreSpecFactory()); return registry; }