- Common ways to obtain Representation
private void myMethod () {Representation r =
new EmptyRepresentation()
ClientResource clientResource;clientResource.get()
Response response;response.getEntity()
- Smart code suggestions by Codota
}
public void writeRequest(OutputStream os) throws IOException { entity.write(os); } });
public void writeTo(OutputStream os) throws IOException { entity.write(os); os.flush(); } });
@Override public void write(java.nio.channels.WritableByteChannel writableChannel) throws IOException { getWrappedRepresentation().write(writableChannel); } }
@Override public void write(OutputStream outputStream) throws IOException { if (this.representation != null) { this.representation.write(outputStream); } else if (this.object != null) { getObjectWriter().writeValue(outputStream, this.object); } }
@Override public void write(OutputStream outputStream) throws IOException { if (representation != null) { representation.write(outputStream); } else if (object != null) { getObjectWriter().writeValue(outputStream, object); } } }
/** * {@inheritDoc}<br> * * The output stream is wrapped with a new instance of the * {@link DigestOutputStream} class, which allows to compute progressively * the digest value. */ @Override public void write(OutputStream outputStream) throws IOException { OutputStream dos = new DigestOutputStream(outputStream, this.computedDigest); getWrappedRepresentation().write(dos); dos.flush(); }
public static void main(String[] args) throws Exception { ClientResource mailClient = new ClientResource( "http://localhost:8111/accounts/chunkylover53/mails/123"); mailClient.get().write(System.out); }
public static void main(String[] args) throws Exception { ClientResource mailClient = new ClientResource( "http://localhost:8111/accounts/chunkylover53/mails/123"); mailClient.get().write(System.out); }
public static void main(String[] args) throws Exception { ClientResource helloClientresource = new ClientResource( "http://localhost:8111/"); helloClientresource.get().write(System.out); } }
public static void main(String[] args) throws Exception { ClientResource resource = new ClientResource("http://localhost:8113/"); resource.get().write(System.out); }
public static void main(String[] args) throws Exception { // Outputting the content of a Web page new ClientResource("http://restlet.org").get().write(System.out); }
public static void main(String[] args) throws Exception { ClientResource mailRoot = new ClientResource("http://localhost:8111/"); mailRoot.get().write(System.out); String result = mailRoot.get(String.class); System.out.println("\n" + result); }
public static void main(String[] args) throws Exception { // Create the client resource ClientResource resource = new ClientResource("http://restlet.org"); // Customize the referrer property resource.setReferrerRef("http://www.mysite.org"); // Write the response entity on the console resource.get().write(System.out); }
@Override public void write(WritableByteChannel writableChannel) throws IOException { if (canEncode()) { OutputStream os = IoUtils.getStream(writableChannel); write(os); os.flush(); } else { getWrappedRepresentation().write(writableChannel); } }
public static void main(String[] args) throws Exception { ClientResource resource = new ClientResource("http://localhost:8111/"); // Requesting the first five characters. resource.getRanges().add(new Range(0, 5)); // Get the representation of the resource resource.get().write(System.out); }
@Override public void write(java.io.Writer writer) throws IOException { if (canEncode()) { OutputStream os = IoUtils.getStream(writer, getCharacterSet()); write(os); os.flush(); } else { getWrappedRepresentation().write(writer); } }
public static void main(String[] args) throws Exception { ClientResource mailClient = new ClientResource( "http://localhost:8111/accounts/chunkylover53/mails/123"); Form form = new Form(); form.add("subject", "Message to Jérôme"); form.add("content", "Doh!\n\nAllo?"); System.out.println(form.getWebRepresentation()); mailClient.put(form).write(System.out); }
/** * Writes the representation to a byte stream. * * @param outputStream * The output stream. */ @Override public void write(OutputStream outputStream) throws IOException { if (isDecoding()) { IoUtils.copy(getStream(), outputStream); } else { getWrappedRepresentation().write(outputStream); } }
public static void main(String[] args) throws Exception { ClientResource mailClient = new ClientResource( "http://localhost:8111/accounts/chunkylover53/mails/123"); Form form = new Form(); form.add("subject", "Message to Jérôme"); form.add("content", "Doh!\n\nAllo?"); mailClient.put(form).write(System.out); }
public static void main(String[] args) throws Exception { ClientResource mailClient = new ClientResource( "http://localhost:8111/accounts/chunkylover53/mails/123"); mailClient.getRequest().getCookies() .add(new Cookie("Credentials", "chunkylover53=pwd")); Form form = new Form(); form.add("subject", "Message to Jérôme"); form.add("content", "Doh!\n\nAllo?"); System.out.println(form.getWebRepresentation()); mailClient.put(form).write(System.out); }