[
https://issues.apache.org/jira/browse/WW-3999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Steve Wolke updated WW-3999:
----------------------------
Description:
Allow the XSLT Result type to return a custom HTTP status code.
not sure where to put files so here is a diff of suggested changes:
@@ -229,6 +229,9 @@
/** Indicates the location of the xsl template. */
private String stylesheetLocation;
+ /** Indicates the status to return in the response*/
+ private int status=200;
+
/** Indicates the property name patterns which should be exposed to the
xml. */
private String matchingPattern;
@@ -271,10 +274,23 @@
return stylesheetLocation;
}
+ public String getStatus() {
+ return String.valueOf(status);
+ }
+
+ public void setStatus(String status) {
+ try{
+ this.status = Integer.valueOf(status);
+ }catch(NumberFormatException e){
+ throw new IllegalArgumentException("Status value not number" +
e.getMessage());
+ }
+ }
+
public String getExposedValue() {
return exposedValue;
}
+
public void setExposedValue(String exposedValue) {
this.exposedValue = exposedValue;
}
@@ -328,7 +344,7 @@
try {
HttpServletResponse response = ServletActionContext.getResponse();
-
+ response.setStatus(status);
PrintWriter writer = response.getWriter();
// Create a transformer for the stylesheet.
was:Allow the XSLT Result type to return a custom HTTP status code.
> Allow XSLT result types to set response code
> --------------------------------------------
>
> Key: WW-3999
> URL: https://issues.apache.org/jira/browse/WW-3999
> Project: Struts 2
> Issue Type: Improvement
> Components: Other
> Affects Versions: 2.3.12
> Reporter: Steve Wolke
> Priority: Minor
> Fix For: 2.3.13
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Allow the XSLT Result type to return a custom HTTP status code.
> not sure where to put files so here is a diff of suggested changes:
> @@ -229,6 +229,9 @@
> /** Indicates the location of the xsl template. */
> private String stylesheetLocation;
>
> + /** Indicates the status to return in the response*/
> + private int status=200;
> +
> /** Indicates the property name patterns which should be exposed to the
> xml. */
> private String matchingPattern;
>
> @@ -271,10 +274,23 @@
> return stylesheetLocation;
> }
>
> + public String getStatus() {
> + return String.valueOf(status);
> + }
> +
> + public void setStatus(String status) {
> + try{
> + this.status = Integer.valueOf(status);
> + }catch(NumberFormatException e){
> + throw new IllegalArgumentException("Status value not number" +
> e.getMessage());
> + }
> + }
> +
> public String getExposedValue() {
> return exposedValue;
> }
>
> +
> public void setExposedValue(String exposedValue) {
> this.exposedValue = exposedValue;
> }
> @@ -328,7 +344,7 @@
>
> try {
> HttpServletResponse response =
> ServletActionContext.getResponse();
> -
> + response.setStatus(status);
> PrintWriter writer = response.getWriter();
>
> // Create a transformer for the stylesheet.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira