You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Julian Sinai (JIRA)" <ji...@apache.org> on 2007/05/10 23:50:15 UTC

[jira] Created: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
------------------------------------------------------------------------------------------------------------

                 Key: WICKET-554
                 URL: https://issues.apache.org/jira/browse/WICKET-554
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 1.2.6
            Reporter: Julian Sinai
             Fix For: 1.2.7, 1.3, 2.0
         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff

If you mount a package e.g.

    	mount("/pages", PackageName.forClass(Index.class));

You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":

WicketMessage: Unable to load class with name: wicket.quickstart.

Root cause:

wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
...

This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:

    	mount("/pages", Index.class);

This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.


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


[jira] Updated: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

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

Julian Sinai updated WICKET-554:
--------------------------------

    Attachment: WebApplication.diff
                PackageRequestTargetUrlCodingStrategy.diff

Patches attached for WebApplication.java and PackageRequestTargetUrlCodingStrategy.java.

> Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-554
>                 URL: https://issues.apache.org/jira/browse/WICKET-554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.6
>            Reporter: Julian Sinai
>             Fix For: 1.2.7, 1.3, 2.0
>
>         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff
>
>
> If you mount a package e.g.
>     	mount("/pages", PackageName.forClass(Index.class));
> You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":
> WicketMessage: Unable to load class with name: wicket.quickstart.
> Root cause:
> wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
> at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
> at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
> ...
> This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:
>     	mount("/pages", Index.class);
> This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.

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


[jira] Assigned: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

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

Alastair Maw reassigned WICKET-554:
-----------------------------------

    Assignee: Alastair Maw

> Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-554
>                 URL: https://issues.apache.org/jira/browse/WICKET-554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.6, 1.3
>            Reporter: Julian Sinai
>         Assigned To: Alastair Maw
>             Fix For: 1.3
>
>         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff
>
>
> If you mount a package e.g.
>     	mount("/pages", PackageName.forClass(Index.class));
> You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":
> WicketMessage: Unable to load class with name: wicket.quickstart.
> Root cause:
> wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
> at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
> at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
> ...
> This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:
>     	mount("/pages", Index.class);
> This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.

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


[jira] Updated: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

Posted by "Jean-Baptiste Quenot (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Quenot updated WICKET-554:
----------------------------------------

    Fix Version/s:     (was: 1.2.7)

Not for 1.2.x, which is a bugfix branch

> Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-554
>                 URL: https://issues.apache.org/jira/browse/WICKET-554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.6
>            Reporter: Julian Sinai
>             Fix For: 1.3, 2.0
>
>         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff
>
>
> If you mount a package e.g.
>     	mount("/pages", PackageName.forClass(Index.class));
> You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":
> WicketMessage: Unable to load class with name: wicket.quickstart.
> Root cause:
> wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
> at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
> at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
> ...
> This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:
>     	mount("/pages", Index.class);
> This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.

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


[jira] Updated: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

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

Alastair Maw updated WICKET-554:
--------------------------------

        Fix Version/s:     (was: 2.0)
             Priority: Minor  (was: Major)
    Affects Version/s: 1.3

> Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-554
>                 URL: https://issues.apache.org/jira/browse/WICKET-554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.6, 1.3
>            Reporter: Julian Sinai
>         Assigned To: Alastair Maw
>            Priority: Minor
>             Fix For: 1.3
>
>         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff
>
>
> If you mount a package e.g.
>     	mount("/pages", PackageName.forClass(Index.class));
> You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":
> WicketMessage: Unable to load class with name: wicket.quickstart.
> Root cause:
> wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
> at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
> at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
> ...
> This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:
>     	mount("/pages", Index.class);
> This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.

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


[jira] Commented: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12497870 ] 

Alastair Maw commented on WICKET-554:
-------------------------------------

I've had a think about this and I'm not convinced this is the way to go, for the following reasons:
 - You're leaving the old mount method there, which will still lead to runtime exceptions.
 - We're increasing the number of methods in WebApplication, providing two that do very nearly the same thing, and thus confusing the users.
 - You won't be able to pick a default page if you want to mount a package without any pages in it, so you can use pages in the subpackages.

I've changed the code so that it will 404 you instead.

Note that if you want to roll your own, you're welcome to write an IRequestTargetUrlCodingStrategy implementation within your project and use that directly with WebApplication#mount(IRequestTargetUrlCodingStrategy). We're not going to include your particular use case in the core API, though - it's a bit too special-case.

> Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-554
>                 URL: https://issues.apache.org/jira/browse/WICKET-554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.6, 1.3.0
>            Reporter: Julian Sinai
>         Assigned To: Alastair Maw
>            Priority: Minor
>             Fix For: 1.3.0
>
>         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff
>
>
> If you mount a package e.g.
>     	mount("/pages", PackageName.forClass(Index.class));
> You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":
> WicketMessage: Unable to load class with name: wicket.quickstart.
> Root cause:
> wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
> at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
> at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
> ...
> This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:
>     	mount("/pages", Index.class);
> This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.

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


[jira] Resolved: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

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

Alastair Maw resolved WICKET-554.
---------------------------------

    Resolution: Won't Fix

Have sort-of fixed by 404ing instead (r540591). See previous comment for details.

> Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-554
>                 URL: https://issues.apache.org/jira/browse/WICKET-554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.6, 1.3.0
>            Reporter: Julian Sinai
>         Assigned To: Alastair Maw
>            Priority: Minor
>             Fix For: 1.3.0
>
>         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff
>
>
> If you mount a package e.g.
>     	mount("/pages", PackageName.forClass(Index.class));
> You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":
> WicketMessage: Unable to load class with name: wicket.quickstart.
> Root cause:
> wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
> at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
> at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
> ...
> This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:
>     	mount("/pages", Index.class);
> This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.

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


[jira] Commented: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495434 ] 

Alastair Maw commented on WICKET-554:
-------------------------------------

IMHO, we should call this mountPackage() not just mount(), as it will make things more obvious.
I can see the use-case - users stripping things off URLs in a curious way shouldn't cause RuntimeExceptions.

> Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-554
>                 URL: https://issues.apache.org/jira/browse/WICKET-554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.6, 1.3
>            Reporter: Julian Sinai
>             Fix For: 1.3
>
>         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff
>
>
> If you mount a package e.g.
>     	mount("/pages", PackageName.forClass(Index.class));
> You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":
> WicketMessage: Unable to load class with name: wicket.quickstart.
> Root cause:
> wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
> at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
> at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
> ...
> This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:
>     	mount("/pages", Index.class);
> This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.

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


[jira] Commented: (WICKET-554) Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName)

Posted by "Julian Sinai (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495713 ] 

Julian Sinai commented on WICKET-554:
-------------------------------------

mountPackage() is fine with me.

> Provide a default page when mounting a URL using WebApplication.mount(String path, PackageName packageName) 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-554
>                 URL: https://issues.apache.org/jira/browse/WICKET-554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.6, 1.3.0
>            Reporter: Julian Sinai
>         Assigned To: Alastair Maw
>            Priority: Minor
>             Fix For: 1.3.0
>
>         Attachments: PackageRequestTargetUrlCodingStrategy.diff, WebApplication.diff
>
>
> If you mount a package e.g.
>     	mount("/pages", PackageName.forClass(Index.class));
> You will run into a RuntimeException if you type in a url like "http://localhost:8081/quickstart/app/pages":
> WicketMessage: Unable to load class with name: wicket.quickstart.
> Root cause:
> wicket.WicketRuntimeException: Unable to load class with name: wicket.quickstart.
> at wicket.application.DefaultClassResolver.resolveClass(DefaultClassResolver.java:66)
> at wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:82)
> ...
> This is wrong. The user should never see a RuntimeException no matter what they type in. So I've patched WebApplication and PackageRequestTargetUrlCodingStrategy to accept a mount of the form:
>     	mount("/pages", Index.class);
> This mounts the pages in the package just like PackageRequestTargetUrlCodingStrategy, but also uses Index.class as the default page if the user types in a URL that doesn't specify a page.

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