restgroupsServer
Class ProfileResourceReturnRepresentation

java.lang.Object
  extended by org.restlet.representation.Variant
      extended by org.restlet.representation.RepresentationInfo
          extended by org.restlet.representation.Representation
              extended by org.restlet.representation.StreamRepresentation
                  extended by org.restlet.representation.OutputRepresentation
                      extended by restgroupsServer.ProfileResourceReturnRepresentation

public class ProfileResourceReturnRepresentation
extends org.restlet.representation.OutputRepresentation

Instances of this class is returned by the GET ( ProfileResource.createProfile(org.restlet.representation.Representation) ) method. Customization of the OutputRepresentation is necessary for detecting clients disconnection. It is because RESTlet framework does not provide a way of determining the state of the HTTP connection yet.

Author:
tkob

Field Summary
 
Fields inherited from class org.restlet.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
ProfileResourceReturnRepresentation(org.restlet.data.MediaType mediaType, java.util.concurrent.ConcurrentMap<java.lang.String,ProfileEntity> profileEntities, java.util.concurrent.ConcurrentMap<java.lang.Long,ProfileEntity> profileEntitiesThreadIDs)
          Constructor.
ProfileResourceReturnRepresentation(org.restlet.data.MediaType mediaType, long expectedSize, java.util.concurrent.ConcurrentMap<java.lang.String,ProfileEntity> profileEntities, java.util.concurrent.ConcurrentMap<java.lang.Long,ProfileEntity> profileEntitiesThreadIDs)
          Constructor.
 
Method Summary
 void finishWriting()
          Sets the quitting flag to true
 void write(java.io.OutputStream arg0)
          Writes every second a byte to the output stream.
 
Methods inherited from class org.restlet.representation.OutputRepresentation
getStream, release
 
Methods inherited from class org.restlet.representation.StreamRepresentation
getChannel, getReader, write, write
 
Methods inherited from class org.restlet.representation.Representation
checkDigest, checkDigest, computeDigest, createEmpty, exhaust, getAvailableSize, getDigest, getDigester, getDigester, getDownloadName, getExpirationDate, getRange, getSize, getText, isAvailable, isDownloadable, isTransient, setAvailable, setDigest, setDownloadable, setDownloadName, setExpirationDate, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.representation.Variant
createClientInfo, equals, getCharacterSet, getEncodings, getIdentifier, getLanguages, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setIdentifier, setIdentifier, setLanguages, setMediaType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProfileResourceReturnRepresentation

public ProfileResourceReturnRepresentation(org.restlet.data.MediaType mediaType,
                                           java.util.concurrent.ConcurrentMap<java.lang.String,ProfileEntity> profileEntities,
                                           java.util.concurrent.ConcurrentMap<java.lang.Long,ProfileEntity> profileEntitiesThreadIDs)
Constructor.

Parameters:
mediaType - media type
profileEntities - map containing ProfileEntity objects for all active clients
profileEntitiesThreadIDs - map containing ProfileEntity objects for all active clients indexed by ID of threads where the ProfileResource.createProfile(org.restlet.representation.Representation) is handled.

ProfileResourceReturnRepresentation

public ProfileResourceReturnRepresentation(org.restlet.data.MediaType mediaType,
                                           long expectedSize,
                                           java.util.concurrent.ConcurrentMap<java.lang.String,ProfileEntity> profileEntities,
                                           java.util.concurrent.ConcurrentMap<java.lang.Long,ProfileEntity> profileEntitiesThreadIDs)
Constructor.

Parameters:
mediaType - media type
expectedSize - expected size
profileEntities - map containing ProfileEntity objects for all active
profileEntitiesThreadIDs - map containing ProfileEntity objects for all active clients indexed by ID of threads where the ProfileResource.createProfile(org.restlet.representation.Representation) is handled.
Method Detail

finishWriting

public void finishWriting()
Sets the quitting flag to true


write

public void write(java.io.OutputStream arg0)
           throws java.io.IOException
Writes every second a byte to the output stream. If the client breaks the connection, the IOException is thrown. This allows detecting clients disconnection.

Specified by:
write in class org.restlet.representation.Representation
Throws:
java.io.IOException