Examples of StringRepresentation


Examples of org.restlet.client.representation.StringRepresentation

     *            The represented string.
     * @param mediaType
     *            The representation's media type.
     */
    public void setEntity(String value, MediaType mediaType) {
        setEntity(new StringRepresentation(value, mediaType));
    }
View Full Code Here

Examples of org.restlet.representation.StringRepresentation

      Resource[] contexts = spParams.getContext();
      boolean includeInferred = spParams.isIncludeInferred();

      try {
        long size = connection.sizeMatch(subj, pred, obj, includeInferred, contexts);
        return new StringRepresentation(String.valueOf(size));
      }
      catch (StoreException e) {
        throw new ResourceException(e);
      }
    }
View Full Code Here

Examples of org.restlet.representation.StringRepresentation

public class ErrorHandler extends StatusService {

  @Override
  public Representation getRepresentation(Status status, Request request, Response response) {
    // Return UTF-8 encoded plain text errors
    return new StringRepresentation(status.getDescription(), TEXT_PLAIN, Language.ALL, UTF_8);
  }
View Full Code Here

Examples of org.restlet.representation.StringRepresentation

  @Override
  public Status getStatus(Throwable throwable, Request request, Response response) {
    if (throwable instanceof ErrorInfoException) {
      ErrorInfo errInfo = ((ErrorInfoException)throwable).getErrorInfo();
      response.setEntity(new StringRepresentation(errInfo.toString(), TEXT_PLAIN, Language.ALL, UTF_8));
      return new Status(CLIENT_ERROR_BAD_REQUEST, errInfo.getErrorType().getLabel());
    }
    else {
      return super.getStatus(throwable, request, response);
    }
View Full Code Here

Examples of org.restlet.representation.StringRepresentation

    String pgtIou = queryParams.getFirstValue("pgtIou");
    if (pgtId != null && pgtIou != null) {
      // FIXME: clean up the hash map once in a while
      pgtIouMap.put(pgtIou, pgtId);
      response.setStatus(Status.SUCCESS_OK);
      response.setEntity(new StringRepresentation("bla"));
      return Filter.SKIP;
    }

    Session session = SessionManager.get();
    if (session != null && session.getUsername() != null) {
View Full Code Here

Examples of org.restlet.representation.StringRepresentation

    else {
      session = SessionManager.get();
    }

    if (session != null && session.getUsername() != null) {
      return new StringRepresentation("logged in as '" + session.getUsername() + "'");
    }
    else {
      return new StringRepresentation("not logged in");
    }
  }
View Full Code Here

Examples of org.restlet.representation.StringRepresentation

      if (namespace == null) {
        throw new ResourceException(CLIENT_ERROR_NOT_FOUND, "Undefined prefix: " + prefix);
      }

      if (variant.getMediaType().equals(MediaType.TEXT_PLAIN, true)) {
        return new StringRepresentation(namespace);
      }

      throw new ResourceException(SERVER_ERROR_INTERNAL, "Unsupported media type: "
          + variant.getMediaType());
    }
View Full Code Here

Examples of org.restlet.representation.StringRepresentation

      SessionRegistry registry = SessionRegistry.getFromContext(getContext());
      registry.remove(sessionID);
      SessionUtil.discardSessionID(getResponse());
    }

    return new StringRepresentation("no longer logged in");
  }
View Full Code Here

Examples of org.restlet.representation.StringRepresentation

    setConditional(false);
  }

  @Override
  protected Representation get() {
    return new StringRepresentation(Protocol.VERSION);
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

        sb.append("</p>\n");
        sb.append("</body>\n");
        sb.append("</html>\n");

        return new StringRepresentation(sb.toString(), MediaType.TEXT_HTML);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.