Esri Geoportal Server
1.2.9

com.esri.gpt.server.usage.common
Class JSONWriter

java.lang.Object
  extended by com.esri.gpt.control.rest.writer.ResponseWriter
      extended by com.esri.gpt.control.rest.writer.ResultSetWriter
          extended by com.esri.gpt.control.rest.writer.JsonResultSetWriter
              extended by com.esri.gpt.server.usage.common.JSONWriter
All Implemented Interfaces:
IStatisticsWriter

public class JSONWriter
extends JsonResultSetWriter
implements IStatisticsWriter

This is class is used to write json response.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.esri.gpt.control.rest.writer.ResultSetWriter
ResultSetWriter.RecordElement
 
Field Summary
 
Fields inherited from class com.esri.gpt.control.rest.writer.ResponseWriter
DEFAULT_NEWLINE, DEFAULT_TAB
 
Constructor Summary
JSONWriter(Writer underlyingWriter, StringBuilder sb)
           
 
Method Summary
 void writeElement(String name, String value)
          Serializes key value pair to json object.
 void writeElement(String key, String value, boolean hasMore, boolean isNumber)
          Serializes key value pair to json object.
 void writeResultSet(String tableName, ResultSet rs, String[] columnTags)
          This method is used to serialize resultset rows as json.
 
Methods inherited from class com.esri.gpt.control.rest.writer.JsonResultSetWriter
endRow, endRows, getContentType, startRow, startRows, writeCell
 
Methods inherited from class com.esri.gpt.control.rest.writer.ResultSetWriter
writeResultSet, writeResultSetElement
 
Methods inherited from class com.esri.gpt.control.rest.writer.ResponseWriter
begin, close, flush, getNewline, getTab, getUnderlyingWriter, makeTabs, setNewline, setTab, setUnderlyingWriter, wasWrittenTo, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONWriter

public JSONWriter(Writer underlyingWriter,
                  StringBuilder sb)
Method Detail

writeElement

public void writeElement(String key,
                         String value,
                         boolean hasMore,
                         boolean isNumber)
Serializes key value pair to json object.

Specified by:
writeElement in interface IStatisticsWriter
Parameters:
key - the key
value - the value
hasMore - true if has more elements in an JSON array
isNumber - true if value is number.

writeElement

public void writeElement(String name,
                         String value)
                  throws Exception
Serializes key value pair to json object.

Specified by:
writeElement in interface IStatisticsWriter
Parameters:
name - the name
value - the value
Throws:
Exception - if writing element fails

writeResultSet

public void writeResultSet(String tableName,
                           ResultSet rs,
                           String[] columnTags)
                    throws Exception
This method is used to serialize resultset rows as json.

Specified by:
writeResultSet in interface IStatisticsWriter
Parameters:
tableName - the tableName for which rows are serialized
rs - the resultset
columnTags - the column names
Throws:
Exception - if writing element fails

Esri Geoportal Server
1.2.9

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