Ejemplo n.º 1
0
 @Override
 public <T> T requestToObject(WebRequest request, Class<T> argClass, String mimeType)
     throws WicketRuntimeException {
   try {
     return objectSerialDeserial.deserializeObject(
         HttpUtils.readStringFromRequest(request), argClass, mimeType);
   } catch (IOException e) {
     throw new WicketRuntimeException("An error occurred during request reading.", e);
   }
 }
Ejemplo n.º 2
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);
  }