ResponseHandler handleResponse - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ResponseHandler handleResponse method.

This code example shows how to use the following methods:handleResponse
		HttpResponse response = null;
		boolean hasErrors = true;
		try { 
			response = NetworkCalls.performGetRequest(Constants.API_URL
					+ "node/" + this.nid + ".json");
			ResponseHandler<String> handler = new BasicResponseHandler();
			annotation = new Annotation(handler.handleResponse(response));
			hasErrors = false;
		} catch (JSONException e) {
			e.printStackTrace();
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} 
		 
		if (response != null) {
			return new OperationResult<Annotation>(hasErrors,
					response.getStatusLine().getStatusCode(), response
							.getStatusLine().getReasonPhrase(), annotation);
5
CodeRank
This code example shows how to use the following methods:handleResponse
			body.add(new BasicNameValuePair("comment_body[und][0][value]",
					this.body));
			body.add(new BasicNameValuePair("nid", Integer.toString(this.id)));
			response = NetworkCalls.performPostRequest(Constants.API_URL
					+ "comment.json", body, this.sessionInfo);
			ResponseHandler<String> handler = new BasicResponseHandler();
			comment = this.parseResult(handler.handleResponse(response));
			hasErrors = false;
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} 
		return new OperationResult<Comment>(hasErrors,
				response.getStatusLine().getStatusCode(), response
						.getStatusLine().getReasonPhrase(), comment);
	} 
 
	private Comment parseResult(String handleResponse) {
		Log.d("whatsup", handleResponse);
5
CodeRank
This code example shows how to use the following methods:handleResponse
 
	public OperationResult<SessionInfo> execute() { 
		HttpResponse response = null;
		String result = null;
		this.hasErrors = true;
		ResponseHandler<String> handler = new BasicResponseHandler();
		try { 
			// Try to get a session id to use when logging in. 
			response = NetworkCalls.performPostRequest(Constants.API_URL
					+ "system/connect.json", null, null); 
			result = handler.handleResponse(response);
			this.parseConnect(result);
 
			// Actually send the user name and password to the server. 
			List<NameValuePair> body = new ArrayList<NameValuePair>(2);
			body.add(new BasicNameValuePair("username", this.username));
			body.add(new BasicNameValuePair("password", this.password));
			body.add(new BasicNameValuePair("sessid", this.sessionId));
			response = NetworkCalls.performPostRequest(Constants.API_URL
					+ "user/login.json", body, null);

5
CodeRank
This code example shows how to use the following methods:handleResponse
	} 
 
	public OperationResult<SessionInfo> execute() { 
		HttpResponse response = NetworkCalls.performPostRequest(
				Constants.API_URL + "system/connect.json", null, sessionInfo);
		ResponseHandler<String> handler = new BasicResponseHandler();
		String result = null;
		try { 
			result = handler.handleResponse(response);
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} 
		boolean hasErrors = this.parseResult(result);
		if (response != null) {
			if (hasErrors) {
				sessionInfo = null;
			} 
			return new OperationResult<SessionInfo>(hasErrors,
5
CodeRank
This code example shows how to use the following methods:handleResponse
		this.hasErrors = true;
		HttpResponse response = NetworkCalls
				.performGetRequest(Constants.API_URL + "nearby/" 
						+ this.latitudeA + "," + this.longitudeA + ","
						+ this.latitudeB + "," + this.longitudeB + ".json");
		ResponseHandler<String> handler = new BasicResponseHandler();
		String result = null;
		try { 
			result = handler.handleResponse(response);
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} 
		List<GeoLocation> geoLocations = this.parse(result);
 
		if (response != null) {
			if(hasErrors) {
				geoLocations = null;
			} 
5
CodeRank
This code example shows how to use the following methods:handleResponse
			body.add(new BasicNameValuePair(
					"node[locations][0][locpick][user_longitude]", 
					this.longitude + ""));
			response = NetworkCalls.performPostRequest(Constants.API_URL
					+ "node.json", body, this.sessionInfo);
			ResponseHandler<String> handler = new BasicResponseHandler();
			annotation = this.parseResult(handler.handleResponse(response));
			hasErrors = false;
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} 
		return new OperationResult<Annotation>(hasErrors,
				response.getStatusLine().getStatusCode(), response
						.getStatusLine().getReasonPhrase(), annotation);
	} 
 
	private Annotation parseResult(String result) {
		try { 
5
CodeRank
This code example shows how to use the following methods:handleResponse
This code example shows how to use the following methods:handleResponse
	} 
	 
	protected JSONArray parseResponse (HttpResponse response)
		throws ClientProtocolException, IOException, JSONException 
	{ 
		ResponseHandler<String> responseHandler = new BasicResponseHandler();
        String body = responseHandler.handleResponse(response);
        Log.d(this.getClass().getCanonicalName(), body);
 
        return new JSONArray(body);
	} 
	 
	protected void displayActions (String url, int responseCode, JSONArray actions)
	{ 
	    Calendar cal = Calendar.getInstance();
	    Date date = cal.getTime();
	    StringBuilder html = new StringBuilder();
	    StringBuilder temp = new StringBuilder();
	    html.append("<html><body bgcolor=\"lime\">");
	    temp.append(date.toLocaleString()).append(":  ").append(" url=").append(url).append(" -> ").append(responseCode);
4
CodeRank
This code example shows how to use the following methods:handleResponse
This code example shows how to use the following methods:handleResponse
		if (context.getAttribute(ATTR_SKIP_PROCESSING) != null
				&& (Boolean) context.getAttribute(ATTR_SKIP_PROCESSING)) {
			response = (HttpResponse) context
					.getAttribute(ATTR_OVERRIDDEN_RESPONSE);
			T result;
			result = wrappedHandler.handleResponse(response);
			return result;
		} else { 
			// TODO: Need to add proper error handling. Really need to put in 
			// the correct wrapper 
			T result = delgatedHttpClientImpl.execute(arg0, wrappedHandler);
			return result;
		} 
	} 
 
	@Override 
	public HttpResponse execute(HttpHost arg0, HttpRequest arg1,
			HttpContext arg2) throws IOException, ClientProtocolException {
		return delgatedHttpClientImpl.execute(arg0, arg1, arg2);
	} 
5
CodeRank
handleResponse Method Overview
Processes an HttpResponse and returns some value corresponding to that response.
See Code Examples for other Android ResponseHandler Methods: