You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2009/12/02 19:49:21 UTC

[jira] Created: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Map test in JCR Resource Resolver web console plugin is not reflecting all cases
--------------------------------------------------------------------------------

                 Key: SLING-1219
                 URL: https://issues.apache.org/jira/browse/SLING-1219
             Project: Sling
          Issue Type: Improvement
          Components: JCR
    Affects Versions: JCR Resource 2.0.6
            Reporter: Alexander Klimetschek
            Priority: Minor


The "Map" test in the web console plugin of the JCR resource resolver is actually doing a

 ResourceResolver.map(request, path)

with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.

Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.

For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785883#action_12785883 ] 

Alexander Klimetschek commented on SLING-1219:
----------------------------------------------

> If you provide an absolute URL -- e.g. http://localhost/contetn/a/page.html, the schema/host part of the URL
> would be used to setup a HttpRequestObject with the given schema, host, and port information.

Yes, that works, but if you test the mapping you will only come up with a path, naturally. Should maybe noted/documented.

> The idea is that if a request stays on the same target, the scheme/host prefix can be removed.

Exactly this difference will get unnoticed: in the current implementation, if you just use a path like "/content/a/page", it will use a dummy request for the map method that returns null for scheme and host (could be seen as a minor bug, thus I fixed this in the patch as well). As such null values will probably be never used in the /etc/map config, but rather a config with the server the webconsole is accessed as well (eg. localhost for developing), the scheme/host prefix cutting will never be applied in this case. And thus one might not get this important difference.

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek reopened SLING-1219:
------------------------------------------


Reopening because the check for using the map(String) variant is wrong.

Instead of using "getRemoteHost() == null" (always != null) it must check "getServerName() == null", which is the important part that is set when the user enters an absolute URI in the test field as opposed to just a path.

(Reopening as 2.0.8 isn't released yet)

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: JCR Resource 2.0.8
>
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785894#action_12785894 ] 

Felix Meschberger commented on SLING-1219:
------------------------------------------

> in the current implementation, if you just use a path like "/content/a/page", it will use a dummy request for the map

Ahh, sorry. Missed that one. This looks like not implemented as intended ....

How about better description and this :

Index: src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverWebConsolePlugin.java
===================================================================
--- src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverWebConsolePlugin.java	(revision 885411)
+++ src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverWebConsolePlugin.java	(working copy)
@@ -180,7 +180,11 @@
                 // map or resolve as instructed
                 Object result;
                 if ("Map".equals(request.getParameter(ATTR_SUBMIT))) {
-                    result = resolver.map(helper, helper.getPathInfo());
+                    if (helper.getRemoteHost() == null) {
+                        result = resolver.map(helper.getPathInfo());
+                    } else {
+                        result = resolver.map(helper, helper.getPathInfo());
+                    }
                 } else {
                     result = resolver.resolve(helper, helper.getPathInfo());
                 }


> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek updated SLING-1219:
-----------------------------------------

    Attachment: SLING-1219.patch

Patch that adds another map button, so that there are now both "Map with request" and "Map" buttons available.

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785902#action_12785902 ] 

Felix Meschberger commented on SLING-1219:
------------------------------------------

Thanks, ok, so I will fix the description and apply my mini-patch.

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>            Priority: Minor
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-1219.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: JCR Resource 2.0.8

Applied this in Rev. 887169

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: JCR Resource 2.0.8
>
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek updated SLING-1219:
-----------------------------------------

    Attachment: SLING-1219-second.patch

Patch replacing getRemoteHost() with getServerName().

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: JCR Resource 2.0.8
>
>         Attachments: SLING-1219-second.patch, SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785898#action_12785898 ] 

Alexander Klimetschek commented on SLING-1219:
----------------------------------------------

> How about better description and this : ...

That's ok. For the description, maybe this: "To simulate a map call that takes the current request into account, provide a full URL whose scheme/host/port prefix will then be used as the request information. The path passed to map will always be the path part of the URL". Or similar ;-)

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-1219:
----------------------------------------

    Assignee: Felix Meschberger

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>            Priority: Minor
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785837#action_12785837 ] 

Felix Meschberger commented on SLING-1219:
------------------------------------------

Actually, implementation wise the JcrResourceResolver.map(String) method is exactly the same as calling JcrResourceResovler.map(null, String).

With respect to the web console plugin supporting the test you have full control of what method you call: If you provide a path -- e.g. /content/a/page.html -- then HttpServletRequest arguement to the map method would in fact be null. If you provide an absolute URL -- e.g. http://localhost/contetn/a/page.html, the schema/host part of the URL would be used to setup a HttpRequestObject with the given schema, host, and port information.

The main difference of calling map(HttpServletRequest, String) with null or non-null is the final decision to apply whether to leave scheme/host prefix after mapping or to remove it (and also to select amongst multiple candidates for the same mapping). The idea is that if a request stays on the same target, the scheme/host prefix can be removed.

So I wonder, whether we really need this second button or whether it is merely a question of better describing what is going on.

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>         Attachments: SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SLING-1219) Map test in JCR Resource Resolver web console plugin is not reflecting all cases

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-1219.
--------------------------------------

    Resolution: Fixed

Thanks for providing the patch.
I have applied it in Rev. 982946.

> Map test in JCR Resource Resolver web console plugin is not reflecting all cases
> --------------------------------------------------------------------------------
>
>                 Key: SLING-1219
>                 URL: https://issues.apache.org/jira/browse/SLING-1219
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: JCR Resource 2.0.8
>
>         Attachments: SLING-1219-second.patch, SLING-1219.patch
>
>
> The "Map" test in the web console plugin of the JCR resource resolver is actually doing a
>  ResourceResolver.map(request, path)
> with the request being something like "http://null", without even noting that. This is misleading as one would at least expect that the current server is used (ie. how the web console is accessed), eg. http://localhost in most cases. This difference will give different results in many cases, eg. if an internal redirect based on localhost.80 is configured.
> Also, there is a second map() only accepting a path which behaves different in that it will always add the domain prefix if configured.
> For proper testing there should be a way to do all of them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.