Android StringEntity - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android StringEntity class.

This code example shows how to use the following methods:
    public PersitingActorTestCase<T> given(String httpResponseBody) {
        httpResponse = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("http", 1, 1),
                200, "OK")); 
        StringEntity entity = null;
        try { 
            entity = new StringEntity(httpResponseBody);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } 
        httpResponse.setEntity(entity);
        return this;
    } 
 
    public PersitingActorTestCase<T> whenReceived() { 
        actor.onResponseReceived(httpResponse);
        return this;
    } 
 
    public void inserts(List<Pair<Uri, ContentValues>> values) {
        assertEquals(values.size(), resolver.operations.size());
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
		return null; 
	} 
 
    private void putUrl(String url, String data) throws Exception {
        HttpPut put = new HttpPut(url);
        put.setEntity(new StringEntity(data));
        HttpResponse response = executeRequest(put);
    } 
 
	protected HttpResponse executeRequest(HttpUriRequest request)
			throws ClientProtocolException, IOException { 
		DefaultHttpClient httpClient = new DefaultHttpClient();
		HttpResponse response = null;
		int retries = 3;
 
		while (retries-- > 0) {
			this.signRequest(request);
			response = httpClient.execute(request);
			int statusCode = response.getStatusLine().getStatusCode();
			if (statusCode == 400 || statusCode == 401) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
            public void handle( 
                    HttpRequest request,
                    HttpResponse response,
                    HttpContext context) throws HttpException, IOException {
                 String uri = request.getRequestLine().getUri();
                 response.setEntity(new StringEntity(uri));
            } 
        }); 
 
        mServer.start();
        mServerUrl = "http://localhost:" + mServer.getPort() + "/";
    } 
 
    protected void tearDown() throws Exception { 
        if (mServer != null) mServer.shutdown();
    } 
 
    @LargeTest 
    public void testThreadCheck() throws Exception { 
        ContentResolver resolver = getContext().getContentResolver();
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getContentType
	protected <T> T doPost(String url, String postBody, ResponseHandler<T> responseHandler) {
		HttpPost request = new HttpPost(url);
		HttpEntity entity;
 
		try { 
			entity = new StringEntity(postBody);
		} 
		catch (UnsupportedEncodingException e) {
			Log.e("Couldn't encode params", e);
			return null; 
		} 
 
		Header header = entity.getContentType();
		if (header != null) {
			request.addHeader(header);
		} 
 
		request.setEntity(entity);
 
		Log.i("Request URL: " + url);
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setContentType
	} 
 
	private void setEntity(HttpEntityEnclosingRequest request, String body, String contentType) {
		StringEntity entity;
		try { 
			entity = new StringEntity(body, CHARSET);
		} catch (UnsupportedEncodingException e) {
			throw new RedmineInternalError("Required charset " + CHARSET
					+ " is not supported", e);
		} 
		entity.setContentType(contentType);
		request.setEntity(entity);
	} 
 
	@SuppressWarnings("unchecked") 
	private <T> EntityConfig<T> getConfig(Class<?> class1) {
		final EntityConfig<?> guess = OBJECT_CONFIGS.get(class1);
		if (guess == null)
			throw new RedmineInternalError("Unsupported class " + class1);
		return (EntityConfig<T>) guess;
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android StringEntity Questions & Answers:

See Code Examples for Android StringEntity Methods: