Tabnine Logo
Response.setEntity
Code IndexAdd Tabnine to your IDE (free)

How to use
setEntity
method
in
org.restlet.Response

Best Java code snippets using org.restlet.Response.setEntity (Showing top 20 results out of 315)

origin: org.restlet.jse/org.restlet.example

  @Override
  public void handle(Request request, Response response) {
    response.setEntity("Hello.", MediaType.TEXT_PLAIN);
  }
};
origin: org.restlet.jse/org.restlet.example

  @Override
  public void handle(Request request, Response response) {
    response.setEntity("Bye", MediaType.TEXT_PLAIN);
  }
};
origin: icclab/cyclops

public Response prepareResponse(Response response, boolean withEnvelope) {
  if (response == null || status == null || description == null) return null;
  // fill status with description and make sure entity is of type JSON
  response.setStatus(status, description);
  Gson gson = new Gson();
  if (!withEnvelope && result != null) response.setEntity(gson.toJson(result), MEDIA_TYPE);
  else response.setEntity(gson.toJson(this), MEDIA_TYPE);
  return response;
}
origin: icclab/cyclops

public Response prepareResponse(Response response, boolean withEnvelope) {
  if (response == null || status == null || description == null) return null;
  // fill status with description and make sure entity is of type JSON
  response.setStatus(status, description);
  Gson gson = new Gson();
  if (!withEnvelope && result != null) response.setEntity(gson.toJson(result), MEDIA_TYPE);
  else response.setEntity(gson.toJson(this), MEDIA_TYPE);
  return response;
}
origin: icclab/cyclops

public Response prepareResponse(Response response, boolean withEnvelope) {
  if (response == null || status == null || description == null) return null;
  // fill status with description and make sure entity is of type JSON
  response.setStatus(status, description);
  Gson gson = new Gson();
  if (!withEnvelope && result != null) response.setEntity(gson.toJson(result), MEDIA_TYPE);
  else response.setEntity(gson.toJson(this), MEDIA_TYPE);
  return response;
}
origin: org.restlet.osgi/org.restlet

/**
 * Sets a textual entity.
 * 
 * @param value
 *            The represented string.
 * @param mediaType
 *            The representation's media type.
 */
@Override
public void setEntity(String value, MediaType mediaType) {
  getWrappedResponse().setEntity(value, mediaType);
}
origin: org.restlet.osgi/org.restlet

/**
 * Sets the entity representation.
 * 
 * @param entity
 *            The entity representation.
 */
@Override
public void setEntity(Representation entity) {
  getWrappedResponse().setEntity(entity);
}
origin: org.restlet.jse/org.restlet.example

  @Override
  public void handle(Request request, Response response) {
    // Print the user name of the requested orders
    String message = "Orders of user \""
        + request.getAttributes().get("user") + "\"";
    response.setEntity(message, MediaType.TEXT_PLAIN);
  }
};
origin: org.restlet.jse/org.restlet.example

  @Override
  public void handle(Request request, Response response) {
    // Print the requested URI path
    String message = "Account of user \""
        + request.getAttributes().get("user") + "\"";
    response.setEntity(message, MediaType.TEXT_PLAIN);
  }
};
origin: org.restlet.jse/org.restlet.example

  @Override
  public void handle(Request request, Response response) {
    // Print the user name of the requested orders
    String message = "Order \""
        + request.getAttributes().get("order")
        + "\" for user \""
        + request.getAttributes().get("user") + "\"";
    response.setEntity(message, MediaType.TEXT_PLAIN);
  }
};
origin: org.restlet.osgi/org.restlet.ext.oauth

private int sendErrorPage(Response response, Exception ex) {
  response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST, ex.getMessage());
  response.setEntity(getErrorPage(ex));
  return STOP;
}
origin: org.restlet.jse/org.restlet.example

@Override
public void challenge(Response response, boolean stale) {
  // Load the FreeMarker template
  Representation ftl = new ClientResource(
      LocalReference.createClapReference(getClass().getPackage())
          + "/Login.ftl").get();
  // Wraps the bean with a FreeMarker representation
  response.setEntity(new TemplateRepresentation(ftl, response
      .getRequest().getResourceRef(), MediaType.TEXT_HTML));
  response.setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
}
origin: org.restlet.jse/org.restlet.example

@Override
public void challenge(Response response, boolean stale) {
  // Load the FreeMarker template
  Representation ftl = new ClientResource(
      LocalReference.createClapReference(getClass().getPackage())
          + "/Login.ftl").get();
  // Wraps the bean with a FreeMarker representation
  response.setEntity(new TemplateRepresentation(ftl, response
      .getRequest().getResourceRef(), MediaType.TEXT_HTML));
  response.setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
}
origin: org.restlet.jee/org.restlet.ext.xml

@Override
protected void afterHandle(Request request, Response response) {
  if ((getMode() == MODE_RESPONSE) && canTransform(response.getEntity())) {
    response.setEntity(transform(response.getEntity()));
  }
}
origin: org.restlet.osgi/org.restlet.ext.oauth

@Override
protected void doCatch(Throwable t) {
  final OAuthException oex = OAuthException.toOAuthException(t);
  // XXX: Generally, we only communicate with TokenVerifier. So we don't
  // need HTTP 400 code.
  // getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
  getResponse().setStatus(Status.SUCCESS_OK);
  getResponse().setEntity(responseErrorRepresentation(oex));
}
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.jse/org.restlet.example

@Override
public void handle(Request request, Response response) {
  String entity = "Method       : " + request.getMethod()
      + "\nResource URI : " + request.getResourceRef()
      + "\nIP address   : " + request.getClientInfo().getAddress()
      + "\nAgent name   : " + request.getClientInfo().getAgentName()
      + "\nAgent version: "
      + request.getClientInfo().getAgentVersion();
  response.setEntity(entity, MediaType.TEXT_PLAIN);
}
origin: org.restlet.jse/org.restlet.example

@Override
public void handle(Request request, Response response) {
  String entity = "Method       : " + request.getMethod()
      + "\nResource URI : " + request.getResourceRef()
      + "\nIP address   : " + request.getClientInfo().getAddress()
      + "\nAgent name   : " + request.getClientInfo().getAgentName()
      + "\nAgent version: "
      + request.getClientInfo().getAgentVersion();
  response.setEntity(entity, MediaType.TEXT_PLAIN);
}
origin: org.restlet.jse/org.restlet.example

  @Override
  public void handle(Request request, Response response) {
    String entity = "Method       : " + request.getMethod()
        + "\nResource URI : " + request.getResourceRef()
        + "\nIP address   : "
        + request.getClientInfo().getAddress()
        + "\nAgent name   : "
        + request.getClientInfo().getAgentName()
        + "\nAgent version: "
        + request.getClientInfo().getAgentVersion();
    response.setEntity(entity, MediaType.TEXT_PLAIN);
  }
};
origin: org.restlet.jse/org.restlet.example

  @Override
  public void handle(Request request, Response response) {
    String entity = "Method       : " + request.getMethod()
        + "\nResource URI : " + request.getResourceRef()
        + "\nIP address   : "
        + request.getClientInfo().getAddress()
        + "\nAgent name   : "
        + request.getClientInfo().getAgentName()
        + "\nAgent version: "
        + request.getClientInfo().getAgentVersion();
    response.setEntity(entity, MediaType.TEXT_PLAIN);
  }
};
org.restletResponsesetEntity

Popular methods of Response

  • setStatus
    Sets the status.
  • getEntity
  • getStatus
    Returns the status.
  • getAttributes
  • getEntityAsText
  • isEntityAvailable
  • getHeaders
  • redirectSeeOther
    Redirects the client to a different URI that SHOULD be retrieved using a GET method on that resource
  • getCookieSettings
    Returns the modifiable series of cookie settings provided by the server. Creates a new instance if n
  • getCurrent
    Returns the response associated to the current thread. Warning: this method should only be used unde
  • getRequest
    Returns the associated request
  • getAllowedMethods
    Returns the modifiable set of methods allowed on the requested resource. This property only has to b
  • getRequest,
  • getAllowedMethods,
  • getLocationRef,
  • setLocationRef,
  • <init>,
  • getCacheDirectives,
  • getServerInfo,
  • commit,
  • getChallengeRequests

Popular in Java

  • Start an intent from android
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Permission (java.security)
    Legacy security code; do not use.
  • ImageIO (javax.imageio)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now