Package org.restlet.ext.json
Class JsonpRepresentation
- java.lang.Object
-
- org.restlet.representation.Variant
-
- org.restlet.representation.RepresentationInfo
-
- org.restlet.representation.Representation
-
- org.restlet.representation.CharacterRepresentation
-
- org.restlet.representation.WriterRepresentation
-
- org.restlet.ext.json.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
-
-
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.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
-
-
-
-
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 classorg.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 classorg.restlet.representation.Representation
- Throws:
java.io.IOException
-
-