简体   繁体   English

HttpServletResponse如何通过浏览器进行处理

[英]how HttpServletResponse process by browser

In a servlet application web server forwards a HttpServletResponse to the browser right? 在servlet应用程序中,Web服务器将HttpServletResponse转发到浏览器吗? Then browser will render it and show the html. 然后浏览器将呈现它并显示html。

But What is the exact type of the Response object browser expected? 但是预期的Response对象浏览器的确切类型是什么? Is it HttpResponse? 是HttpResponse吗? Then how come different type of object getting process? 那么不同类型的对象如何获得过程呢?

I am bit confuse of the HttpServletResponse in the browser. 我在浏览器中有点混淆了HttpServletResponse。 Can please elaborate and explain it? 请详细解释一下吗?

What is the exact type of the Response object browser expected? 预期的Response对象浏览器的确切类型是什么?

A byte stream conforming to the HTTP 1.0 or 1.1 protocol for responses. 符合HTTP 1.0或1.1协议的字节流,用于响应。

Is it HttpResponse? 是HttpResponse吗?

No, it is a byte stream conforming to the HTTP 1.0 or 1.1 protocol for responses. 不,它是符合HTTP 1.0或1.1协议的字节流,用于响应。

Then how come different type of object getting process? 那么不同类型的对象如何获得过程呢?

This sentence does not parse. 这句话不解析。 Try again. 再试一次。

HttpRequest is a http element which is used to transfer data from client to server. HttpRequest是一个http元素,用于将数据从客户端传输到服务器。 HttpResponse is http element which is used to transfer data from server to client. HttpResponse是http元素,用于将数据从服务器传输到客户端。

The response is basically sent inside a HttpResponse. 响应基本上是在HttpResponse中发送的。 HttpResponse is sent as binary data through network channels. HttpResponse通过网络通道作为二进制数据发送。

HttpResponse object has the followings; HttpResponse对象具有以下内容;

  • Protocol/Version, Status Code, and its Description 协议/版本,状态代码及其描述
  • HTTP Response Headers HTTP响应标头
  • HTTP Response Body HTTP响应正文

I think, you are asking how different type of objects such as images, audios or videos are sent and interpreted by browsers. 我想,你问的是浏览器如何发送和解释不同类型的对象,如图像,音频或视频。 Browsers understands the file types by mime types inside http response headers, then interpret its content. 浏览器通过http响应头内的mime类型了解文件类型,然后解释其内容。

See also 也可以看看

MIME Types MIME类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM