Package jodd.madvoc.action

Source Code of jodd.madvoc.action.RawAction

// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.madvoc.action;

import jodd.madvoc.meta.Action;
import jodd.madvoc.meta.MadvocAction;
import jodd.madvoc.result.RawData;
import jodd.madvoc.result.RawDownload;
import jodd.madvoc.result.RawResultData;
import jodd.util.CharUtil;
import jodd.util.MimeTypes;

@MadvocAction
public class RawAction {

  @Action
  public RawData view() {
    String result = "this is some raw direct result";
    byte[] bytes = CharUtil.toAsciiByteArray(result.toCharArray());
    return new RawData(bytes, MimeTypes.MIME_TEXT_HTML);
  }

  @Action
  public String text() {
    return "text:some raw txt";
  }

  @Action(extension = Action.NONE)
  public RawResultData download() {
    String fileContent = "file from jodd.org!";
    return new RawDownload(fileContent.getBytes(), "jodd-download.txt");
  }

}
TOP

Related Classes of jodd.madvoc.action.RawAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.