2.17.2: 2011-06-17

net.sf.basedb.clients.web.util
Class AjaxWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by net.sf.basedb.clients.web.util.AjaxWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

Deprecated. In 2.17, we recommend using JSON for AJAX responses. Use classes from the org.json.simple.* package. See http://code.google.com/p/json-simple/ for more information and documentation.

@Deprecated
public class AjaxWriter
extends PrintWriter

Wraps a writer stream and provides methods for easier writing of Ajax response. The writer can be configured with setNullValue(String) (default is an empty string) and setRecordSeparator(String) (default is an empty string). Use ajaxPrintEntry(String, Object) to print a singe line with data and ajaxEndRecord() to end the current record and start a new one.

Version:
2.12
Author:
Nicklas
Last modified
$Date: 2011-01-27 14:57:28 +0100 (Thu, 27 Jan 2011) $

Field Summary
private  Pattern n
          Deprecated.  
private  String nullValue
          Deprecated.  
private  Pattern r
          Deprecated.  
private  String recordSeparator
          Deprecated.  
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
AjaxWriter(Writer out)
          Deprecated. Create a new ajax writer that is writing it's output to the given writer.
 
Method Summary
 void ajaxEndRecord()
          Deprecated. End the current record by printing the record separator string on a line by its own.
 String ajaxEscape(String in)
          Deprecated. Escape new line and carrige return characters in the input to the literal string '\n' and '\r' in the output.
 void ajaxPrintEntry(String key, Object value)
          Deprecated. Print a record entry.
 String getNullValue()
          Deprecated. The null value string is written to the output instead of null data values.
 String getRecordSeparator()
          Deprecated. The record separator is written to the output on a single line between each record.
 void setNullValue(String nullValue)
          Deprecated. Change the null value string.
 void setRecordSeparator(String recordSeparator)
          Deprecated. Change the record separator string.
 
Methods inherited from class java.io.PrintWriter
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nullValue

private String nullValue
Deprecated. 

recordSeparator

private String recordSeparator
Deprecated. 

r

private Pattern r
Deprecated. 

n

private Pattern n
Deprecated. 
Constructor Detail

AjaxWriter

public AjaxWriter(Writer out)
Deprecated. 
Create a new ajax writer that is writing it's output to the given writer.

Parameters:
out - The writer to write the data to
Method Detail

getNullValue

public String getNullValue()
Deprecated. 
The null value string is written to the output instead of null data values. The default value is an empty string.

Returns:
The current value of the null value string

setNullValue

public void setNullValue(String nullValue)
Deprecated. 
Change the null value string.

Parameters:
nullValue - The new null value string

getRecordSeparator

public String getRecordSeparator()
Deprecated. 
The record separator is written to the output on a single line between each record. The default value is an empty string.

Returns:
The current value of the record separator

setRecordSeparator

public void setRecordSeparator(String recordSeparator)
Deprecated. 
Change the record separator string.

Parameters:
recordSeparator - The new record separator

ajaxPrintEntry

public void ajaxPrintEntry(String key,
                           Object value)
Deprecated. 
Print a record entry. Line breaks (\n) and carriage returns (\r) in the value are converted to the literal string values '\n' and '\r'.

Parameters:
key - The entry key
value - The value, if null the configured null value is used, otherwise the toString() method is called

ajaxEndRecord

public void ajaxEndRecord()
Deprecated. 
End the current record by printing the record separator string on a line by its own. The default is to print an empty line.


ajaxEscape

public String ajaxEscape(String in)
Deprecated. 
Escape new line and carrige return characters in the input to the literal string '\n' and '\r' in the output.

Parameters:
in - The input string

2.17.2: 2011-06-17