mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
increased visibilty of methods and constants for better extensibility
This commit is contained in:
@@ -44,12 +44,12 @@ public class JSONActionRedirectResult extends ServletActionRedirectResult {
|
||||
* @return true if a JSON response shall be generated, false if a redirect
|
||||
* shall be sent.
|
||||
*/
|
||||
private boolean sendJsonInsteadOfRedirect() {
|
||||
protected boolean sendJsonInsteadOfRedirect() {
|
||||
HttpServletRequest request = ServletActionContext.getRequest();
|
||||
return isJsonEnabled(request) && !isValidateOnly(request);
|
||||
}
|
||||
|
||||
private void printJson(HttpServletResponse response, String finalLocation) throws IOException {
|
||||
protected void printJson(HttpServletResponse response, String finalLocation) throws IOException {
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.setContentType("application/json");
|
||||
response.setHeader("Location", finalLocation);
|
||||
@@ -60,11 +60,11 @@ public class JSONActionRedirectResult extends ServletActionRedirectResult {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
private boolean isJsonEnabled(HttpServletRequest request) {
|
||||
protected boolean isJsonEnabled(HttpServletRequest request) {
|
||||
return "true".equals(request.getParameter(JSONValidationInterceptor.VALIDATE_JSON_PARAM));
|
||||
}
|
||||
|
||||
private boolean isValidateOnly(HttpServletRequest request) {
|
||||
protected boolean isValidateOnly(HttpServletRequest request) {
|
||||
return "true".equals(request.getParameter(JSONValidationInterceptor.VALIDATE_ONLY_PARAM));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,11 +74,11 @@ public class JSONValidationInterceptor extends MethodFilterInterceptor {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(JSONValidationInterceptor.class);
|
||||
|
||||
static final String VALIDATE_ONLY_PARAM = "struts.validateOnly";
|
||||
static final String VALIDATE_JSON_PARAM = "struts.enableJSONValidation";
|
||||
private static final String NO_ENCODING_SET_PARAM = "struts.JSONValidation.no.encoding";
|
||||
public static final String VALIDATE_ONLY_PARAM = "struts.validateOnly";
|
||||
public static final String VALIDATE_JSON_PARAM = "struts.enableJSONValidation";
|
||||
public static final String NO_ENCODING_SET_PARAM = "struts.JSONValidation.no.encoding";
|
||||
|
||||
private static final String DEFAULT_ENCODING = "UTF-8";
|
||||
public static final String DEFAULT_ENCODING = "UTF-8";
|
||||
|
||||
private int validationFailedStatus = -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user