Interface Headers
-
- All Known Implementing Classes:
HeadersImpl
public interface Headers
WComponents can use this interface to communicate "global" or "shared" items to the server. Examples are lines in the html/head element. It also allows for extra attributes on the html element itself.It is important to note that "headlines" must be added in the preparePaint phase. Headlines adding in serviceRequest will be lost because the headers are reset at the start of preparePaint. Adding headlines in the paint phase is too late as the headers have already been written. Note also that it would be possible to make the adding of headlines work for the paint phase, but at the expense of requiring the entire body of the page to be cached.
- Since:
- 1.0.0
- Author:
- James Gifford, Martin Shevchenko
-
-
Field Summary
Fields Modifier and Type Field Description static String
CSS_HEADLINE
CSS headline.static String
JAVASCRIPT_HEADLINE
Javascript headline.static String
UNTYPED_HEADLINE
Untyped headline.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addHeadLine(String aLine)
Records a "shared" line for inclusion in the output.void
addHeadLine(String type, String aLine)
Records a "shared" line (of a specified type) for inclusion in the output.void
addUniqueHeadLine(String aLine)
Records a line for inclusion in the html/head, if it has not already been included.void
addUniqueHeadLine(String type, String aLine)
Records a "shared" line (of a specified type) for inclusion in the output, if it has not already been included.String
getContentType()
Get the content type (usually text/html).List
getHeadLines()
List
getHeadLines(String type)
Get the head lines, of a specified type.void
reset()
Called by the servlet between service requests.void
setContentType(String type)
Set the content type (usually text/html).
-
-
-
Field Detail
-
UNTYPED_HEADLINE
static final String UNTYPED_HEADLINE
Untyped headline.- See Also:
- Constant Field Values
-
JAVASCRIPT_HEADLINE
static final String JAVASCRIPT_HEADLINE
Javascript headline.- See Also:
- Constant Field Values
-
CSS_HEADLINE
static final String CSS_HEADLINE
CSS headline.- See Also:
- Constant Field Values
-
-
Method Detail
-
reset
void reset()
Called by the servlet between service requests.
-
addHeadLine
void addHeadLine(String aLine)
Records a "shared" line for inclusion in the output.- Parameters:
aLine
- the line to add.
-
addHeadLine
void addHeadLine(String type, String aLine)
Records a "shared" line (of a specified type) for inclusion in the output.- Parameters:
type
- the type of line to add.aLine
- the line to add.
-
addUniqueHeadLine
void addUniqueHeadLine(String aLine)
Records a line for inclusion in the html/head, if it has not already been included.- Parameters:
aLine
- the line to add.
-
addUniqueHeadLine
void addUniqueHeadLine(String type, String aLine)
Records a "shared" line (of a specified type) for inclusion in the output, if it has not already been included.An example of where this is useful is for adding shared JavaScript code.
- Parameters:
type
- the type of line to add.aLine
- the line to add.
-
getHeadLines
List getHeadLines()
- Returns:
- the "un-typed" head lines.
-
getHeadLines
List getHeadLines(String type)
Get the head lines, of a specified type.- Parameters:
type
- the type of headlines to return.- Returns:
- the head lines, of a specified type
-
getContentType
String getContentType()
Get the content type (usually text/html).- Returns:
- the content mime type.
-
setContentType
void setContentType(String type)
Set the content type (usually text/html).- Parameters:
type
- The content type to set on the response.
-
-