我目前正試圖在後臺實現文件導出,以便用戶可以在文件下載時執行一些操作。CommandExecuteIn Background引發「不是(編碼)值」錯誤
我使用了apache isis CommandExexuteIn:Background
action屬性。但是,我得到一個錯誤 「不是(可編碼的)值」,這是由類別ScalarValueRenderer引發的錯誤。
這是我的方法看起來像:
@Action(semantics = SemanticsOf.SAFE,
command = CommandReification.ENABLED)
commandExecuteIn = CommandExecuteIn.BACKGROUND)
public Blob exportViewAsPdf() {
final Contact contact = this;
final String filename = this.businessName + " Contact Details";
final Map<String, Object> parameters = new HashMap<>();
parameters.put("contact", contact);
final String template = templateLoader.buildFromTemplate(Contact.class, "ContactViewTemplate", parameters);
return pdfExporter.exportAsPdf(filename, template);
}
我認爲錯誤有事情做與命令實際上並不調用行動,但返回的持久化背景命令。
該實現實際上在沒有返回類型的方法上工作。我錯過了什麼?或者有沒有辦法實現後臺命令並獲得預期的結果?
非常感謝你對Sir和這個想法的迴應。到目前爲止,我會嘗試實現前端輪詢。這個想法是生成PDF背景,存儲它,然後使前端獲取生成的PDF。 – Kesh