Codota Logo
Representation.getEncodings
Code IndexAdd Codota to your IDE (free)

How to use
getEncodings
method
in
org.restlet.representation.Representation

Best Java code snippets using org.restlet.representation.Representation.getEncodings (Showing top 20 results out of 315)

  • Common ways to obtain Representation
private void myMethod () {
Representation r =
  • Codota Iconnew EmptyRepresentation()
  • Codota IconClientResource clientResource;clientResource.get()
  • Codota IconResponse response;response.getEntity()
  • Smart code suggestions by Codota
}
origin: org.restlet.osgi/org.restlet

/**
 * Constructor.
 * 
 * @param wrappedRepresentation
 *            The wrapped representation.
 */
public DecodeRepresentation(Representation wrappedRepresentation) {
  super(wrappedRepresentation);
  this.decoding = getSupportedEncodings().containsAll(
      wrappedRepresentation.getEncodings());
  this.wrappedEncodings = new CopyOnWriteArrayList<Encoding>(
      wrappedRepresentation.getEncodings());
}

origin: org.restlet.osgi/org.restlet

  private Object getEncodingsAsString(Representation entity) {
    if (entity != null && !entity.getEncodings().isEmpty()) {
      final StringBuilder value = new StringBuilder();
      for (int i = 0; i < entity.getEncodings().size(); i++) {
        if (i > 0) {
          value.append(", ");
        }
        value.append(entity.getEncodings().get(i).getName());
      }
      return value.toString();
    }
    return null;
  }
}
origin: org.restlet.osgi/org.restlet

@Override
public List<Encoding> getEncodings() {
  return getWrappedRepresentation().getEncodings();
}
origin: org.restlet.osgi/org.restlet

/**
 * Indicates if a representation can be decoded.
 * 
 * @param representation
 *            The representation to test.
 * @return True if the call can be decoded.
 */
public boolean canDecode(Representation representation) {
  // Test the existence of the representation and that at least an
  // encoding applies.
  boolean result = (representation != null)
      && (!representation.getEncodings().isEmpty());
  if (result) {
    boolean found = false;
    for (final Iterator<Encoding> iter = representation.getEncodings()
        .iterator(); !found && iter.hasNext();) {
      found = (!iter.next().equals(Encoding.IDENTITY));
    }
    result = found;
  }
  return result;
}
origin: org.restlet.osgi/org.restlet

/**
 * Decodes a given representation if its encodings are supported by NRE.
 * 
 * @param representation
 *            The representation to encode.
 * @return The decoded representation or the original one if the encoding
 *         isn't supported by NRE.
 */
public Representation decode(Representation representation) {
  Representation result = representation;
  // Check if all encodings of the representation are supported in order
  // to avoid the creation of a useless decodeRepresentation object.
  // False if an encoding is not supported
  boolean supported = true;
  // True if all representation's encodings are IDENTITY
  boolean identityEncodings = true;
  for (final Iterator<Encoding> iter = representation.getEncodings()
      .iterator(); supported && iter.hasNext();) {
    final Encoding encoding = iter.next();
    supported = DecodeRepresentation.getSupportedEncodings().contains(
        encoding);
    identityEncodings &= encoding.equals(Encoding.IDENTITY);
  }
  if (supported && !identityEncodings) {
    result = new DecodeRepresentation(representation);
  }
  return result;
}
origin: org.restlet.osgi/org.restlet

