You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by GitBox <gi...@apache.org> on 2020/05/29 15:15:58 UTC

[GitHub] [wicket] theigl opened a new pull request #436: WICKET-6794 Performance improvements for UrlEncoder and UrlDecoder

theigl opened a new pull request #436:
URL: https://github.com/apache/wicket/pull/436


   This PR rewrites `UrlEncoder` and `UrlDecoder` based on Spring's `UriUtils` instead of the `java.net.URLEncoder` and `java.net.URLDecoder`.
   
   The new implementation is 30-500% faster depending on the use case. The biggest improvement is with encoding URLs that do not contain any character that requires escaping.
   
   For benchmark results, see the JIRA ticket.
   
   See https://issues.apache.org/jira/browse/WICKET-6794


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [wicket] martin-g commented on a change in pull request #436: WICKET-6794 Performance improvements for UrlEncoder and UrlDecoder

Posted by GitBox <gi...@apache.org>.
martin-g commented on a change in pull request #436:
URL: https://github.com/apache/wicket/pull/436#discussion_r433114445



##########
File path: wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlDecoder.java
##########
@@ -16,25 +16,25 @@
  */
 package org.apache.wicket.util.encoding;
 
+import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
 import java.nio.charset.UnsupportedCharsetException;
 
 import org.apache.wicket.util.lang.Args;
-import org.apache.wicket.util.string.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Adapted from java.net.URLDecoder, but defines instances for query string decoding versus URL path
+ * Adapted from Spring's UriUtils, but defines instances for query string decoding versus URL path
  * component decoding.
  * <p/>
  * The difference is important because a space is encoded as a + in a query string, but this is a
  * valid value in a path component (and is therefore not decode back to a space).
- * 
- * @author Doug Donohoe
- * @see java.net.URLDecoder
+ *
+ * @author Thomas Heigl
+ * @see org.springframework.web.util.UriUtils

Review comment:
       I think this breaks the Javadoc build because wicket-util does not depend on spring-web.
   Please the first line of the javadoc with something like "Adapted from Spring Framework's UrilUtils class"




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [wicket] theigl commented on pull request #436: WICKET-6794 Performance improvements for UrlEncoder and UrlDecoder

Posted by GitBox <gi...@apache.org>.
theigl commented on pull request #436:
URL: https://github.com/apache/wicket/pull/436#issuecomment-640523672


   Thanks @svenmeier and @martin-g!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [wicket] theigl commented on a change in pull request #436: WICKET-6794 Performance improvements for UrlEncoder and UrlDecoder

Posted by GitBox <gi...@apache.org>.
theigl commented on a change in pull request #436:
URL: https://github.com/apache/wicket/pull/436#discussion_r433134378



##########
File path: wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlDecoder.java
##########
@@ -16,25 +16,25 @@
  */
 package org.apache.wicket.util.encoding;
 
+import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
 import java.nio.charset.UnsupportedCharsetException;
 
 import org.apache.wicket.util.lang.Args;
-import org.apache.wicket.util.string.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Adapted from java.net.URLDecoder, but defines instances for query string decoding versus URL path
+ * Adapted from Spring's UriUtils, but defines instances for query string decoding versus URL path
  * component decoding.
  * <p/>
  * The difference is important because a space is encoded as a + in a query string, but this is a
  * valid value in a path component (and is therefore not decode back to a space).
- * 
- * @author Doug Donohoe
- * @see java.net.URLDecoder
+ *
+ * @author Thomas Heigl
+ * @see org.springframework.web.util.UriUtils

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [wicket] martin-g commented on a change in pull request #436: WICKET-6794 Performance improvements for UrlEncoder and UrlDecoder

Posted by GitBox <gi...@apache.org>.
martin-g commented on a change in pull request #436:
URL: https://github.com/apache/wicket/pull/436#discussion_r433114761



##########
File path: wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlEncoder.java
##########
@@ -16,58 +16,140 @@
  */
 package org.apache.wicket.util.encoding;
 
-import java.io.CharArrayWriter;
+import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
 import java.nio.charset.UnsupportedCharsetException;
-import java.util.BitSet;
 
 import org.apache.wicket.util.lang.Args;
 
 /**
- * Adapted from java.net.URLEncoder, but defines instances for query string encoding versus URL path
+ * Adapted from Spring's UriUtils, but defines instances for query string encoding versus URL path

Review comment:
       Same as above




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [wicket] theigl merged pull request #436: WICKET-6794 Performance improvements for UrlEncoder and UrlDecoder

Posted by GitBox <gi...@apache.org>.
theigl merged pull request #436:
URL: https://github.com/apache/wicket/pull/436


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [wicket] theigl commented on pull request #436: WICKET-6794 Performance improvements for UrlEncoder and UrlDecoder

Posted by GitBox <gi...@apache.org>.
theigl commented on pull request #436:
URL: https://github.com/apache/wicket/pull/436#issuecomment-640487566


   Can somebody else please take a look at this as well? This change is fully covered by tests, but I'd really like one more approval before merging this.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org