Java Code Examples for com.ning.http.client.AsyncHttpClient.BoundRequestBuilder#addQueryParam()
The following examples show how to use
com.ning.http.client.AsyncHttpClient.BoundRequestBuilder#addQueryParam() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractLeaderAwareResource.java From Singularity with Apache License 2.0 | 6 votes |
private void copyHeadersAndParams( BoundRequestBuilder requestBuilder, HttpServletRequest request ) { Enumeration<String> headerNames = request.getHeaderNames(); if (headerNames != null) { while (headerNames.hasMoreElements()) { String headerName = headerNames.nextElement(); requestBuilder.addHeader(headerName, request.getHeader(headerName)); LOG.trace("Copied header {}:{}", headerName, request.getHeader(headerName)); } } Enumeration<String> parameterNames = request.getParameterNames(); if (parameterNames != null) { while (parameterNames.hasMoreElements()) { String parameterName = parameterNames.nextElement(); requestBuilder.addQueryParam(parameterName, request.getParameter(parameterName)); LOG.trace( "Copied query param {}={}", parameterName, request.getParameter(parameterName) ); } } }
Example 2
Source File: AgentManager.java From Baragon with Apache License 2.0 | 6 votes |
private AsyncHttpClient.BoundRequestBuilder buildAgentRequest(String url, AgentRequestType requestType) { final BoundRequestBuilder builder; switch (requestType) { case APPLY: builder = asyncHttpClient.preparePost(url); break; case REVERT: case CANCEL: builder = asyncHttpClient.prepareDelete(url); break; default: throw new RuntimeException("Don't know how to send requests for " + requestType); } if (baragonAuthKey.isPresent()) { builder.addQueryParam("authkey", baragonAuthKey.get()); } return builder; }
Example 3
Source File: LoadBalancerClientImpl.java From Singularity with Apache License 2.0 | 5 votes |
private void addAllQueryParams( BoundRequestBuilder boundRequestBuilder, Map<String, String> queryParams ) { for (Map.Entry<String, String> entry : queryParams.entrySet()) { boundRequestBuilder.addQueryParam(entry.getKey(), entry.getValue()); } }
Example 4
Source File: AgentManager.java From Baragon with Apache License 2.0 | 5 votes |
private AsyncHttpClient.BoundRequestBuilder buildAgentBatchRequest(String url, List<BaragonRequestBatchItem> batch) throws JsonProcessingException { final BoundRequestBuilder builder = asyncHttpClient.preparePost(url); if (baragonAuthKey.isPresent()) { builder.addQueryParam("authkey", baragonAuthKey.get()); } builder.addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); builder.setBody(objectMapper.writeValueAsBytes(batch)); return builder; }