this.encodings.addAll(getWrappedRepresentation().getEncodings());
if (canEncode()) {
  this.encodings.add(this.encoding);
origin: org.restlet.osgi/org.restlet

  && !representation.getEncodings().isEmpty()
  && !var.getEncodings().containsAll(representation.getEncodings())) {
return false;
origin: org.restlet.osgi/org.restlet

boolean identity = true;
for (Iterator<Encoding> iter = representation.getEncodings()
    .iterator(); identity && iter.hasNext();) {
  identity = (iter.next().equals(Encoding.IDENTITY));
origin: org.restlet.gae/org.restlet.ext.freemarker

@Override
protected void afterHandle(Request request, Response response) {
  if (response.isEntityAvailable()
      && response.getEntity().getEncodings()
          .contains(Encoding.FREEMARKER)) {
    TemplateRepresentation representation = new TemplateRepresentation(
        response.getEntity(), this.configuration, response
            .getEntity().getMediaType());
    representation.setDataModel(createDataModel(request, response));
    response.setEntity(representation);
  }
}
origin: org.restlet/org.restlet.ext.xml

    .setMediaType(representation.getMediaType());
resultRepresentation
    .setEncodings(representation.getEncodings());
resultRepresentation
    .setLanguages(representation.getLanguages());
origin: org.restlet.osgi/org.restlet

    .getCharacterSet());
resultRepresentation.setMediaType(source.getMediaType());
resultRepresentation.getEncodings().addAll(
    source.getEncodings());
resultRepresentation.getLanguages().addAll(
    source.getLanguages());
origin: org.restlet.jee/org.restlet.ext.xml

/**
 * Transforms a source XML representation by applying an XSLT transform
 * sheet to it.
 * 
 * @param source
 *            The source XML representation.
 * @return The generated result representation.
 */
public Representation transform(Representation source) {
  final Representation result = new TransformRepresentation(getContext(),
      source, getTransformSheet());
  if (this.resultLanguages != null) {
    result.getLanguages().addAll(getResultLanguages());
  }
  result.setCharacterSet(getResultCharacterSet());
  if (this.resultEncodings != null) {
    result.getEncodings().addAll(getResultEncodings());
  }
  result.setMediaType(getResultMediaType());
  return result;
}
origin: org.restlet/org.restlet.ext.xml

/**
 * Transforms a source XML representation by applying an XSLT transform
 * sheet to it.
 * 
 * @param source
 *            The source XML representation.
 * @return The generated result representation.
 */
public Representation transform(Representation source) {
  final Representation result = new TransformRepresentation(getContext(),
      source, getTransformSheet());
  if (this.resultLanguages != null) {
    result.getLanguages().addAll(getResultLanguages());
  }
  result.setCharacterSet(getResultCharacterSet());
  if (this.resultEncodings != null) {
    result.getEncodings().addAll(getResultEncodings());
  }
  result.setMediaType(getResultMediaType());
  return result;
}
origin: org.restlet.osgi/org.restlet

for (Encoding encoding : request.getEntity().getEncodings()) {
  updateFileExtension(fileName, encoding);
origin: org.restlet.osgi/org.restlet

if (result.getEncodings().isEmpty()) {
  result.getEncodings().addAll(target.getEncodings());
origin: org.restlet.jse/org.restlet.ext.thymeleaf

@Override
protected void afterHandle(Request request, Response response) {
  if (response.isEntityAvailable()
      && response.getEntity().getEncodings().contains(THYMELEAF)) {
    try {
      final TemplateRepresentation representation = new TemplateRepresentation(
          (TemplateRepresentation) response.getEntity(),
          getLocale(), response.getEntity().getMediaType());
      if ((this.mapDataModel == null)
          && (this.resolverDataModel == null)) {
        representation.setDataModel(request, response);
      } else {
        if (this.mapDataModel == null) {
          representation.setDataModel(this.resolverDataModel);
        } else {
          representation.setDataModel(this.mapDataModel);
        }
      }
      response.setEntity(representation);
    } catch (IOException e) {
      response.setStatus(Status.SERVER_ERROR_INTERNAL, e);
    }
  }
}
origin: org.restlet.jse/org.restlet.ext.velocity

@Override
protected void afterHandle(Request request, Response response) {
  if (response.isEntityAvailable()
      && response.getEntity().getEncodings().contains(
          Encoding.VELOCITY)) {
    try {
origin: org.restlet.osgi/org.restlet

    HeaderConstants.HEADER_CONTENT_ENCODING)) {
  new EncodingReader(header.getValue()).addValues(result
      .getEncodings());
} else if (header.getName().equalsIgnoreCase(
    HeaderConstants.HEADER_CONTENT_LANGUAGE)) {
origin: org.restlet.osgi/org.restlet

  entityHeaderFound = true;
} else if (HEADER_CONTENT_ENCODING.equalsIgnoreCase(header.getName())) {
  new EncodingReader(header.getValue()).addValues(result.getEncodings());
  entityHeaderFound = true;
} else if (HEADER_CONTENT_LANGUAGE.equalsIgnoreCase(header.getName())) {
origin: org.restlet.osgi/org.restlet

addHeader(HEADER_CONTENT_ENCODING, EncodingWriter.write(entity.getEncodings()), headers);
addHeader(HEADER_CONTENT_LANGUAGE, LanguageWriter.write(entity.getLanguages()), headers);
org.restlet.representationRepresentationgetEncodings

Popular methods of Representation

  • getMediaType
  • getStream
    Returns a stream with the representation's content. This method is ensured to return a fresh stream
  • getText
    Converts the representation to a string value. Be careful when using this method as the conversion o
  • isAvailable
    Indicates if some fresh content is potentially available, without having to actually call one of the
  • write
    Writes the representation to a byte channel. This method is ensured to write the full content for ea
  • setMediaType
  • getCharacterSet
  • getReader
    Returns a characters reader with the representation's content. This method is ensured to return a fr
  • getSize
    Returns the total size in bytes if known, UNKNOWN_SIZE (-1) otherwise. When ranges are used, this mi
  • setCharacterSet
  • getModificationDate
  • release
    Releases the representation and all associated objects like streams, channels or files which are use
  • getModificationDate,
  • release,
  • getLanguages,
  • setModificationDate,
  • getLocationRef,
  • setTag,
  • exhaust,
  • getDisposition,
  • getTag

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now