Esri Geoportal Server
1.0

com.esri.gpt.control.rest.writer
Class ResponseWriter

java.lang.Object
  extended by com.esri.gpt.control.rest.writer.ResponseWriter
Direct Known Subclasses:
ResultSetWriter

public abstract class ResponseWriter
extends Object

Super-class for a rest based response writer.


Field Summary
static String DEFAULT_NEWLINE
          The default newline string = "\r\n"
static String DEFAULT_TAB
          The default tab string = " " (2 spaces)
 
Constructor Summary
ResponseWriter(Writer underlyingWriter)
          Constructs with an underlying response writer.
 
Method Summary
 void begin(HttpServletResponse response)
          Begins the response.
 void close()
          Closes the underlying writer.
 void flush()
          Flushes the underlying writer.
abstract  String getContentType()
          Gets the response content type.
 String getNewline()
          Gets the newline string.
 String getTab()
          Gets the tab string.
 Writer getUnderlyingWriter()
          Gets the underlying writer associated with the response.
 String makeTabs(int depth)
          Makes a tab string for a supplied index depth.
 void setNewline(String newline)
          Sets the newline string.
 void setTab(String tab)
          Sets the tab string.
protected  void setUnderlyingWriter(Writer underlyingWriter)
          Sets the underlying writer associated with the response.
 boolean wasWrittenTo()
          Flag indicating if the response has been written to.
 void write(String value)
          Writes a string to the underlying writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NEWLINE

public static final String DEFAULT_NEWLINE
The default newline string = "\r\n"

See Also:
Constant Field Values

DEFAULT_TAB

public static final String DEFAULT_TAB
The default tab string = " " (2 spaces)

See Also:
Constant Field Values
Constructor Detail

ResponseWriter

public ResponseWriter(Writer underlyingWriter)
Constructs with an underlying response writer.

Parameters:
underlyingWriter - the underlying writer
Method Detail

getContentType

public abstract String getContentType()
Gets the response content type.

Returns:
the response content type

getNewline

public String getNewline()
Gets the newline string.

Returns:
the newline string

setNewline

public void setNewline(String newline)
Sets the newline string.

Parameters:
newline - the newline string

getTab

public String getTab()
Gets the tab string.

Returns:
the tab string

setTab

public void setTab(String tab)
Sets the tab string.

Parameters:
tab - the tab string

getUnderlyingWriter

public Writer getUnderlyingWriter()
Gets the underlying writer associated with the response.
The underlying writer is typically the PrintWriter associated with the HttpServletResponse.

Returns:
the underlying writer

setUnderlyingWriter

protected void setUnderlyingWriter(Writer underlyingWriter)
Sets the underlying writer associated with the response.
The underlying writer is typically the PrintWriter associated with the HttpServletResponse.

Parameters:
underlyingWriter - the underlying writer

wasWrittenTo

public boolean wasWrittenTo()
Flag indicating if the response has been written to.

Returns:
if the response was written to

begin

public void begin(HttpServletResponse response)
           throws IOException
Begins the response.

Parameters:
response - HTTP response
Throws:
IOException - if an I/O exception occurs

close

public void close()
           throws IOException
Closes the underlying writer.

Throws:
IOException - if an I/O exception occurs

flush

public void flush()
           throws IOException
Flushes the underlying writer.

Throws:
IOException - if an I/O exception occurs

makeTabs

public String makeTabs(int depth)
Makes a tab string for a supplied index depth.

Parameters:
depth - the indent depth
Returns:
the tab string

write

public void write(String value)
           throws IOException
Writes a string to the underlying writer.

Parameters:
value - the string to write
Throws:
IOException - if an I/O exception occurs

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.