you have to do the same mod to Panel and Border, a Page is not the main artefact in wicket - components are, which are often panels or borders. page is merely a top-level container.

all in all i think this is overengineering, and i think you will soon find that going the default way makes it easier to maintain your code as you know where to look for things immediately and it avoids any collisions between components with the same name but in different packages.

just my two cents

-Igor


On 10/6/06, craigdd <[EMAIL PROTECTED]> wrote:

Ok, here is my solution to this problem instead of implementing my own
IResourceStreamLocator.

The overview is create a abstract class that extends WebPage that overrides
the newMarkupResourceStream method. All other pages will extend this object.
This object also forces it's children to implement a method that returns
it's resource path.  Using this resource path it will use the locator to
find the IResourceStream, if not found then it will delegate to it's parent
newMarkupResourceStream method.

public abstract class BasePage extends WebPage {

        /**
         * Subclasses of this path must implement this method to return the path
         * to it's resource file i.e. html file.  This could be the fully qualified
         * name of the page class or an alternative path.
         */
        public abstract String getResourcePath();

        public IResourceStream newMarkupResourceStream(Class containerClass) {

                IResourceStream stream = findClassMapping(containerClass);

                return stream != null
                        ? stream
                        : super.newMarkupResourceStream (containerClass);

        }

        private IResourceStream findClassMapping(Class containerClass) {

                return this.getApplication().getResourceSettings().
                        getResourceStreamLocator().locate(
                                containerClass,
                                this.getResourcePath(),
                                this.getStyle(),
                                this.getLocale(),
                                 this.getMarkupType());

        }

}

An alternative which mich make it a little easier to refactor later is to
have the overridden newMarkupResourceStream method look up a resource path
given the fully qualified page class name in a config file or even a
database table.


