Example #1
0
  @Override
  protected List<Property> createProperties(Algorithm algorithm) throws Exception {
    List<Property> p = new ArrayList<Property>();

    LiteratureEntry le = LiteratureEntry.getInstance(Reference.encode(getName(algorithm)), "value");
    Property property = new Property("value", le);

    property.setLabel(algorithm.getName());
    property.setClazz(String.class);
    p.add(property);
    return p;
  }
Example #2
0
  public MailboxResource(Context context, Request request, Response response) {
    super(context, request, response);

    final String mailboxId =
        Reference.decode(
            (String) request.getAttributes().get("mailboxId"), CharacterSet.ISO_8859_1);
    this.mailbox = getObjectsFacade().getMailboxById(mailboxId);
    System.out.println(Reference.encode(mailboxId));

    if (this.mailbox != null) {
      getVariants().add(new Variant(MediaType.TEXT_HTML));
    }

    // Avoid anonymous to update this resource.
    setModifiable(true);
  }
Example #3
0
 /**
  * Appends a source string as an URI encoded string.
  *
  * @param source The source string to format.
  * @param destination The appendable destination.
  * @param characterSet The supported character encoding.
  * @throws IOException
  */
 public static Appendable appendUriEncoded(
     CharSequence source, Appendable destination, CharacterSet characterSet) throws IOException {
   destination.append(Reference.encode(source.toString(), characterSet));
   return destination;
 }