You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2021/07/20 13:47:14 UTC

[wicket] branch master updated: WICKET-6906 removed further deprecations

This is an automated email from the ASF dual-hosted git repository.

svenmeier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new e43285a  WICKET-6906 removed further deprecations
e43285a is described below

commit e43285aaa08f63e85bc60834342924572c1cb7dc
Author: Sven Meier <sv...@apache.org>
AuthorDate: Tue Jul 20 13:11:51 2021 +0200

    WICKET-6906 removed further deprecations
---
 .../apache/wicket/core/util/string/CssUtils.java   |  67 -------
 .../wicket/core/util/string/JavaScriptUtils.java   | 194 ---------------------
 .../ajax/markup/html/modal/ModalDialog.java        |   3 -
 .../java/org/apache/wicket/util/crypt/ICrypt.java  |   4 -
 .../contrib/velocity/VelocityJavaScriptPage.java   |  11 +-
 5 files changed, 8 insertions(+), 271 deletions(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java b/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java
index 7a69547..99d627c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java
@@ -56,25 +56,6 @@ public final class CssUtils
 
 	/**
 	 * Write the simple text to the response object surrounded by a style tag.
-	 *
-	 * @param response
-	 *            The HTTP: response
-	 * @param text
-	 *            The text to added in between the style tags
-	 * @param id
-	 *            Unique identifier of element
-	 * @deprecated please use {@link #writeInlineStyle(Response, CharSequence, AttributeMap)} instead
-	 */
-	@Deprecated
-	public static void writeCss(final Response response, final CharSequence text, String id)
-	{
-		writeOpenTag(response, id);
-		response.write(text);
-		writeCloseTag(response);
-	}
-
-	/**
-	 * Write the simple text to the response object surrounded by a style tag.
 	 * In most cases the text simply an inline CSS.
 	 *
 	 * @param response
@@ -133,54 +114,6 @@ public final class CssUtils
 	 * Writes a reference to a css file in the response object
 	 *
 	 * @param response
-	 *            the response to write to
-	 * @param url
-	 *            the url of the css reference
-	 * @param media
-	 *            the CSS media
-	 * @param markupId
-	 *            the markupId
-	 * @deprecated please use {@link #writeLink(Response, AttributeMap)} instead
-	 */
-	@Deprecated
-	public static void writeLinkUrl(final Response response, final CharSequence url,
-		final CharSequence media, final String markupId)
-	{
-		CssUtils.writeLinkUrl(response, url, media, markupId, null);
-	}
-
-	/**
-	 * Writes a reference to a css file in the response object
-	 *
-	 * @param response
-	 *            the response to write to
-	 * @param url
-	 *            the url of the css reference
-	 * @param media
-	 *            the CSS media
-	 * @param markupId
-	 *            the markupId
-	 * @param rel
-	 *            the rel attribute
-	 * @deprecated please use {@link #writeLink(Response, AttributeMap)} instead
-	 */
-	@Deprecated
-	public static void writeLinkUrl(final Response response, final CharSequence url,
-		final CharSequence media, final String markupId, final String rel)
-	{
-		AttributeMap attributes = new AttributeMap();
-		attributes.putAttribute(ATTR_LINK_REL, Strings.isEmpty(rel) ? "stylesheet" : rel);
-		attributes.putAttribute(ATTR_TYPE, "text/css");
-		attributes.putAttribute(ATTR_LINK_HREF, url);
-		attributes.putAttribute(ATTR_LINK_MEDIA, media.toString());
-		attributes.putAttribute(ATTR_ID, markupId);
-		writeLink(response, attributes);
-	}
-
-	/**
-	 * Writes a reference to a css file in the response object
-	 *
-	 * @param response
 	 * 		the response to write to
 	 * @param attributes
 	 * 		Attributes map
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java b/wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java
index 4038fe5..bd8629c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java
@@ -55,35 +55,6 @@ public class JavaScriptUtils
 	public static final String ATTR_CROSS_ORIGIN = "crossOrigin";
 	public static final String ATTR_INTEGRITY = "integrity";
 
-	/** The response object */
-	private final Response response;
-
-	/**
-	 * Construct.
-	 * 
-	 * @param response
-	 *            The response object
-	 * @param id
-	 */
-	public JavaScriptUtils(final Response response, String id)
-	{
-		this.response = response;
-		writeOpenTag(response, id);
-	}
-
-	/**
-	 * Constructor without id for backward compatibility
-	 * 
-	 * @param response
-	 *            The response object
-	 */
-	public JavaScriptUtils(final Response response)
-	{
-		this.response = response;
-		writeOpenTag(response);
-	}
-
-
 	/**
 	 * Escape single and double quotes so that they can be part of e.g. an alert call.
 	 * 
@@ -106,82 +77,6 @@ public class JavaScriptUtils
 
 	/**
 	 * Write a reference to a javascript file to the response object
-	 * 
-	 * @param response
-	 *            The HTTP response
-	 * @param url
-	 *            The javascript file URL
-	 * @param id
-	 *            Unique identifier of element
-	 * @deprecated please use {@link #writeScript(Response, AttributeMap)} instead
-	 */
-	@Deprecated
-	public static void writeJavaScriptUrl(final Response response, final CharSequence url,
-		final String id)
-	{
-		writeJavaScriptUrl(response, url, id, false, null, false);
-	}
-
-	/**
-	 * Write a reference to a javascript file to the response object
-	 *
-	 * @param response
-	 *            The HTTP response
-	 * @param url
-	 *            The javascript file URL
-	 * @param id
-	 *            Unique identifier of element
-	 * @param defer
-	 *            specifies that the execution of a script should be deferred (delayed) until after
-	 *            the page has been loaded.
-	 * @param charset
-	 *            a non null value specifies the charset attribute of the script tag
-	 * @deprecated please use {@link #writeScript(Response, AttributeMap)} instead
-	 */
-	@Deprecated
-	public static void writeJavaScriptUrl(final Response response, final CharSequence url,
-	                                      final String id, boolean defer, String charset)
-	{
-		writeJavaScriptUrl(response, url, id, defer, charset, false);
-	}
-
-	/**
-	 * Write a reference to a javascript file to the response object
-	 * 
-	 * @param response
-	 *            The HTTP response
-	 * @param url
-	 *            The javascript file URL
-	 * @param id
-	 *            Unique identifier of element
-	 * @param defer
-	 *            specifies that the execution of a script should be deferred (delayed) until after
-	 *            the page has been loaded.
-	 * @param charset
-	 *            a non null value specifies the charset attribute of the script tag
-	 * @param async
-	 *            specifies that the script can be loaded asynchronously by the browser
-	 * @deprecated please use {@link #writeScript(Response, AttributeMap)} instead
-	 */
-	@Deprecated
-	public static void writeJavaScriptUrl(final Response response, final CharSequence url,
-		final String id, boolean defer, String charset, boolean async)
-	{
-		AttributeMap attributes = new AttributeMap();
-		// XXX JS mimetype can be omitted (also see below)
-		attributes.putAttribute(ATTR_TYPE, "text/javascript");
-		attributes.putAttribute(ATTR_SCRIPT_SRC, url);
-		attributes.putAttribute(ATTR_ID, id);
-		attributes.putAttribute(ATTR_SCRIPT_DEFER, defer);
-		attributes.putAttribute(ATTR_SCRIPT_ASYNC, async);
-		// FIXME charset attr is deprecated
-		// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#Deprecated_attributes
-		attributes.putAttribute("charset", charset);
-		writeScript(response, attributes);
-	}
-
-	/**
-	 * Write a reference to a javascript file to the response object
 	 *
 	 * @param response
 	 *            The HTTP response
@@ -197,39 +92,6 @@ public class JavaScriptUtils
 	}
 
 	/**
-	 * Write a reference to a javascript file to the response object
-	 * 
-	 * @param response
-	 *            The HTTP response
-	 * @param url
-	 *            The javascript file URL
-	 * @deprecated please use {@link #writeScript(Response, AttributeMap)} instead
-	 */
-	@Deprecated
-	public static void writeJavaScriptUrl(final Response response, final CharSequence url)
-	{
-		writeJavaScriptUrl(response, url, null);
-	}
-
-	/**
-	 * Write the simple text to the response object surrounded by a script tag.
-	 * 
-	 * @param response
-	 *            The HTTP: response
-	 * @param text
-	 *            The text to added in between the script tags
-	 * @param id
-	 *            Unique identifier of element
-	 * @deprecated please use {@link #writeInlineScript(Response, CharSequence, AttributeMap)} instead
-	 */
-	public static void writeJavaScript(final Response response, final CharSequence text, String id)
-	{
-		writeOpenTag(response, id);
-		response.write(Strings.replaceAll(text, "</", "<\\/"));
-		writeCloseTag(response);
-	}
-
-	/**
 	 * Write the simple text to the response object surrounded by a script tag.
 	 *
 	 * @param response
@@ -262,21 +124,6 @@ public class JavaScriptUtils
 	}
 
 	/**
-	 * 
-	 * @param response
-	 * @param id
-	 * @deprecated please use {@link #writeOpenTag(Response, AttributeMap)}
-	 */
-	@Deprecated
-	public static void writeOpenTag(final Response response, String id)
-	{
-		AttributeMap attributes = new AttributeMap();
-		attributes.putAttribute(ATTR_TYPE, "text/javascript");
-		attributes.putAttribute(ATTR_ID, id);
-		writeOpenTag(response, attributes);
-	}
-
-	/**
 	 * Write open script tag for inline script.
 	 * Content is prefixed with {@link #SCRIPT_CONTENT_PREFIX}.
 	 *
@@ -294,19 +141,6 @@ public class JavaScriptUtils
 	}
 
 	/**
-	 * 
-	 * @param response
-	 * @deprecated please use {@link #writeOpenTag(Response, AttributeMap)}
-	 */
-	@Deprecated
-	public static void writeOpenTag(final Response response)
-	{
-		AttributeMap attributes = new AttributeMap();
-		attributes.putAttribute(ATTR_TYPE, "text/javascript");
-		writeOpenTag(response, attributes);
-	}
-
-	/**
 	 * Write close script tag for inline script. The close tag is prefixed with {@link #SCRIPT_CONTENT_SUFFIX}
 	 *
 	 * @param response
@@ -317,32 +151,4 @@ public class JavaScriptUtils
 		response.write(SCRIPT_CONTENT_SUFFIX);
 		response.write("</script>\n");
 	}
-
-	/**
-	 * @see Response#write(java.lang.CharSequence)
-	 * @param script
-	 */
-	public void write(final CharSequence script)
-	{
-		response.write(script);
-	}
-
-	/**
-	 * @see Response#write(CharSequence)
-	 * @param script
-	 */
-	public void println(final CharSequence script)
-	{
-		response.write(script);
-	}
-
-	/**
-	 * Write the inline script close tag to the response. The response output stream remains open.
-	 * Calls {@link #writeCloseTag(Response)} internally.
-	 * The close tag is prefixed with {@link #SCRIPT_CONTENT_SUFFIX}.
-	 */
-	public void close()
-	{
-		writeCloseTag(response);
-	}	
 }
