com.primix.tapestry.engine
Class NullResponseWriter

java.lang.Object
  |
  +--com.primix.tapestry.engine.NullResponseWriter
All Implemented Interfaces:
IResponseWriter

public class NullResponseWriter
extends java.lang.Object
implements IResponseWriter

A IResponseWriter that does absolutely nothing; this is used during the rewind phase of the request cycle when output is discarded anyway.

Since:
0.2.9
Version:
$Id: NullResponseWriter.java,v 1.3 2001/05/02 14:15:15 hship Exp $
Author:
Howard Ship

Constructor Summary
NullResponseWriter()
           
 
Method Summary
 void attribute(java.lang.String name)
          Simply prints the attribute name.
 void attribute(java.lang.String name, int value)
          Writes an integer attribute into the currently open tag.
 void attribute(java.lang.String name, java.lang.String value)
          Writes an attribute into the most recently opened tag.
 void begin(java.lang.String name)
          Closes any existing tag then starts a new element.
 void beginEmpty(java.lang.String name)
          Starts an element that will not later be matched with an end() call.
 boolean checkError()
          Always returns false.
 void close()
          Closes this IResponseWriter.
 void closeTag()
          Closes the most recently opened element by writing the '>' that ends it.
 void comment(java.lang.String value)
          Writes an XML/HTML comment.
 void end()
          Ends the element most recently started by begin(String).
 void end(java.lang.String name)
          Ends the most recently started element with the given name.
 void flush()
          Forwards flush() to this IResponseWriter's PrintWriter.
 java.lang.String getContentType()
          Returns the type of content generated by this response writer, as a MIME type.
 IResponseWriter getNestedWriter()
          Returns this: since a NullResponseWriter doesn't actually do anything, one is as good as another!.
static IResponseWriter getSharedInstance()
           
 void print(char value)
          Prints a single character, or its equivalent entity.
 void print(char[] data, int offset, int length)
          The primary print() method, used by most other methods.
 void print(int value)
          Prints an integer.
 void print(java.lang.String value)
          Invokes print(char[], int, int) to print the string.
 void println()
          Closes the open tag (if any), then prints a line seperator to the output stream.
 void printRaw(char[] buffer, int offset, int length)
          Prints a portion of an output buffer to the stream.
 void printRaw(java.lang.String value)
          Prints output to the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullResponseWriter

public NullResponseWriter()
Method Detail

getSharedInstance

public static IResponseWriter getSharedInstance()

printRaw

public void printRaw(char[] buffer,
                     int offset,
                     int length)
Description copied from interface: IResponseWriter
Prints a portion of an output buffer to the stream. No escaping of invalid elements is done, which makes this more effecient than print(). Does nothing if buffer is null.

Closes any open tag.

Specified by:
printRaw in interface IResponseWriter

printRaw

public void printRaw(java.lang.String value)
Description copied from interface: IResponseWriter
Prints output to the stream. No escaping of invalid elements is done, which makes this more effecient than print().

Does nothing if value is null.

Closes any open tag.

Specified by:
printRaw in interface IResponseWriter

println

public void println()
Description copied from interface: IResponseWriter
Closes the open tag (if any), then prints a line seperator to the output stream.
Specified by:
println in interface IResponseWriter

print

public void print(char[] data,
                  int offset,
                  int length)
Description copied from interface: IResponseWriter
The primary print() method, used by most other methods.

Prints the character array, first closing any open tag. Problematic characters ('<', '>' and '&') are converted to appropriate entities.

Does nothing if data is null.

Closes any open tag.

Specified by:
print in interface IResponseWriter

print

public void print(char value)
Description copied from interface: IResponseWriter
Prints a single character, or its equivalent entity.

Closes any open tag.

Specified by:
print in interface IResponseWriter

print

public void print(int value)
Description copied from interface: IResponseWriter
Prints an integer.

Closes any open tag.

Specified by:
print in interface IResponseWriter

print

public void print(java.lang.String value)
Description copied from interface: IResponseWriter
Invokes IResponseWriter.print(char[], int, int) to print the string. Use IResponseWriter.printRaw(String) if the character data is known to be safe.

