Beispiel #1
0
  /**
   * Tell RestExpress to support XML in routes, incoming and outgoing. By default RestExpress
   * supports XML.
   *
   * @param isDefault true to make XML the default format.
   * @return the RestExpress instance.
   */
  public RestExpress supportXml(boolean isDefault) {
    if (!getResponseProcessors().containsKey(Format.XML)) {
      getResponseProcessors().put(Format.XML, ResponseProcessor.defaultXmlProcessor());
    }

    if (isDefault) {
      setDefaultFormat(Format.XML);
    }

    return this;
  }
Beispiel #2
0
  /**
   * Tell RestExpress to support TXT format specifiers in routes, outgoing only at present.
   *
   * @param isDefault true to make TXT the default format.
   * @return the RestExpress instance.
   */
  public RestExpress supportTxt(boolean isDefault) {
    if (!getResponseProcessors().containsKey(Format.TXT)) {
      getResponseProcessors().put(Format.TXT, ResponseProcessor.defaultTxtProcessor());
    }

    if (isDefault) {
      setDefaultFormat(Format.TXT);
    }

    return this;
  }
Beispiel #3
0
  /**
   * Tell RestExpress to support JSON in routes, incoming and outgoing. By default RestExpress
   * supports JSON and is the default.
   *
   * @param isDefault true to make JSON the default format.
   * @return the RestExpress instance.
   */
  public RestExpress supportJson(boolean isDefault) {
    if (!getResponseProcessors().containsKey(Format.JSON)) {
      responseProcessors.put(Format.JSON, ResponseProcessor.defaultJsonProcessor());
    }

    if (isDefault) {
      setDefaultFormat(Format.JSON);
    }

    return this;
  }