\ No newline at end of file
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java
index 8fa02b4..c450a0a 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java
@@ -31,9 +31,6 @@ import org.apache.wicket.markup.html.panel.Panel;
  * Presents a modal dialog to the user. See {@link #open(Component, AjaxRequestTarget)} and
  * {@link #close(AjaxRequestTarget)} methods.
  * <p>
- * Unlike the deprecated {@link ModalWindow} this component offers no UI controls, you should use
- * any components as you need in the content of this dialog.
- * <p>
  * Note: This component does not provide any styling by itself, so you have can add a
  * {@link DefaultTheme} to this component if aren't styling these CSS classes by yourself:
  * <dl>
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/crypt/ICrypt.java b/wicket-util/src/main/java/org/apache/wicket/util/crypt/ICrypt.java
index 079d257..5e8e517 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/crypt/ICrypt.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/crypt/ICrypt.java
@@ -27,10 +27,6 @@ package org.apache.wicket.util.crypt;
  * implementation of the encryption algorithm may change between releases. As such, this interface
  * and its implementations are not intended and should not be used as an encryption facility for
  * persistent values.
- * <p>
- * As of Wicket 1.2 the methods encrypt and decrypt are deprecated. Consider changing your
- * persistent encryption strategy to be based on a one-way encryption such as a SHA1 hash, not
- * depending on Wicket classes.
  * 
  * @author Juergen Donnerstag
  */
diff --git a/wicket-velocity/src/test/java/org/apache/wicket/contrib/velocity/VelocityJavaScriptPage.java b/wicket-velocity/src/test/java/org/apache/wicket/contrib/velocity/VelocityJavaScriptPage.java
index 0b7dbd6..0aa6339 100644
--- a/wicket-velocity/src/test/java/org/apache/wicket/contrib/velocity/VelocityJavaScriptPage.java
+++ b/wicket-velocity/src/test/java/org/apache/wicket/contrib/velocity/VelocityJavaScriptPage.java
@@ -20,6 +20,7 @@ import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.util.collections.MiniMap;
 import org.apache.wicket.util.lang.Packages;
+import org.apache.wicket.util.value.AttributeMap;
 import org.apache.wicket.core.util.string.JavaScriptUtils;
 import org.apache.wicket.velocity.VelocityJavaScriptContributor;
 
@@ -29,6 +30,9 @@ import org.apache.wicket.velocity.VelocityJavaScriptContributor;
 public class VelocityJavaScriptPage extends WebPage
 {
 	private static final long serialVersionUID = 1L;
+	
+	private static final String ID = "000001";
+	
 	static final String MSG1 = "Stoopid test 1";
 
 	/**
@@ -38,9 +42,10 @@ public class VelocityJavaScriptPage extends WebPage
 	{
 		String templateName = Packages.absolutePath(getClass(), "testTemplate.vm");
 
-		String id = "000001";
 		String javascript = "msg1: Stoopid test 1\nmsg2: Stooopid test 2";
-		JavaScriptUtils.writeJavaScript(getResponse(), javascript, id);
+		AttributeMap attributes = new AttributeMap();
+		attributes.put("id", ID);
+		JavaScriptUtils.writeInlineScript(getResponse(), javascript, attributes);
 
 		IModel<MiniMap<String, Object>> model = new IModel<>()
 		{
@@ -57,6 +62,6 @@ public class VelocityJavaScriptPage extends WebPage
 
 		};
 
-		add(new VelocityJavaScriptContributor(templateName, model, id));
+		add(new VelocityJavaScriptContributor(templateName, model, ID));
 	}
 }