You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by klopfdreh <gi...@git.apache.org> on 2017/08/01 05:48:33 UTC

[GitHub] wicket pull request #227: Fixes issue of pushing resources

GitHub user klopfdreh opened a pull request:

    https://github.com/apache/wicket/pull/227

    Fixes issue of pushing resources

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/klopfdreh/wicket push_issue_fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/wicket/pull/227.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #227
    
----
commit 87c8f50f3eee39e89053c0ab6690b8389d2d5714
Author: Tobias Soloschenko <ts...@sapient.com>
Date:   2017-08-01T05:32:47Z

    Fixes issue of pushing resources

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by klopfdreh <gi...@git.apache.org>.
Github user klopfdreh commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131109822
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    +				String contextPath = WebApplication.get().getServletContext().getContextPath();
    +				partialUrl.append(contextPath);
    +				if (!contextPath.equals("/"))
    --- End diff --
    
    Okay, I change it!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by martin-g <gi...@git.apache.org>.
Github user martin-g commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131066750
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    +				String contextPath = WebApplication.get().getServletContext().getContextPath();
    +				partialUrl.append(contextPath);
    +				if (!contextPath.equals("/"))
    --- End diff --
    
    Always prefer constants to be on the left side, to avoid NullPointerExceptions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by solomax <gi...@git.apache.org>.
Github user solomax commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131064919
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    --- End diff --
    
    Maybe StringBuilder should be used here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket issue #227: Fixes issue of pushing resources

Posted by klopfdreh <gi...@git.apache.org>.
Github user klopfdreh commented on the issue:

    https://github.com/apache/wicket/pull/227
  
    Thanks for reviewing! I apply the changes, now! 👍 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by klopfdreh <gi...@git.apache.org>.
Github user klopfdreh commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131109859
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    +				String contextPath = WebApplication.get().getServletContext().getContextPath();
    +				partialUrl.append(contextPath);
    +				if (!contextPath.equals("/"))
    +				{
    +					partialUrl.append("/");
    --- End diff --
    
    Performance, performance, performance. 😆 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by klopfdreh <gi...@git.apache.org>.
Github user klopfdreh commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r130974278
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    --- End diff --
    
    Is someone able to review this and the following lines of code? I dislike the handling about the slashes in the url and to build up the path part that way.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by klopfdreh <gi...@git.apache.org>.
Github user klopfdreh commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131109906
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    +				String contextPath = WebApplication.get().getServletContext().getContextPath();
    +				partialUrl.append(contextPath);
    +				if (!contextPath.equals("/"))
    +				{
    +					partialUrl.append("/");
    +				}
    +				String filterPath = WebApplication.get().getWicketFilter().getFilterPath();
    +				if (filterPath.equals("/"))
    +				{
    +					filterPath = "";
    +				}
    +				else if (filterPath.endsWith("/"))
    +				{
    +					filterPath = filterPath.replaceAll(".$", "");
    --- End diff --
    
    Okay, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket issue #227: Fixes issue of pushing resources

Posted by klopfdreh <gi...@git.apache.org>.
Github user klopfdreh commented on the issue:

    https://github.com/apache/wicket/pull/227
  
    Thanks again @martin-g 😊


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/wicket/pull/227


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by martin-g <gi...@git.apache.org>.
Github user martin-g commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131066799
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    +				String contextPath = WebApplication.get().getServletContext().getContextPath();
    +				partialUrl.append(contextPath);
    +				if (!contextPath.equals("/"))
    +				{
    +					partialUrl.append("/");
    --- End diff --
    
    Append `char` instead.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by martin-g <gi...@git.apache.org>.
Github user martin-g commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131066897
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    +				String contextPath = WebApplication.get().getServletContext().getContextPath();
    +				partialUrl.append(contextPath);
    +				if (!contextPath.equals("/"))
    +				{
    +					partialUrl.append("/");
    +				}
    +				String filterPath = WebApplication.get().getWicketFilter().getFilterPath();
    +				if (filterPath.equals("/"))
    +				{
    +					filterPath = "";
    +				}
    +				else if (filterPath.endsWith("/"))
    +				{
    +					filterPath = filterPath.replaceAll(".$", "");
    --- End diff --
    
    Prefer `Strings.replace()` than Regex based solutions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by martin-g <gi...@git.apache.org>.
Github user martin-g commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131066680
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    --- End diff --
    
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] wicket pull request #227: Fixes issue of pushing resources

Posted by klopfdreh <gi...@git.apache.org>.
Github user klopfdreh commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/227#discussion_r131109718
  
    --- Diff: wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java ---
    @@ -361,7 +366,32 @@ else if (url.toString().startsWith("."))
     					url = url.toString().substring(1);
     				}
     
    -				urls.add(url.toString());
    +				// The context path and the filter have to be applied to the URL, because otherwise
    +				// the resource is not pushed correctly
    +				StringBuffer partialUrl = new StringBuffer();
    --- End diff --
    
    Oh yes! Good catch! I am going to change it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---