List of usage examples for org.apache.http.client.params CookiePolicy RFC_2109
String RFC_2109
To view the source code for org.apache.http.client.params CookiePolicy RFC_2109.
Click Source Link
From source file:lets.code.project.conectividad.WebService.java
private String webInvoke(String methodName, String data, String contentType) { super.returnedValue = null; httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); httpPost = new HttpPost(webServiceUrl + methodName); response = null;//from w ww. j ava 2s .c o m StringEntity tmp = null; httpPost.setHeader("Accept", "text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); if (contentType != null) { httpPost.setHeader("Content-Type", contentType); } else { httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); } try { tmp = new StringEntity(data, "UTF-8"); } catch (UnsupportedEncodingException e) { Log.e("WebService", "HttpUtils : UnsupportedEncodingException : " + e); } httpPost.setEntity(tmp); Log.d("WebService", webServiceUrl + "?" + data); try { response = httpClient.execute(httpPost, localContext); if (response != null) { returnedValue = EntityUtils.toString(response.getEntity()); } } catch (Exception e) { Log.e("WebService", "HttpUtils: " + e); } return returnedValue; }
From source file:org.apache.deltaspike.test.servlet.impl.event.session.SessionEventsTest.java
@BeforeClass public static void initHttpClient() { client = new DefaultHttpClient(); client.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); }
From source file:com.aikidonord.utils.HttpRequest.java
public String sendPost(String url, String data, String contentType) { ret = null;// ww w .j a v a 2 s . c o m httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); httpPost = new HttpPost(url); response = null; StringEntity tmp = null; //Log.d("LM", "Setting httpPost headers"); httpPost.setHeader("User-Agent", "AikidoNord Android"); httpPost.setHeader("Accept", "text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); if (contentType != null) { httpPost.setHeader("Content-Type", contentType); } else { httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); } try { tmp = new StringEntity(data, "UTF-8"); } catch (UnsupportedEncodingException e) { Log.e("AikidoNord", "HttpUtils : UnsupportedEncodingException : " + e); } httpPost.setEntity(tmp); //Log.d("LM", url + "?" + data); try { response = httpClient.execute(httpPost, localContext); if (response != null) { ret = EntityUtils.toString(response.getEntity()); } } catch (Exception e) { Log.e("AikidoNord", "HttpUtils: " + e); } return ret; }
From source file:org.ednovo.goorusearchwidget.WebService.java
public String webInvoke(String methodName, String data, String contentType) { ret = null;/*from ww w. j av a 2 s .com*/ httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); httpPost = new HttpPost(webServiceUrl); response = null; StringEntity tmp = null; httpPost.setHeader("Accept", "text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); if (contentType != null) { Log.i("Content Type if", contentType); httpPost.setHeader("Content-Type", "" + contentType); } else { Log.i("Content Type else", "" + contentType); httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); } try { tmp = new StringEntity(data, "UTF-8"); } catch (UnsupportedEncodingException e) { Log.e("Groshie", "HttpUtils : UnsupportedEncodingException : " + e); } httpPost.setEntity(tmp); try { response = httpClient.execute(httpPost, localContext); if (response != null) { ret = EntityUtils.toString(response.getEntity()); // JSONObject json = new JSONObject(ret); } } catch (Exception e) { Log.e("Groshie data", "HttpUtils: " + e); } return ret; }
From source file:biz.mosil.webtools.MosilWeb.java
/** * Constructor// w w w. j ava 2 s .c om * */ public MosilWeb(Context _context) { mHostName = ""; mContext = _context; mHttpContext = new BasicHttpContext(); mHttpContext.setAttribute(ClientContext.COOKIE_STORE, new BasicCookieStore()); mHttpParams = new BasicHttpParams(); mHttpParams.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); HttpConnectionParams.setConnectionTimeout(mHttpParams, MosilWebConf.CONNECT_TIME); HttpConnectionParams.setSoTimeout(mHttpParams, MosilWebConf.SOCKET_TIME); }
From source file:com.entertailion.android.dial.HttpRequestHelper.java
public String sendPost(String url, Map<String, String> params, String contentType) { ret = null;// www .j a va2 s . c o m try { httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); httpPost = new HttpPost(url); response = null; Log.d(TAG, "Setting httpPost headers"); httpPost.setHeader("Accept", "text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); if (contentType != null) { httpPost.setHeader("Content-Type", contentType); } else { httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); } httpPost.setEntity(buildData(params)); response = httpClient.execute(httpPost, localContext); if (response != null) { ret = EntityUtils.toString(response.getEntity()); } } catch (Throwable e) { Log.e(TAG, "Failed to post to url: " + url, e); } Log.d(TAG, "Returning value:" + ret); return ret; }
From source file:com.entertailion.android.launcher.utils.HttpRequestHelper.java
public String sendPost(String url, Map<String, String> params, String contentType) { ret = null;/*w w w.j a v a 2 s .co m*/ try { httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); httpPost = new HttpPost(url); response = null; Log.d(TAG, "Setting httpPost headers"); httpPost.setHeader("Accept", "text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); if (contentType != null) { httpPost.setHeader("Content-Type", contentType); } else { httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); } httpPost.setEntity(buildData(params)); response = httpClient.execute(httpPost, localContext); if (response != null) { ret = EntityUtils.toString(response.getEntity()); } } catch (Throwable e) { Log.e(TAG, "Failed to post to url: " + url, e); e.printStackTrace(); } Log.d(TAG, "Returning value:" + ret); return ret; }
From source file:com.entertailion.android.slideshow.utils.HttpRequestHelper.java
public String sendPost(String url, Map<String, String> params, String contentType) { ret = null;// w w w .j ava2 s. c o m try { httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); httpPost = new HttpPost(url); response = null; Log.d(LOG_TAG, "Setting httpPost headers"); httpPost.setHeader("Accept", "text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); if (contentType != null) { httpPost.setHeader("Content-Type", contentType); } else { httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); } httpPost.setEntity(buildData(params)); response = httpClient.execute(httpPost, localContext); if (response != null) { ret = EntityUtils.toString(response.getEntity()); } } catch (Throwable e) { Log.e(LOG_TAG, "Failed to post to url: " + url, e); } Log.d(LOG_TAG, "Returning value:" + ret); return ret; }
From source file:free.yhc.netmbuddy.model.NetLoader.java
private HttpClient newHttpClient(String proxyAddr) { if (isValidProxyAddr(proxyAddr)) { // TODO/* ww w. j a v a 2 s .c o m*/ // Not supported yet. eAssert(false); return null; } HttpClient hc = new DefaultHttpClient(); HttpParams params = hc.getParams(); HttpConnectionParams.setConnectionTimeout(params, Policy.NETWORK_CONN_TIMEOUT); HttpConnectionParams.setSoTimeout(params, Policy.NETWORK_CONN_TIMEOUT); HttpProtocolParams.setUserAgent(hc.getParams(), Policy.HTTP_UASTRING); params.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); return hc; }
From source file:com.frentix.restapi.RestConnection.java
/** * Creates a new RestConnection instance. * //w w w .ja v a 2 s . co m * @param host remote host * @param port the port to connect * @param protocol the protocol to be used * @param contextPath the default context path * @param login credentials * @param password credentials */ public RestConnection(String host, int port, String protocol, String contextPath, String login, String password) { this.port = port; this.host = host; this.protocol = protocol; this.contextPath = contextPath; this.login = login; this.password = password; httpclient = new DefaultHttpClient(); HttpClientParams.setCookiePolicy(httpclient.getParams(), CookiePolicy.RFC_2109); }