Class JsonpRepresentation


  • public class JsonpRepresentation
    extends org.restlet.representation.WriterRepresentation
    Wrappers that adds a JSONP header and footer to JSON representations. The goal is to make them accessible to web browser without restriction from single origin policies.
    Author:
    Mark Kharitonov, Jerome Louvel
    • Field Summary

      • Fields inherited from class org.restlet.representation.Representation

        UNKNOWN_SIZE
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonpRepresentation​(java.lang.String callback, org.restlet.data.Status status, org.restlet.representation.Representation wrappedRepresentation)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCallback()
      Returns the name of the JavaScript callback method.
      long getSize()  
      org.restlet.data.Status getStatus()
      Returns the actual status code.
      void write​(java.io.Writer writer)  
      • Methods inherited from class org.restlet.representation.WriterRepresentation

        getReader
      • Methods inherited from class org.restlet.representation.CharacterRepresentation

        getChannel, getStream, write, write
      • Methods inherited from class org.restlet.representation.Representation

        append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, 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, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • JsonpRepresentation

        public JsonpRepresentation​(java.lang.String callback,
                                   org.restlet.data.Status status,
                                   org.restlet.representation.Representation wrappedRepresentation)
        Constructor.
        Parameters:
        callback - The name of the JavaScript callback method.
        status - The actual status code.
        wrappedRepresentation -
    • Method Detail

      • getCallback

        public java.lang.String getCallback()
        Returns the name of the JavaScript callback method.
        Returns:
        The name of the JavaScript callback method.
      • getSize

        public long getSize()
        Overrides:
        getSize in class org.restlet.representation.Representation
      • getStatus

        public org.restlet.data.Status getStatus()
        Returns the actual status code.
        Returns:
        The actual status code.
      • write

        public void write​(java.io.Writer writer)
                   throws java.io.IOException
        Specified by:
        write in class org.restlet.representation.Representation
        Throws:
        java.io.IOException