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

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

Best Java code snippets using org.restlet.representation.Representation.setLocationRef (Showing top 14 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

@Override
public void setLocationRef(Reference location) {
  getWrappedRepresentation().setLocationRef(location);
}
origin: org.restlet.osgi/org.restlet

@Override
public void setLocationRef(String locationUri) {
  getWrappedRepresentation().setLocationRef(locationUri);
}
origin: org.restlet.osgi/org.restlet.ext.osgi

    url.openStream(),
    metadataService.getDefaultMediaType());
output.setLocationRef(request.getResourceRef());
output.setModificationDate(modificationDate);
origin: org.restlet.osgi/org.restlet

    inputStream,
    metadataService.getDefaultMediaType());
output.setLocationRef(request.getResourceRef());
output.setModificationDate(modificationDate);
origin: org.restlet.osgi/org.restlet

  this.fileContent.setLocationRef(getRequest().getOriginalRef());
} else {
  this.fileContent.setLocationRef(getReference());
        rep.setLocationRef(baseReference + filePath);
      } else {
        rep.setLocationRef(baseReference + "/" + filePath);
origin: org.restlet.osgi/org.restlet

/**
 * If the response entity comes back with no identifier, automatically set
 * the request's resource reference's identifier. This is very useful to
 * resolve relative references in XSLT for example.
 */
@Override
protected void afterHandle(Request request, Response response) {
  if ((response.getEntity() != null)
      && (response.getEntity().getLocationRef() == null)) {
    response.getEntity().setLocationRef(
        request.getResourceRef().getTargetRef().toString());
  }
}
origin: org.restlet.jse/org.restlet.example

/**
 * Handle POST requests: create a new item.
 */
@Post
public Representation acceptItem(Representation entity) {
  Representation result = null;
  // Parse the given representation and retrieve pairs of
  // "name=value" tokens.
  Form form = new Form(entity);
  String itemName = form.getFirstValue("name");
  String itemDescription = form.getFirstValue("description");
  // Register the new item if one is not already registered.
  if (!getItems().containsKey(itemName)
      && getItems().putIfAbsent(itemName,
          new Item(itemName, itemDescription)) == null) {
    // Set the response's status and entity
    setStatus(Status.SUCCESS_CREATED);
    Representation rep = new StringRepresentation("Item created",
        MediaType.TEXT_PLAIN);
    // Indicates where is located the new resource.
    rep.setLocationRef(getRequest().getResourceRef().getIdentifier()
        + "/" + itemName);
    result = rep;
  } else { // Item is already registered.
    setStatus(Status.CLIENT_ERROR_NOT_FOUND);
    result = generateErrorRepresentation("Item " + itemName
        + " already exists.", "1");
  }
  return result;
}
origin: org.restlet.jse/org.restlet.example

/**
 * Handle POST requests: create a new item.
 */
@Post
public Representation acceptItem(Representation entity) {
  Representation result = null;
  // Parse the given representation and retrieve pairs of
  // "name=value" tokens.
  Form form = new Form(entity);
  String itemName = form.getFirstValue("name");
  String itemDescription = form.getFirstValue("description");
  // Register the new item if one is not already registered.
  if (!getItems().containsKey(itemName)
      && getItems().putIfAbsent(itemName,
          new Item(itemName, itemDescription)) == null) {
    // Set the response's status and entity
    setStatus(Status.SUCCESS_CREATED);
    Representation rep = new StringRepresentation("Item created",
        MediaType.TEXT_PLAIN);
    // Indicates where is located the new resource.
    rep.setLocationRef(getRequest().getResourceRef().getIdentifier()
        + "/" + itemName);
    result = rep;
  } else { // Item is already registered.
    setStatus(Status.CLIENT_ERROR_NOT_FOUND);
    result = generateErrorRepresentation("Item " + itemName
        + " already exists.", "1");
  }
  return result;
}
origin: org.restlet.osgi/org.restlet

/**
 * Redirects a given call to a target reference. In the default
 * implementation, the request HTTP headers, stored in the request's
 * attributes, are removed before dispatching. After dispatching, the
 * response HTTP headers are also removed to prevent conflicts with the main
 * call.
 * 
 * @param targetRef
 *            The target reference with URI variables resolved.
 * @param request
 *            The request to handle.
 * @param response
 *            The response to update.
 */
protected void outboundServerRedirect(Reference targetRef, Request request,
    Response response) {
  Restlet next = (getApplication() == null) ? null : getApplication()
      .getOutboundRoot();
  if (next == null) {
    next = getContext().getClientDispatcher();
  }
  serverRedirect(next, targetRef, request, response);
  if (response.getEntity() != null
      && !request.getResourceRef().getScheme()
          .equalsIgnoreCase(targetRef.getScheme())) {
    // Distinct protocol, this data cannot be exposed.
    response.getEntity().setLocationRef((Reference) null);
  }
}
origin: org.restlet.osgi/org.restlet

/**
 * Constructor from a variant.
 * 
 * @param variant
 *            The variant to copy.
 * @param modificationDate
 *            The modification date.
 * @param tag
 *            The tag.
 */
public Representation(Variant variant, Date modificationDate, Tag tag) {
  setCharacterSet(variant.getCharacterSet());
  setEncodings(variant.getEncodings());
  setLocationRef(variant.getLocationRef());
  setLanguages(variant.getLanguages());
  setMediaType(variant.getMediaType());
  setModificationDate(modificationDate);
  setTag(tag);
}
origin: org.restlet.osgi/org.restlet

  entityHeaderFound = true;
} else if (HEADER_CONTENT_LOCATION.equalsIgnoreCase(header.getName())) {
  result.setLocationRef(header.getValue());
  entityHeaderFound = true;
} else if (HEADER_CONTENT_DISPOSITION.equalsIgnoreCase(header.getName())) {
origin: org.restlet.osgi/org.restlet

/**
 * Rewrite the location of the response, and the Location of the entity, if
 * any.
 * 
 * @param request
 *            The request to handle.
 * @param response
 *            The response to update.
 */
public void rewriteLocation(Request request, Response response) {
  if (response.getLocationRef() != null) {
    Reference locationRef = response.getLocationRef();
    String newLocation = getLocation(locationRef, request);
    if (newLocation != null) {
      response.setLocationRef(newLocation);
    }
  }
  if (response.getEntity() != null
      && response.getEntity().getLocationRef() != null) {
    Reference locationRef = response.getEntity().getLocationRef();
    String newLocation = getLocation(locationRef, request);
    if (newLocation != null) {
      response.getEntity().setLocationRef(newLocation);
    }
  }
}
origin: org.restlet.osgi/org.restlet

      output.setLocationRef(request.getResourceRef());
      Entity.updateMetadata(entity.getName(), output, true,
          getMetadataService());
          getMetadataService().getDefaultMediaType(),
          getTimeToLive());
      output.setLocationRef(request.getResourceRef());
      Entity.updateMetadata(entity.getName(), output, true,
          getMetadataService());
  response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
} else {
  output.setLocationRef(request.getResourceRef());
  response.setEntity(output);
  response.setStatus(Status.SUCCESS_OK);
origin: org.restlet.osgi/org.restlet

    metadataService.getDefaultMediaType(),
    getTimeToLive());
output.setLocationRef(request.getResourceRef());
Entity.updateMetadata(entity.getName(), output, true,
    getMetadataService());
org.restlet.representationRepresentationsetLocationRef

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,
  • getEncodings,
  • getLocationRef,
  • setTag,
  • exhaust,
  • getDisposition,
  • getTag

Popular in Java

  • Making http requests using okhttp
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JComboBox (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
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