本文整理了Java中org.apache.http.HttpRequest.getParams()
方法的一些代码示例,展示了HttpRequest.getParams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.getParams()
方法的具体详情如下:
包路径:org.apache.http.HttpRequest
类名称:HttpRequest
方法名:getParams
暂无
代码示例来源:origin: robovm/robovm
public void process(final HttpRequest request, final HttpContext context)
throws HttpException, IOException {
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
// Add default headers
Collection<?> defHeaders = (Collection<?>) request.getParams().getParameter(
ClientPNames.DEFAULT_HEADERS);
if (defHeaders != null) {
for (Object defHeader : defHeaders) {
request.addHeader((Header) defHeader);
}
}
}
代码示例来源:origin: robolectric/robolectric
target = (HttpHost) request.getParams().getParameter(
ClientPNames.DEFAULT_HOST);
代码示例来源:origin: robovm/robovm
public void process(final HttpRequest request, final HttpContext context)
throws HttpException, IOException {
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
if (!request.containsHeader(HTTP.USER_AGENT)) {
String useragent = HttpProtocolParams.getUserAgent(request.getParams());
if (useragent != null) {
request.addHeader(HTTP.USER_AGENT, useragent);
}
}
}
代码示例来源:origin: robovm/robovm
/**
* Obtains parameters for executing a request.
* The default implementation in this class creates a new
* {@link ClientParamsStack} from the request parameters
* and the client parameters.
* <br/>
* This method is called by the default implementation of
* {@link #execute(HttpHost,HttpRequest,HttpContext)}
* to obtain the parameters for the
* {@link DefaultRequestDirector}.
*
* @param req the request that will be executed
*
* @return the parameters to use
*/
protected HttpParams determineParams(HttpRequest req) {
return new ClientParamsStack
(null, getParams(), req.getParams(), null);
}
代码示例来源:origin: robovm/robovm
target = (HttpHost) request.getParams().getParameter(
ClientPNames.DEFAULT_HOST);
代码示例来源:origin: robovm/robovm
/**
* Produces basic authorization header for the given set of {@link Credentials}.
*
* @param credentials The set of credentials to be used for athentication
* @param request The request being authenticated
* @throws org.apache.http.auth.InvalidCredentialsException if authentication credentials
* are not valid or not applicable for this authentication scheme
* @throws AuthenticationException if authorization string cannot
* be generated due to an authentication failure
*
* @return a basic authorization string
*/
public Header authenticate(
final Credentials credentials,
final HttpRequest request) throws AuthenticationException {
if (credentials == null) {
throw new IllegalArgumentException("Credentials may not be null");
}
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
String charset = AuthParams.getCredentialCharset(request.getParams());
return authenticate(credentials, charset, isProxy());
}
代码示例来源:origin: robovm/robovm
public void process(final HttpRequest request, final HttpContext context)
throws HttpException, IOException {
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
if (request instanceof HttpEntityEnclosingRequest) {
HttpEntity entity = ((HttpEntityEnclosingRequest)request).getEntity();
// Do not send the expect header if request body is known to be empty
if (entity != null && entity.getContentLength() != 0) {
ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
if (HttpProtocolParams.useExpectContinue(request.getParams())
&& !ver.lessEquals(HttpVersion.HTTP_1_0)) {
request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
}
}
}
}
代码示例来源:origin: robovm/robovm
ConnRouteParams.getForcedRoute(request.getParams());
if (route != null)
return route;
ConnRouteParams.getLocalAddress(request.getParams());
final HttpHost proxy =
ConnRouteParams.getDefaultProxy(request.getParams());
代码示例来源:origin: robovm/robovm
public RequestWrapper(final HttpRequest request) throws ProtocolException {
super();
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
this.original = request;
setParams(request.getParams());
// Make a copy of the original URI
if (request instanceof HttpUriRequest) {
this.uri = ((HttpUriRequest) request).getURI();
this.method = ((HttpUriRequest) request).getMethod();
this.version = null;
} else {
RequestLine requestLine = request.getRequestLine();
try {
this.uri = new URI(requestLine.getUri());
} catch (URISyntaxException ex) {
throw new ProtocolException("Invalid request URI: "
+ requestLine.getUri(), ex);
}
this.method = requestLine.getMethod();
this.version = request.getProtocolVersion();
}
this.execCount = 0;
}
代码示例来源:origin: robovm/robovm
String charset = getParameter("charset");
if (charset == null) {
charset = AuthParams.getCredentialCharset(request.getParams());
getParameters().put("charset", charset);
代码示例来源:origin: robovm/robovm
ConnRouteParams.getForcedRoute(request.getParams());
if (route != null)
return route;
ConnRouteParams.getLocalAddress(request.getParams());
HttpHost proxy = (HttpHost) request.getParams().getParameter(ConnRoutePNames.DEFAULT_PROXY);
if (proxy == null) {
proxy = determineProxy(target, request, context);
代码示例来源:origin: robovm/robovm
String policy = HttpClientParams.getCookiePolicy(request.getParams());
if (this.log.isDebugEnabled()) {
this.log.debug("CookieSpec selected: " + policy);
CookieSpec cookieSpec = registry.getCookieSpec(policy, request.getParams());
代码示例来源:origin: robovm/robovm
int tms = request.getParams().getIntParameter(
CoreProtocolPNames.WAIT_FOR_CONTINUE, 2000);
代码示例来源:origin: robolectric/robolectric
HttpRoute origRoute = determineRoute(target, origWrapper, context);
virtualHost = (HttpHost) orig.getParams().getParameter(
ClientPNames.VIRTUAL_HOST);
代码示例来源:origin: apache/cloudstack
private String handlePingMethodCall(HttpRequest req) {
final String callingPeer = (String)req.getParams().getParameter("callingPeer");
if (s_logger.isDebugEnabled()) {
s_logger.debug("Handle ping request from " + callingPeer);
}
return "true";
}
}
代码示例来源:origin: apache/cloudstack
@SuppressWarnings("deprecation")
private void parseRequest(HttpRequest request) throws IOException {
if (request instanceof HttpEntityEnclosingRequest) {
final HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest)request;
final String body = EntityUtils.toString(entityRequest.getEntity());
if (body != null) {
final String[] paramArray = body.split("&");
if (paramArray != null) {
for (final String paramEntry : paramArray) {
final String[] paramValue = paramEntry.split("=");
if (paramValue.length != 2) {
continue;
}
final String name = URLDecoder.decode(paramValue[0]);
final String value = URLDecoder.decode(paramValue[1]);
if (s_logger.isTraceEnabled()) {
s_logger.trace("Parsed request parameter " + name + "=" + value);
}
request.getParams().setParameter(name, value);
}
}
}
}
}
代码示例来源:origin: robovm/robovm
new DefaultedHttpParams(request.getParams(), this.params));
代码示例来源:origin: apache/cloudstack
private String handleDeliverPduMethodCall(HttpRequest req) {
final String pduSeq = (String)req.getParams().getParameter("pduSeq");
final String pduAckSeq = (String)req.getParams().getParameter("pduAckSeq");
final String sourcePeer = (String)req.getParams().getParameter("sourcePeer");
final String destPeer = (String)req.getParams().getParameter("destPeer");
final String agentId = (String)req.getParams().getParameter("agentId");
final String gsonPackage = (String)req.getParams().getParameter("gsonPackage");
final String stopOnError = (String)req.getParams().getParameter("stopOnError");
final String pduType = (String)req.getParams().getParameter("pduType");
final ClusterServicePdu pdu = new ClusterServicePdu();
pdu.setSourcePeer(sourcePeer);
pdu.setDestPeer(destPeer);
pdu.setAgentId(Long.parseLong(agentId));
pdu.setSequenceId(Long.parseLong(pduSeq));
pdu.setAckSequenceId(Long.parseLong(pduAckSeq));
pdu.setJsonPackage(gsonPackage);
pdu.setStopOnError("1".equals(stopOnError));
pdu.setPduType(Integer.parseInt(pduType));
manager.OnReceiveClusterServicePdu(pdu);
return "true";
}
代码示例来源:origin: apache/cloudstack
protected void handleRequest(HttpRequest req, HttpResponse response) {
final String method = (String)req.getParams().getParameter("method");
代码示例来源:origin: MobiVM/robovm
public void process(final HttpRequest request, final HttpContext context)
throws HttpException, IOException {
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
if (!request.containsHeader(HTTP.USER_AGENT)) {
String useragent = HttpProtocolParams.getUserAgent(request.getParams());
if (useragent != null) {
request.addHeader(HTTP.USER_AGENT, useragent);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!