igor.vaynberg wrote:
>
> the markup stream is resolved in
> MarkupContainer.newMarkupResourceStream(),
> it is done via the IResourceStreamLocator defined in resource settings.
>
> so you can either override that method on all markup containers, or
> implement your own IResouceStreamLocator like i sugested.
>
> -Igor
>
>
> On 10/6/06, craigdd < [EMAIL PROTECTED]> wrote:
>>
>>
>> Implementing my own IResourceStreamLocator doesn't seem correct to me
>> because
>> the interface takes the path to the resource.  The more correct why is to
>> find where that path is coming from an overriding that implementation,
>> the
>> next step is to actual find where that path is coming from.
>>
>>
>>
>> igor.vaynberg wrote:
>> >
>> > implement your own IResourceStreamLocator
>> >
>> > -Igor
>> >
>> >
>> > On 10/6/06, craigdd < [EMAIL PROTECTED]> wrote:
>> >>
>> >>
>> >> I got it to work with the path "WEB-INf/view" the thing I was over
>> >> looking
>> >> was the fact that when wicket looks for it's markup page it uses the
>> >> fully
>> >> qualified class name of the page object.
>> >>
>> >> It there anyway to overrider the name of the page object, in other
>> words
>> >> if
>> >> I have a WebPage subclass called com.example.MyPage.java can I
>> override
>> >> the
>> >> lookup behavior to look for a html page called mydir/myPage.html?
>> >>
>> >>
>> >> Juergen Donnerstag wrote:
>> >> >
>> >> > You are using V1.2.2?
>> >> > The debug log provided doesn't help a lot.
>> >> >
>> >> > And I'm not able to test it right now, but did try
>> >> > WEB-INF/view
>> >> > /view   (actually the files in that directory as well)
>> >> > view
>> >> >
>> >> > already. And I'm sure you are aware that even though you might a
>> >> > sourceFolder the sub-directory structure must still match.
>> >> >
>> >> > Juergen
>> >> >
>> >> > On 10/6/06, craigdd <[EMAIL PROTECTED]> wrote:
>> >> >>
>> >> >> So by the look of the code you show here it is a filter init param,
>> I
>> >> >> don't
>> >> >> remember seeing anything about configuring a filter.
>> >> >>
>> >> >> Anyway, I looked at the internalinit() method in WebApplication and
>> >> found
>> >> >> where it is pulling the sourceFolder init param from the servlet.
>> I
>> >> >> added
>> >> >> that init param and it still doesn't work, here is my servlet
>> config;
>> >> >>
>> >> >>    <servlet>
>> >> >>        <servlet-name>wicket</servlet-name>
>> >> >>        <servlet-class>wicket.protocol.http.WicketServlet
>> >> </servlet-class>
>> >> >>        <init-param>
>> >> >>          <param-name>applicationClassName</param-name>
>> >> >>
>> <param-value>com.lenzen.web.WicketApplication </param-value>
>> >> >>        </init-param>
>> >> >>        <init-param>
>> >> >>          <param-name>sourceFolder</param-name>
>> >> >>          <param-value>/WEB-INF/view</param-value>
>> >> >>        </init-param>
>> >> >>        <load-on-startup>1</load-on-startup>
>> >> >>    </servlet>
>> >> >>
>> >> >> Here is the debug statements when turning on debug for
>> >> >> wicket.util.resource.
>> >> >>
>> >> >> 08:58:40,046 DEBUG [UrlResourceStream] cannot convert url:
>> >> >> jar:file:/C:/develop/projects/wicket/deploy/wicket.war/WEB-INF/lib
>> >> >>
>> /wicket-1.2.2.jar!/wicket/markup/html/pages/ExceptionErrorPage.htmlto
>> >> >> file
>> >> >> (URI is not hierarchical), falling back to the in
>> >> >> putstream for polling
>> >> >> 08:58:40,187 DEBUG [ResourceFinderResourceStreamLocator] Attempting
>> to
>> >> >> locate resource 'wicket/markup/html/debug/PageView_en_
>> >> >> US.html' on path [folders = [], webapppaths: [/WEB-INF/view/]]
>> >> >> 08:58:40,203 DEBUG [ResourceFinderResourceStreamLocator] Attempting
>> to
>> >> >> locate resource 'wicket/markup/html/debug/PageView_en_
>> >> >> US.html' on path [folders = [], webapppaths: [/WEB-INF/view/]]
>> >> >> 08:58:40,203 DEBUG [ResourceFinderResourceStreamLocator] Attempting
>> to
>> >> >> locate resource 'wicket/markup/html/debug/PageView_en.
>> >> >> html' on path [folders = [], webapppaths: [/WEB-INF/view/]]
>> >> >> 08:58:40,203 DEBUG [ResourceFinderResourceStreamLocator] Attempting
>> to
>> >> >> locate resource 'wicket/markup/html/debug/PageView.htm
>> >> >> l' on path [folders = [], webapppaths: [/WEB-INF/view/]]
>> >> >> 08:58:40,203 DEBUG [ClassLoaderResourceStreamLocator] Attempting to
>> >> >> locate
>> >> >> resource 'wicket/markup/html/debug/PageView_en_US.
>> >> >> html' using classloader WebappClassLoader
>> >> >>  delegate: false
>> >> >>  repositories:
>> >> >>    /WEB-INF/classes/
>> >> >> ----------> Parent Classloader:
>> >> >> [EMAIL PROTECTED]
>> >> >>
>> >> >> 08:58:40,203 DEBUG [ClassLoaderResourceStreamLocator] Attempting to
>> >> >> locate
>> >> >> resource 'wicket/markup/html/debug/PageView_en_US.
>> >> >> html' using classloader WebappClassLoader
>> >> >>  delegate: false
>> >> >>  repositories:
>> >> >>    /WEB-INF/classes/
>> >> >> ----------> Parent Classloader:
>> >> >> [EMAIL PROTECTED]
>> >> >>
>> >> >> 08:58:40,203 DEBUG [ClassLoaderResourceStreamLocator] Attempting to
>> >> >> locate
>> >> >> resource 'wicket/markup/html/debug/PageView_en.htm
>> >> >> l' using classloader WebappClassLoader
>> >> >>  delegate: false
>> >> >>  repositories:
>> >> >>    /WEB-INF/classes/
>> >> >> ----------> Parent Classloader:
>> >> >> [EMAIL PROTECTED]
>> >> >>
>> >> >> 08:58:40,218 DEBUG [ClassLoaderResourceStreamLocator] Attempting to
>> >> >> locate
>> >> >> resource 'wicket/markup/html/debug/PageView.html'
>> >> >> using classloader WebappClassLoader
>> >> >>  delegate: false
>> >> >>  repositories:
>> >> >>    /WEB-INF/classes/
>> >> >> ----------> Parent Classloader:
>> >> >> [EMAIL PROTECTED]
>> >> >>
>> >> >> 08:58:40,218 DEBUG [UrlResourceStream] cannot convert url:
>> >> >> jar:file:/C:/develop/projects/wicket/deploy/wicket.war/WEB-INF/lib
>> >> >> /wicket-1.2.2.jar!/wicket/markup/html/debug/PageView.html to file
>> (URI
>> >> is
>> >> >> not hierarchical), falling back to the inputstream
>> >> >> for polling
>> >> >>
>> >> >>
>> >> >>
>> >> >> Juergen Donnerstag wrote:
>> >> >> >
>> >> >> > Just follow back where addResourceFolder() is already used. It is
>> >> >> > currently used in WebApplication.internalInit() and
>> >> >> > PortletApplication.internalInit() and the code looks like
>> >> >> >   ...
>> >> >> >   configure(configuration, wicketFilter.getFilterConfig ()
>> >> >> >
>> >> >> .getInitParameter("sourceFolder"));
>> >> >> >   ...
>> >> >> >
>> >> >> > So the init param is "sourceFolder"
>> >> >> >
>> >> >> > Juergen
>> >> >> >
>> >> >> >
>> >> >> > On 10/6/06, craigdd < [EMAIL PROTECTED]> wrote:
>> >> >> >>
>> >> >> >> I've beed trying to get this to work for a while now, basically
>> >> what
>> >> I
>> >> >> >> want,
>> >> >> >> is to have Wicket load my html files from /WEB-INF/view
>> directory
>> >> >> instead
>> >> >> >> of
>> >> >> >> the classes directory.
>> >> >> >>
>> >> >> >> I've been reading a post about seperating your html and it was
>> >> >> suggested
>> >> >> >> to
>> >> >> >> use the method addResourceFolder("path");  So in my init method
>> of
>> >> my
>> >> >> >> WebApplication subclass I have the following init method;
>> >> >> >>
>> >> >> >>         protected void init() {
>> >> >> >>
>> >> >> >>
>> >> >> >> this.getResourceSettings().addResourceFolder("/WEB-INF/view/");
>> >> >> >>
>> >> >> >>         } // init
>> >> >> >>
>> >> >> >> Thist doesn't seem to work, what am I missing or is this really
>> >> >> possible.
>> >> >> >> I
>> >> >> >> also tried turing debug on for the path "wicket.util.resource"
>> and
>> >> the
>> >> >> >> only
>> >> >> >> resource path that is logged in WEB-INF/classes.
>> >> >> >>
>> >> >> >> Also, the other post mentioned adding this as an init parameter
>> to
>> >> the
>> >> >> >> servlet, looking at the source code of the servlet I don't see
>> >> >> anything
>> >> >> >> that
>> >> >> >> allows for adding additional resource folder paths.
>> >> >> >>
>> >> >> >> I'm new to Wicket and currently evaluating it against JSF and
>> would
>> >> >> >> appriecate any help.
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>> http://www.nabble.com/Add-addictional-resource-folder-tf2392764.html#a6671548
>> >> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> -------------------------------------------------------------------------
>> >> >> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> >> >> Join SourceForge.net's Techsay panel and you'll get the chance
>> to
>> >> >> share
>> >> >> >> your
>> >> >> >> opinions on IT & business topics through brief surveys -- and
>> earn
>> >> >> cash
>> >> >> >>
>> >> >>
>> >>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> >> >> >> _______________________________________________
>> >> >> >> Wicket-user mailing list
>> >> >> >> Wicket-user@lists.sourceforge.net
>> >> >> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >>
>> -------------------------------------------------------------------------
>> >> >> > Take Surveys. Earn Cash. Influence the Future of IT
>> >> >> > Join SourceForge.net 's Techsay panel and you'll get the chance to
>> >> share
>> >> >> > your
>> >> >> > opinions on IT & business topics through brief surveys -- and
>> earn
>> >> cash
>> >> >> >
>> >> >>
>> >>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> >> >> > _______________________________________________
>> >> >> > Wicket-user mailing list
>> >> >> > Wicket-user@lists.sourceforge.net
>> >> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Add-addictional-resource-folder-tf2392764.html#a6679993
>> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> >>
>> -------------------------------------------------------------------------
>> >> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> >> Join SourceForge.net's Techsay panel and you'll get the chance to
>> >> share
>> >> >> your
>> >> >> opinions on IT & business topics through brief surveys -- and earn
>> >> cash
>> >> >>
>> >>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> >> >> _______________________________________________
>> >> >> Wicket-user mailing list
>> >> >> Wicket-user@lists.sourceforge.net
>> >> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >>
>> >> >
>> >> >
>> >>
>> -------------------------------------------------------------------------
>> >> > Take Surveys. Earn Cash. Influence the Future of IT
>> >> > Join SourceForge.net's Techsay panel and you'll get the chance to
>> share
>> >> > your
>> >> > opinions on IT & business topics through brief surveys -- and earn
>> cash
>> >> >
>> >>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> >> > _______________________________________________
>> >> > Wicket-user mailing list
>> >> > Wicket-user@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Add-addictional-resource-folder-tf2392764.html#a6683675
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> -------------------------------------------------------------------------
>> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share
>> >> your
>> >> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> >>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> >> _______________________________________________
>> >> Wicket-user mailing list
>> >> Wicket-user@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >>
>> >
>> >
>> -------------------------------------------------------------------------
>> > Take Surveys. Earn Cash. Influence the Future of IT
>> > Join SourceForge.net's Techsay panel and you'll get the chance to share
>> > your
>> > opinions on IT & business topics through brief surveys -- and earn cash
>> >
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Add-addictional-resource-folder-tf2392764.html#a6684068
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>

--
View this message in context: http://www.nabble.com/Add-addictional-resource-folder-tf2392764.html#a6685868
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to