jodd.http.HttpRequest.<init>()方法的使用及代码示例

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

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

HttpRequest.<init>介绍

暂无

代码示例

代码示例来源:origin: oblac/jodd

/**
 * Generic request builder, usually used when method is a variable.
 * Otherwise, use one of the other static request builder methods.
 */
public static HttpRequest create(final String method, final String destination) {
  return new HttpRequest()
      .method(method.toUpperCase())
      .set(destination);
}

代码示例来源:origin: oblac/jodd

/**
 * Builds a DELETE request.
 */
public static HttpRequest delete(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.DELETE)
      .set(destination);
}
/**

代码示例来源:origin: oblac/jodd

/**
 * Builds a GET request.
 */
public static HttpRequest get(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.GET)
      .set(destination);
}
/**

代码示例来源:origin: oblac/jodd

/**
 * Builds an OPTIONS request.
 */
public static HttpRequest options(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.OPTIONS)
      .set(destination);
}

代码示例来源:origin: oblac/jodd

/**
 * Builds a CONNECT request.
 */
public static HttpRequest connect(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.CONNECT)
      .set(destination);
}
/**

代码示例来源:origin: oblac/jodd

/**
 * Builds a PUT request.
 */
public static HttpRequest put(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.PUT)
      .set(destination);
}
/**

代码示例来源:origin: oblac/jodd

/**
 * Builds a PATCH request.
 */
public static HttpRequest patch(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.PATCH)
      .set(destination);
}
/**

代码示例来源:origin: oblac/jodd

/**
 * Builds a HEAD request.
 */
public static HttpRequest head(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.HEAD)
      .set(destination);
}
/**

代码示例来源:origin: oblac/jodd

/**
 * Builds a POST request.
 */
public static HttpRequest post(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.POST)
      .set(destination);
}
/**

代码示例来源:origin: oblac/jodd

/**
 * Builds a TRACE request.
 */
public static HttpRequest trace(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.TRACE)
      .set(destination);
}
/**

代码示例来源:origin: oblac/jodd

public static HttpRequest readFrom(final InputStream in, final String encoding) {
  BufferedReader reader;
  try {
    reader = new BufferedReader(new InputStreamReader(in, encoding));
  } catch (UnsupportedEncodingException uneex) {
    return null;
  }
  final HttpRequest httpRequest = new HttpRequest();
  httpRequest.headers.clear();
  final String line;
  try {
    line = reader.readLine();
  } catch (IOException ioex) {
    throw new HttpException(ioex);
  }
  if (!StringUtil.isBlank(line)) {
    String[] s = StringUtil.splitc(line, ' ');
    httpRequest.method(s[0]);
    httpRequest.path(s[1]);
    httpRequest.httpVersion(s[2]);
    httpRequest.readHeaders(reader);
    httpRequest.readBody(reader);
  }
  return httpRequest;
}

代码示例来源:origin: oblac/jodd

@Test
void testFormParamsObjects() {
  Map<String, Object> params = new HashMap<>();
  params.put("state", 1);
  HttpRequest httpRequest = new HttpRequest();
  httpRequest.form(params);
  assertEquals(1, httpRequest.form().size());
}

代码示例来源:origin: oblac/jodd

@Test
void testBasicAuthorizationCanBeSetToNullAndIsIgnoredSilently() {
  HttpRequest httpRequest = new HttpRequest();
  String[][] input = new String[][]{
      {"non-null", null},
      {null, "non-null"},
      {null, null},
  };
  try {
    for(String[] pair :input) {
      httpRequest.basicAuthentication(pair[0], pair[1]);
      assertNull(httpRequest.headers.get("Authorization"));
    }
  } catch (RuntimeException e) {
    fail("No exception should be thrown for null authorization basic header args!");
  }
}

代码示例来源:origin: oblac/jodd

@Test
void testUrl() {
  HttpRequest httpRequest = new HttpRequest();
  httpRequest.set("GET http://jodd.org:173/index.html?light=true");
  assertEquals("http://jodd.org:173/index.html?light=true", httpRequest.url());
  assertEquals("http://jodd.org:173", httpRequest.hostUrl());
  httpRequest = HttpRequest.get("foo.com/");
  assertEquals("http://foo.com", httpRequest.hostUrl());
}

代码示例来源:origin: oblac/jodd

httpRequest = new HttpRequest()
    .method(originalMethod)
    .set(newPath);

代码示例来源:origin: oblac/jodd

@Test
void testSet() {
  HttpRequest httpRequest = new HttpRequest();
  httpRequest.set("GET http://jodd.org:173/index.html?light=true");
  httpRequest = new HttpRequest();
  httpRequest.set("http://jodd.org:173/index.html?light=true");
  httpRequest = new HttpRequest();
  httpRequest.set("jodd.org:173/index.html?light=true");
  httpRequest = new HttpRequest();
  httpRequest.set("jodd.org/index.html?light=true");
  httpRequest = new HttpRequest();
  httpRequest.set("/index.html?light=true");
  httpRequest = new HttpRequest();
  httpRequest.set("http://jodd.org");

代码示例来源:origin: oblac/jodd

@Test
void testQueryParameters() {
  HttpRequest httpRequest = new HttpRequest();

代码示例来源:origin: org.jodd/jodd-http

/**
 * Generic request builder, usually used when method is a variable.
 * Otherwise, use one of the other static request builder methods.
 */
public static HttpRequest create(final String method, final String destination) {
  return new HttpRequest()
      .method(method.toUpperCase())
      .set(destination);
}

代码示例来源:origin: org.jodd/jodd-http

/**
 * Builds a GET request.
 */
public static HttpRequest get(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.GET)
      .set(destination);
}
/**

代码示例来源:origin: org.jodd/jodd-http

/**
 * Builds a HEAD request.
 */
public static HttpRequest head(final String destination) {
  return new HttpRequest()
      .method(HttpMethod.HEAD)
      .set(destination);
}
/**

相关文章

微信公众号

最新文章

更多