com.github.kevinsawicki.http.HttpRequest.code()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中com.github.kevinsawicki.http.HttpRequest.code()方法的一些代码示例,展示了HttpRequest.code()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.code()方法的具体详情如下:
包路径:com.github.kevinsawicki.http.HttpRequest
类名称:HttpRequest
方法名:code

HttpRequest.code介绍

[英]Get the status code of the response
[中]获取响应的状态代码

代码示例

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Is the response code a 201 Created?
 *
 * @return true if 201, false otherwise
 * @throws HttpRequestException
 */
public boolean created() throws HttpRequestException {
 return HTTP_CREATED == code();
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Is the response code a 200 OK?
 *
 * @return true if 200, false otherwise
 * @throws HttpRequestException
 */
public boolean ok() throws HttpRequestException {
  return HTTP_OK == code();
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Is the response code a 404 Not Found?
 *
 * @return true if 404, false otherwise
 * @throws HttpRequestException
 */
public boolean notFound() throws HttpRequestException {
  return HTTP_NOT_FOUND == code();
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Is the response code a 500 Internal Server Error?
 *
 * @return true if 500, false otherwise
 * @throws HttpRequestException
 */
public boolean serverError() throws HttpRequestException {
  return HTTP_INTERNAL_ERROR == code();
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Is the response code a 400 Bad Request?
 *
 * @return true if 400, false otherwise
 * @throws HttpRequestException
 */
public boolean badRequest() throws HttpRequestException {
 return HTTP_BAD_REQUEST == code();
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Is the response code a 304 Not Modified?
 *
 * @return true if 304, false otherwise
 * @throws HttpRequestException
 */
public boolean notModified() throws HttpRequestException {
 return HTTP_NOT_MODIFIED == code();
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Is the response code a 200 OK?
 *
 * @return true if 200, false otherwise
 * @throws HttpRequestException
 */
public boolean ok() throws HttpRequestException {
  return HTTP_OK == code();
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Is the response code a 204 No Content?
 *
 * @return true if 204, false otherwise
 * @throws HttpRequestException
 */
public boolean noContent() throws HttpRequestException {
  return HTTP_NO_CONTENT == code();
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Is the response code a 201 Created?
 *
 * @return true if 201, false otherwise
 * @throws HttpRequestException
 */
public boolean created() throws HttpRequestException {
 return HTTP_CREATED == code();
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Is the response code a 500 Internal Server Error?
 *
 * @return true if 500, false otherwise
 * @throws HttpRequestException
 */
public boolean serverError() throws HttpRequestException {
  return HTTP_INTERNAL_ERROR == code();
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Is the response code a 500 Internal Server Error?
 *
 * @return true if 500, false otherwise
 * @throws HttpRequestException
 */
public boolean serverError() throws HttpRequestException {
 return HTTP_INTERNAL_ERROR == code();
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Is the response code a 201 Created?
 *
 * @return true if 201, false otherwise
 * @throws HttpRequestException
 */
public boolean created() throws HttpRequestException {
  return HTTP_CREATED == code();
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Is the response code a 400 Bad Request?
 *
 * @return true if 400, false otherwise
 * @throws HttpRequestException
 */
public boolean badRequest() throws HttpRequestException {
  return HTTP_BAD_REQUEST == code();
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Is the response code a 304 Not Modified?
 *
 * @return true if 304, false otherwise
 * @throws HttpRequestException
 */
public boolean notModified() throws HttpRequestException {
  return HTTP_NOT_MODIFIED == code();
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Is the response code a 404 Not Found?
 *
 * @return true if 404, false otherwise
 * @throws HttpRequestException
 */
public boolean notFound() throws HttpRequestException {
 return HTTP_NOT_FOUND == code();
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Is the response code a 200 OK?
 *
 * @return true if 200, false otherwise
 * @throws HttpRequestException
 */
public boolean ok() throws HttpRequestException {
 return HTTP_OK == code();
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Is the response code a 400 Bad Request?
 *
 * @return true if 400, false otherwise
 * @throws HttpRequestException
 */
public boolean badRequest() throws HttpRequestException {
 return HTTP_BAD_REQUEST == code();
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Set the value of the given {@link AtomicInteger} to the status code of the
 * response
 *
 * @param output
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest code(final AtomicInteger output)
  throws HttpRequestException {
 output.set(code());
 return this;
}

代码示例来源:origin: stackoverflow.com

HttpRequest req = HttpRequest.get("https://google.com");
req.trustAllCerts();
req.trustAllHosts(); //If you are having certificate problems
int code = req.code();
String body = req.body();
Log.d("CODE:", String.valueOf(code));
Log.d("BODY:", body);

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

public ResponseImpl( HttpRequest request ) {
 body = request.body();
 contentType = request.contentType();
 headers = request.headers();
 code = request.code();
 url = request.getConnection().getURL().toString();
 request.disconnect();
}

相关文章

微信公众号

最新文章

更多

HttpRequest类方法