小编Ser*_*Pie的帖子

Java - HttpURLConnection - 内容长度未显示在请求标头中

我创建了一个普通的 HttpURLConnection 对象。例如,我设置了 3 个请求标头。

HttpURLConnection conn = (HttpURLConnection) someURL.openConnection();
conn.setDoInput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("User-Agent", "some_agent");
conn.setRequestProperty("Content-Type", "some_content-type");
conn.setRequestProperty("Content-Length", "some_content-length");
Run Code Online (Sandbox Code Playgroud)

我查看设置的请求标头。

System.out.println(conn.getRequestProperties());
Run Code Online (Sandbox Code Playgroud)

标头“Content-Length”永远不会包含在结果中。

{User-Agent=[some_agent], Content-Type=[some_content-type]}
Run Code Online (Sandbox Code Playgroud)

null如果我打电话,我也会得到 conn.getRequestProperty("Content-Length")

代码工作正常,但为什么“Content-Length”消失了?

java post httprequest

5
推荐指数
1
解决办法
5964
查看次数

形状外部和垂直对齐的文本

如何垂直对齐块内的文本?如果不制动左侧具有shape-outside属性的元素,我就无法做到这一点。

.a {
  width: 150px;
  height: 300px;
  background-color: yellow;
}

.b {
  float: left;
  -webkit-shape-outside: polygon(0% 50%, 100% 0%, 0% 0%, 0% 100%, 100% 100%);
  -webkit-clip-path: polygon(0% 50%, 100% 0%, 0% 0%, 0% 100%, 100% 100%);
  width: 100%;
  height: 100%;
  background-color: black;
}

.c {
  font-family: Arial;
  font-size: 16px;
  text-align: right;
}
Run Code Online (Sandbox Code Playgroud)
<div class="a">
  <div class="b"></div>
  <div class="c">text text text text text text text text text text text text text text text text text text</div>
</div>
Run Code Online (Sandbox Code Playgroud)

该图像显示了我所拥有的以及我正在努力实现的目标。

例子

父元素的高度和文本的长度不固定。

css webkit polygon vertical-alignment css-shapes

5
推荐指数
1
解决办法
836
查看次数