Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

on-line

Haupt Quellenprogramme E-B�cher Downloads Mit uns in Verbindung treten �ber uns

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting


Erzeugen der Server Response: HTTP Response Headers

Previous Next




Eine Antwort vom web server besteht normalerweise einer Statuslinie, einen oder mehrer Warte�berschriften, einer Leerzeile und aus dem Dokument. Die Einstellung der HTTP Warte�berschriften pa�t h�ufig Hand-in-Hand zur Einstellung die Status Codes in der Statuslinie. Z.B. haben mehrere �der Dokument verschobenen� Status Codes eine angeschlossene Position �berschrift, und die 401 (nicht autorisierter), das Code ein Begleiten einschlie�en mu�, WWW-Beglaubigen �berschrift.




�berblick

Die allgemeinste Weise, �berschriften zu spezifizieren ist durch setHeader Methode von HttpServletResponse, das zwei Zeichenketten nimmt: der �berschriftname und der �berschriftwert. Wie die Einstellung der Status Codes, mu� dieses getan werden, bevor jeder m�glicher Dokumentinhalt gesendet wird.

Es gibt auch zwei fachkundige Methoden, zum der �berschriften einzustellen, die Daten (setDateHeader) und Ganzzahlen (setIntHeader) enthalten. Das erste speichert dich M�he des �bersetzens eines Java Datums in den Millisekunden seit der Epoche (wie durch System.currentTimeMillis oder die getTime Methode zur�ckgegangen angewendet an einem Datumgegenstand) in eine GMT Zeitzeichenkette. Die Sekunde erspart dir die kleine Unannehmlichkeit des Umwandelns ein internes in eine Zeichenkette.

Anstatt, die �berschrift v�llig einstellend, kannst du eine neue �berschrift addieren, falls eine �berschrift mit diesem Namen bereits besteht. addHeader, addDateHeader und addIntHeader f�r dieses benutzen. Wenn sie wirklich zu dir ausmacht, ob eine spezifische �berschrift bereits eingestellt worden ist, containsHeader benutzen, um zu �berpr�fen.

Schlie�lich liefert HttpServletResponse auch eine Anzahl von Bequemlichkeitsmethoden f�r die spezifizierenden allgemeinen �berschriften.

  • Die setContentType Methode stellt Inhalt-Art �berschrift ein und wird von der Mehrheit einen servlets verwendet.

  • Die setContentLength Methode stellt die Inhalt-L�nge �berschrift ein, n�tzlich, wenn die Datenbanksuchroutine hartn�ckige (halten-lebendige) HTTP Anschl�sse st�tzt.

  • Die addCookie Methode stellt das Pl�tzchen ein (es gibt kein entsprechendes setCookie, da es normal ist, mehrfache Einstellen-Pl�tzchen Linien zu haben).

  • Und, wie im vorhergehenden Abschnitt besprochen, stellt die sendRedirect Methode Position �berschrift sowie die Einstellung des Status Codes bis 302 ein.




Allgemeine Warte�berschriften und ihre Bedeutung
Header Interpretation/Purpose
Allow What request methods (GET, POST, etc.) does the server support?
Content-Encoding

What method was used to encode the document? You need to decode it to get the type specified by the Content-Type header. Using gzip to compress the document can dramatically reduce download times for HTML files, but it is only supported by Netscape on Unix and IE 4 and 5 on Windows. On the other hand, gzipping HTML files can dramatically reduce download times, and Java's GZIPOutputStream makes it easy. So you should explicitly check if the browser supports this by looking at the Accept-Encoding header (i.e. via request.getHeader("Accept-Encoding")). That way, you can return gzipped pages to browser that know how to unzip them, but still return regular pages to other browsers.

Content-Length

How many bytes are being sent? This information is only needed if the browser is using a persistent (keep-alive) HTTP connection. If you want your servlet to take advantage of this when the browser supports it, your servlet should write the document into a ByteArrayOutputStream, look up its size when done, put that into the Content-Length field, then send the content via byteArrayStream.writeTo(response.getOutputStream()).

Content-Type

What is the MIME type of the following document? Default for servlets is text/plain, but they usually explicitly specify text/html. Setting this header is so common that there is a special method in HttpServletResponse for it: setContentType

Date

What is current time (in GMT)? Use the setDateHeader method to specify this header. That saves you the trouble of formatting the date string properly.

Expires

At what time should content be considered out of date and thus no longer cached?

Last-Modified

When was document last changed? Client can supply a date via an If-Modified-Since request header. This is treated as a conditional GET, with document only being returned if the Last-Modified date is later than the specified date. Otherwise a 304 (Not Modified) status line is returned. Again, use the setDateHeader method to specify this header.

Location

Where should client go to get document? This is usually set indirectly, along with a 302 status code, via the sendRedirect method of HttpServletResponse.

Refresh

How soon should browser ask for an updated page (in seconds)? Instead of just reloading current page, you can specify a specific page to load via setHeader("Refresh", "5; URL=http://host/path"). Note that this is commonly set via <META HTTP-EQUIV="Refresh" CONTENT="5; URL=http://host/path"> in the HEAD section of the HTML page, rather than as an explicit header from the server. This is because automatic reloading or forwarding is something often desired by HTML authors who do not have CGI or servlet access. But for servlets, setting the header directly is easier and clearer. Note that this header means "reload this page or go to the specified URL in N seconds." It does not mean "reload this page or go to the specified URL every N seconds." So you have to send a Refresh header each time, and sending a 204 (No Content) status code stops the browser from reloading further, regardless of whether you explicitly send the Refresh header or use <META HTTP-EQUIV="Refresh" ...>. Note that this header is not officially part of HTTP 1.1, but is an extension supported by both Netscape and Internet Explorer.

Server

What server am I? Servlets don't usually set this; the Web server itself does.

Set-Cookie

Specifies cookie associated with page. Servlets should not use response.setHeader("Set-Cookie", ...), but instead use the special-purpose addCookie method of HttpServletResponse. See separate section on handling cookies.

WWW-Authenticate

What authorization type and realm should client supply in their Authorization header? This header is required in responses that have a 401 (Unauthorized) status line. E.g. response.setHeader("WWW-Authenticate", "BASIC realm=\"executives\""). Note that servlets do not usually handle this themselves, but instead let password-protected Web pages be handled by the Web server's specialized mechanisms (e.g. .htaccess).





Previous Next

Keywords: Handling the Client Request:Form Data,asp net client,asp net data,vb net data,control data,data net,java client,data repeater


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizes
Oracle Quiz
MySQL Quiz
Operating System Quizes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizes
Testing Quiz
Firewalls Quiz
SAP Module Quizes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizes
Corba Quiz
Networking Quiz
Microsoft Office Quizes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizes
Financial Accounting Quiz
Managerial Accounting Quiz

Privacy Policy
Copyright � 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.