Class HeadersImpl

  • All Implemented Interfaces:
    Headers

    public class HeadersImpl
    extends Object
    implements Headers
    WServlet uses this to handle header information.
    Since:
    1.0.0
    Author:
    James Gifford
    • Constructor Detail

      • HeadersImpl

        public HeadersImpl()
    • Method Detail

      • reset

        public void reset()
        Clears the headers.
        Specified by:
        reset in interface Headers
      • addHeadLine

        public void addHeadLine​(String aLine)
        Records a "shared" line for inclusion in the output.
        Specified by:
        addHeadLine in interface Headers
        Parameters:
        aLine - the line to include.
      • addHeadLine

        public void addHeadLine​(String type,
                                String aLine)
        Records a "shared" line (of a specified type) for inclusion in the output.
        Specified by:
        addHeadLine in interface Headers
        Parameters:
        type - the type of line.
        aLine - the line to include.
      • addUniqueHeadLine

        public void addUniqueHeadLine​(String aLine)
        Records a line for inclusion in the html/head, if it has not already been included.
        Specified by:
        addUniqueHeadLine in interface Headers
        Parameters:
        aLine - the line to include.
      • addUniqueHeadLine

        public void addUniqueHeadLine​(String type,
                                      String aLine)
        Records a line for inclusion in the html/head, if it has not already been included.
        Specified by:
        addUniqueHeadLine in interface Headers
        Parameters:
        type - the type of line.
        aLine - the line to include.
      • getHeadLines

        public List<String> getHeadLines()
        Gets the "un-typed" head lines.
        Specified by:
        getHeadLines in interface Headers
        Returns:
        a list of headlines, or null if there are no headlines.
      • getHeadLines

        public List<String> getHeadLines​(String type)
        Gets the head lines, of a specified type.
        Specified by:
        getHeadLines in interface Headers
        Parameters:
        type - the type of lines to retrieve.
        Returns:
        a list of headlines, or null if there are no headlines of the given type.
      • getContentType

        public String getContentType()
        Description copied from interface: Headers
        Get the content type (usually text/html).
        Specified by:
        getContentType in interface Headers
        Returns:
        the content type for the response. The default type is text/html.
      • setContentType

        public void setContentType​(String type)
        Sets the content type for the response. The default type is text/html.
        Specified by:
        setContentType in interface Headers
        Parameters:
        type - The content type.