();
/**
@@ -168,7 +171,10 @@ public class MappingJackson2JsonView extends AbstractJackson2View {
* The parameter names configured by default are "jsonp" and "callback".
* @since 4.1
* @see JSONP Wikipedia article
+ * @deprecated Will be removed as of Spring Framework 5.1, use
+ * CORS instead.
*/
+ @Deprecated
public void setJsonpParameterNames(Set jsonpParameterNames) {
this.jsonpParameterNames = jsonpParameterNames;
}
@@ -198,7 +204,10 @@ public class MappingJackson2JsonView extends AbstractJackson2View {
* Invalid parameter values are ignored.
* @param value the query param value, never {@code null}
* @since 4.1.8
+ * @deprecated Will be removed as of Spring Framework 5.1, use
+ * CORS instead.
*/
+ @Deprecated
protected boolean isValidJsonpQueryParam(String value) {
return CALLBACK_PARAM_PATTERN.matcher(value).matches();
}
diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/json/MappingJackson2JsonViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/json/MappingJackson2JsonViewTests.java
index 4e062b2a005..b6346ec96ce 100644
--- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/json/MappingJackson2JsonViewTests.java
+++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/json/MappingJackson2JsonViewTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2015 the original author or authors.
+ * Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,11 @@
package org.springframework.web.servlet.view.json;
import java.io.IOException;
+import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
@@ -324,11 +326,19 @@ public class MappingJackson2JsonViewTests {
@Test
public void renderWithJsonp() throws Exception {
+ testJsonp("jsonp", "callback", false);
+ testJsonp("jsonp", "_callback", false);
+ testJsonp("jsonp", "_Call.bAcK", false);
+ testJsonp("jsonp", "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.", false);
+ testJsonp("jsonp", "