我创建了一个普通的 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”消失了?
如何垂直对齐块内的文本?如果不制动左侧具有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)
该图像显示了我所拥有的以及我正在努力实现的目标。

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