コード例 #1
0
  @Override
  public void objectToResponse(Object targetObject, WebResponse response, String mimeType)
      throws WicketRuntimeException {
    setCharsetResponse(response);

    String strOutput;

    if (RestMimeTypes.TEXT_PLAIN.equals(mimeType)) {
      strOutput = targetObject == null ? "" : targetObject.toString();
    } else {
      strOutput = objectSerialDeserial.serializeObject(targetObject, mimeType);
    }

    response.write(strOutput);
  }
コード例 #2
0
 @Override
 public final boolean isMimeTypeSupported(String mimeType) {
   return RestMimeTypes.TEXT_PLAIN.equals(mimeType) || this.mimeType.equals(mimeType);
 }
コード例 #3
0
  /**
   * Checks if the given MIME type is supported by the current obj serial/deserial.
   *
   * @param mimeType the MIME type we want to check.
   * @return true if the MIME type is supported, false otherwise.
   */
  private boolean isMimeTypesSupported(String mimeType) {
    if (RestMimeTypes.TEXT_PLAIN.equals(mimeType)) return true;

    return objSerialDeserial.isMimeTypeSupported(mimeType);
  }