[ https://issues.apache.org/jira/browse/WW-5080?focusedWorklogId=454703&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-454703 ]
ASF GitHub Bot logged work on WW-5080: -------------------------------------- Author: ASF GitHub Bot Created on: 06/Jul/20 06:05 Start Date: 06/Jul/20 06:05 Worklog Time Spent: 10m Work Description: lukaszlenart commented on pull request #422: URL: https://github.com/apache/struts/pull/422#issuecomment-654033477 > Shouldn't we do something in configs, allowing developer to define this result via struts.xml as well? No, this result is a plain code-based-result, you cannot define it in `struts.xml` and it can only be returned directly from an action. `DefaultActionInvocation` [supports](https://github.com/apache/struts/blob/master/core/src/main/java/com/opensymphony/xwork2/DefaultActionInvocation.java#L472-L478) returning results directly from actions for a long time. > Already there is a PlainTextResult, shouldn't we amend it to extend this result? No, the `PlainTextResult` result returns content of a file as a plain text. This new result allows output any type of content (text, JSON, html) but you must build it by a hand. That's why I decided to name it a `PlainResult` and with Java 8 you can use lambdas to construct the output: ```java public PlainResult execute() { return response -> response.write("ok"); } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 454703) Time Spent: 40m (was: 0.5h) > Allow write directly to a response - define a new result > -------------------------------------------------------- > > Key: WW-5080 > URL: https://issues.apache.org/jira/browse/WW-5080 > Project: Struts 2 > Issue Type: Improvement > Components: Core Results > Reporter: Lukasz Lenart > Assignee: Lukasz Lenart > Priority: Minor > Fix For: 2.6 > > Time Spent: 40m > Remaining Estimate: 0h > > Right now there is no straight way to write directly to a Http response and > generate response using a Java code. -- This message was sent by Atlassian Jira (v8.3.4#803005)