Managing HTTP Response Header Lines
This chapter provides tutorial notes and example codes on HTTP response header lines. Topics include what is an HTTP response; what are response header line; controlling response header lines; viewing entire HTTP response message; 'page contentType' directive element; response object methods to change header lines; returning non-HTML response body; returning attachments for downloads.
These sections are omitted from this Web preview version. To view the full content,
see information on how to obtain the full version this book.
What Is HTTP Response
HTTP Response Header Lines
Controlling Response Header Lines
Viewing Response Header Lines
Response Header Lines of Static Files
Response Header Lines Controlled by "page" Directive
Response Header Lines Controlled by response Object
Accessing File System from JSP Pages
Returning non-HTML Response Body
Returning Attachments for Web Download
- HTTP response contains header lines and a body. A full empty line is required to separate header lines and the body.
- The most important response header lines are Content-Type and Content-Length.
- "page contentType" directive elements can be used to set the Content-Type header line.
- response.setContentType() and response.setContentLength()
can be used to set Content-Type and Content-Length header lines.
- response.addheader() and addHeader() can be used to set any types of header lines.
- Value of Content-Length header line must match the number of bytes in the response body.
- "Content-disposition" header line can be used to attachment as Web downloads.
Table of Contents
About This Book
JSP (JavaServer Pages) Overview
Tomcat Installation on Windows Systems
JSP Scripting Elements
Java Servlet Introduction
JSP Implicit Objects
Syntax of JSP Pages and JSP Documents
JSP Application Session
Managing Cookies in JSP Pages
JavaBean Objects and "useBean" Action Elements
►Managing HTTP Response Header Lines
Non-ASCII Characters Support in JSP Pages
Performance of JSP Pages
EL (Expression Language)
Overview of JSTL (JSP Standard Tag Libraries)
JSTL Core Library
JSP Custom Tags
JSP Java Tag Interface
Custom Tag Attributes
Multiple Tags Working Together
File Upload Test Application
Full Version in PDF/EPUB