Does nothing if value is null.

Closes any open tag.

Specified by:
print in interface IResponseWriter
Following copied from interface: com.primix.tapestry.IResponseWriter
See Also:
IResponseWriter.print(char[], int, int)

getNestedWriter

public IResponseWriter getNestedWriter()
Returns this: since a NullResponseWriter doesn't actually do anything, one is as good as another!.
Specified by:
getNestedWriter in interface IResponseWriter

getContentType

public java.lang.String getContentType()
Description copied from interface: IResponseWriter
Returns the type of content generated by this response writer, as a MIME type.
Specified by:
getContentType in interface IResponseWriter

flush

public void flush()
Description copied from interface: IResponseWriter
Forwards flush() to this IResponseWriter's PrintWriter.
Specified by:
flush in interface IResponseWriter

end

public void end()
Description copied from interface: IResponseWriter
Ends the element most recently started by IResponseWriter.begin(String). * The name of the tag * is popped off of the active element stack and used to form an HTML close tag.
Specified by:
end in interface IResponseWriter

end

public void end(java.lang.String name)
Description copied from interface: IResponseWriter
Ends the most recently started element with the given name. This will also end any other intermediate elements. This is very useful for easily ending a table or even an entire page.
Specified by:
end in interface IResponseWriter

comment

public void comment(java.lang.String value)
Description copied from interface: IResponseWriter
Writes an XML/HTML comment. Any open tag is first closed. The comment is indented as if it were an HTML tag. The method takes care of providing the <!-- and -->, and provides a blank line after the close of the comment.

Most characters are valid inside a comment, so no check of the contents is made (much like IResponseWriter.printRaw(String).

Specified by:
comment in interface IResponseWriter

closeTag

public void closeTag()
Description copied from interface: IResponseWriter
Closes the most recently opened element by writing the '>' that ends it. Once this is invoked, the attribute() methods may not be used until a new element is opened with IResponseWriter.begin(String) or or IResponseWriter.beginEmpty(String).
Specified by:
closeTag in interface IResponseWriter

close

public void close()
Description copied from interface: IResponseWriter
Closes this IResponseWriter. Close tags are written for any active elements. The PrintWriter is then sent close(). A nested writer will commit its buffer to its containing writer.
Specified by:
close in interface IResponseWriter

checkError

public boolean checkError()
Always returns false.
Specified by:
checkError in interface IResponseWriter

beginEmpty

public void beginEmpty(java.lang.String name)
Description copied from interface: IResponseWriter
Starts an element that will not later be matched with an end() call. This is useful for elements that do not need closing tags.
Specified by:
beginEmpty in interface IResponseWriter

begin

public void begin(java.lang.String name)
Description copied from interface: IResponseWriter
Closes any existing tag then starts a new element. The new element is pushed onto the active element stack.
Specified by:
begin in interface IResponseWriter

attribute

public void attribute(java.lang.String name)
Description copied from interface: IResponseWriter
Simply prints the attribute name. This is used for idempotent attributes, such as 'disabled' in an <input>.
Specified by:
attribute in interface IResponseWriter
Following copied from interface: com.primix.tapestry.IResponseWriter
Throws:
java.lang.IllegalStateException - if there is no open tag.

attribute

public void attribute(java.lang.String name,
                      int value)
Description copied from interface: IResponseWriter
Writes an integer attribute into the currently open tag.
Specified by:
attribute in interface IResponseWriter
Following copied from interface: com.primix.tapestry.IResponseWriter
Throws:
java.lang.IllegalStateException - if there is no open tag.

attribute

public void attribute(java.lang.String name,
                      java.lang.String value)
Description copied from interface: IResponseWriter
Writes an attribute into the most recently opened tag. This must be called after IResponseWriter.begin(String) and before any other kind of writing (which closes the tag).

The value may be null, in which case this method behaves the same as IResponseWriter.attribute(String).

Specified by:
attribute in interface IResponseWriter
Following copied from interface: com.primix.tapestry.IResponseWriter
Throws:
java.lang.IllegalStateException - if there is no open tag.