...
All Result Types are plugged in via the Result Configuration.
Extending
You can always extend defined result types and implement whatever logic you need. To simplify process of that, you can define you custom ResultBuilder
and use it with connection with custom interface which your Result implements. Check Define dedicated builder to see how to do it.
Struts 2 provides one such extension for you: ParamNameAwareResult
interface when used with StrutsResultBuilder
can limit parameters assigned to the result. So you can simple extend existing result with such a functionality as below:
Code Block | ||||
---|---|---|---|---|
| ||||
public class MyResult extends ServletDispatcherResult implements ParamNameAwareResult {
public boolean acceptParamName(String name, String value) {
return "accept".equals(name);
}
}
|
and then register it and use instead of default dispatcher
result.