Ejemplo n.º 1
0
  /**
   * Overridden to get use apply the XLST transformation on the content.
   *
   * @throws TransformerException
   */
  public void appendToResponse(WOResponse response, WOContext context) {
    start = System.currentTimeMillis();
    current = start;
    if (isEnabled()) {
      WOResponse newResponse = new WOResponse();
      newResponse.setContentEncoding(response.contentEncoding());

      super.appendToResponse(newResponse, context);

      if (log.isDebugEnabled()) {
        String contentString = newResponse.contentString();
        log.debug("Converting content string:\n" + contentString);
      }

      try {
        NSData data = transform(transformer(), newResponse.content());
        if (hasBinding("data") && canSetValueForBinding("data")) {
          setValueForBinding(data, "data");
        }
        if (hasBinding("stream") && canSetValueForBinding("stream")) {
          setValueForBinding(data.stream(), "stream");
        }
        response.appendContentData(data);
      } catch (TransformerException e) {
        throw NSForwardException._runtimeExceptionForThrowable(e);
      }
    } else {
      super.appendToResponse(response, context);
    }
    log.debug("Total: " + (System.currentTimeMillis() - start));
    start = System.currentTimeMillis();
  }
 @Override
 public void appendToResponse(WOResponse response, WOContext context) {
   super.appendToResponse(response, context);
   if (ERXComponentUtilities.booleanValueForBinding(this, Keys.injectDefaultCSS, true)) {
     AjaxUtils.addStylesheetResourceInHead(context, response, "default_ajaxupload.css");
   }
   AjaxUtils.addScriptResourceInHead(context, response, "prototype.js");
   AjaxUtils.addScriptResourceInHead(context, response, "effects.js");
   AjaxUtils.addScriptResourceInHead(context, response, "wonder.js");
   AjaxUtils.addScriptResourceInHead(context, response, "ajaxupload.js");
 }