1- setContentType():
Is used to specify MIME type of response. Content type is also known as MIME (Multipurpose internet mail extension) type. It is a HTTP header that provides the description about what are you sending to the browser.
public void setContentType(String MIMEType);
Is used to specify MIME type of response. Content type is also known as MIME (Multipurpose internet mail extension) type. It is a HTTP header that provides the description about what are you sending to the browser.
public void setContentType(String MIMEType);
MIME type
has 2 part:
Major part represent type of content and miner part specify the format of content.
Major part represent type of content and miner part specify the format of content.
Commonly used MIME types (content
types) are:
text/html
|
image/gif
|
audio/mp3
|
application/pdf
|
text/xml
|
image/jpg
|
audio/wav
|
application/msword
|
text/plain
|
image/bmp
|
application/vnd.ms-excel
|
|
application/jar
|
2- getWriter():
Is used to obtain PrintWriter Object for writing data to the response Object.
public PrintWriter getWriter();
Is used to obtain PrintWriter Object for writing data to the response Object.
public PrintWriter getWriter();
3- getOutputStream():
Is used to obtain an OutputStream object for writing data to the response Object.
public OutputStream getOutputStream();
Is used to obtain an OutputStream object for writing data to the response Object.
public OutputStream getOutputStream();
Note:
Only one
of the stream (PrintWriter/OutputStream) can be open in a Servlet for
generating response.
getWriter Character Oriented For HTML content
getOutputStream byte oriented For File downloading program
|
No comments:
Post a Comment