You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andreas Balke <an...@doppelpop.de> on 2009/02/09 16:59:29 UTC

URL Mapping (Beginner)

Hi guys,

I'm playing around with wicket a bit, but I cannot solve an (probably 
easy) problem: my pages cannot be resolved. The Homepage class is 
reachable, but only be calling the "Root" URL. Calling an explicit html 
file gives me a Tomcat 404 without useless message...

Am I something missing?

Cheers, Andi


Here is my web.xml

   <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>/WEB-INF/Springapp-servlet.xml</param-value>
   </context-param>
   <listener>
       
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 

   </listener>

   <listener>
       
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> 

   </listener>

   <!-- Wicket example -->
   <servlet>
       <servlet-name>WicketApplication</servlet-name>
       
<servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class> 

       <init-param>
           <param-name>applicationClassName</param-name>
           
<param-value>de.pansen.wicket.HelloWorldApplication</param-value>
       </init-param>
       <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
       <servlet-name>WicketApplication</servlet-name>
       <url-pattern>/wicket/*</url-pattern>
   </servlet-mapping>
   <!-- dev only... -->
   <context-param>
       <param-name>configuration</param-name>
       <param-value>development</param-value>
   </context-param>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: URL Mapping (Beginner)

Posted by Maarten Bosteels <mb...@gmail.com>.
Or you can specify the mount path on the Page class itself:

http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-annotation

regards,
Maarten

On Mon, Feb 9, 2009 at 5:49 PM, Andreas Balke <an...@doppelpop.de> wrote:

> excellent :)
>
>
>
> Matthew Hanlon wrote:
>
>> You can use PackageRequestTargetUrlCodingStrategy to mount an entire
>> package.  E.g., if you have a package com.company.pages with classes
>> Page1,
>> Page2, etc., you can mount the package
>> mount(new PackageRequestTargetUrlCodingStrategy("/pages",
>> PackageName.forClass(Page1.class))).
>>  This will mount your pages as "/pages/Page1", "pages/Page2", etc.
>> Regards,
>> Matt.
>>
>> On Mon, Feb 9, 2009 at 10:12 AM, Andreas Balke <an...@doppelpop.de> wrote:
>>
>>
>>
>>> Thank you Stefan.
>>>
>>> Is there even a more generic way, like telling Wicket: take all in this
>>> directory? Guess not, since this should be scanned on boot... ?! I just
>>> would like to skip to register each single class.
>>>
>>> Andi
>>>
>>>
>>> Stefan Lindner wrote:
>>>
>>>
>>>
>>>> You need to do 2 things.
>>>>
>>>> 1. Mount your Page in Applicatioin.init() methode like
>>>>       mountBookmarkablePage("/Login", Login.class);
>>>>  As you see, you can give your page any name you want
>>>> 2. Your e.g. Login.class must have a parameterless constructor or a
>>>> constructor like
>>>>     public Login(final PageParameters parameters)
>>>>
>>>> Then you can call your Login-Page directly with URL ....../Login
>>>>
>>>> Stefan
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Andreas Balke [mailto:andi@doppelpop.de] Gesendet: Montag, 9.
>>>> Februar 2009 16:59
>>>> An: users@wicket.apache.org
>>>> Betreff: URL Mapping (Beginner)
>>>>
>>>> Hi guys,
>>>>
>>>> I'm playing around with wicket a bit, but I cannot solve an (probably
>>>> easy) problem: my pages cannot be resolved. The Homepage class is
>>>> reachable,
>>>> but only be calling the "Root" URL. Calling an explicit html file gives
>>>> me a
>>>> Tomcat 404 without useless message...
>>>>
>>>> Am I something missing?
>>>>
>>>> Cheers, Andi
>>>>
>>>>
>>>> Here is my web.xml
>>>>
>>>>  <context-param>
>>>>      <param-name>contextConfigLocation</param-name>
>>>>      <param-value>/WEB-INF/Springapp-servlet.xml</param-value>
>>>>  </context-param>
>>>>  <listener>
>>>>
>>>>
>>>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>>>>
>>>>  </listener>
>>>>
>>>>  <listener>
>>>>
>>>>
>>>> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
>>>>
>>>>  </listener>
>>>>
>>>>  <!-- Wicket example -->
>>>>  <servlet>
>>>>      <servlet-name>WicketApplication</servlet-name>
>>>>
>>>>
>>>> <servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class>
>>>>
>>>>      <init-param>
>>>>          <param-name>applicationClassName</param-name>
>>>>
>>>> <param-value>de.pansen.wicket.HelloWorldApplication</param-value>
>>>>      </init-param>
>>>>      <load-on-startup>1</load-on-startup>
>>>>  </servlet>
>>>>  <servlet-mapping>
>>>>      <servlet-name>WicketApplication</servlet-name>
>>>>      <url-pattern>/wicket/*</url-pattern>
>>>>  </servlet-mapping>
>>>>  <!-- dev only... -->
>>>>  <context-param>
>>>>      <param-name>configuration</param-name>
>>>>      <param-value>development</param-value>
>>>>  </context-param>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: URL Mapping (Beginner)

Posted by Andreas Balke <an...@doppelpop.de>.
excellent :)


Matthew Hanlon wrote:
> You can use PackageRequestTargetUrlCodingStrategy to mount an entire
> package.  E.g., if you have a package com.company.pages with classes Page1,
> Page2, etc., you can mount the package
> mount(new PackageRequestTargetUrlCodingStrategy("/pages",
> PackageName.forClass(Page1.class))).
>  This will mount your pages as "/pages/Page1", "pages/Page2", etc.
> Regards,
> Matt.
>
> On Mon, Feb 9, 2009 at 10:12 AM, Andreas Balke <an...@doppelpop.de> wrote:
>
>   
>> Thank you Stefan.
>>
>> Is there even a more generic way, like telling Wicket: take all in this
>> directory? Guess not, since this should be scanned on boot... ?! I just
>> would like to skip to register each single class.
>>
>> Andi
>>
>>
>> Stefan Lindner wrote:
>>
>>     
>>> You need to do 2 things.
>>>
>>> 1. Mount your Page in Applicatioin.init() methode like
>>>        mountBookmarkablePage("/Login", Login.class);
>>>   As you see, you can give your page any name you want
>>> 2. Your e.g. Login.class must have a parameterless constructor or a
>>> constructor like
>>>      public Login(final PageParameters parameters)
>>>
>>> Then you can call your Login-Page directly with URL ....../Login
>>>
>>> Stefan
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Andreas Balke [mailto:andi@doppelpop.de] Gesendet: Montag, 9.
>>> Februar 2009 16:59
>>> An: users@wicket.apache.org
>>> Betreff: URL Mapping (Beginner)
>>>
>>> Hi guys,
>>>
>>> I'm playing around with wicket a bit, but I cannot solve an (probably
>>> easy) problem: my pages cannot be resolved. The Homepage class is reachable,
>>> but only be calling the "Root" URL. Calling an explicit html file gives me a
>>> Tomcat 404 without useless message...
>>>
>>> Am I something missing?
>>>
>>> Cheers, Andi
>>>
>>>
>>> Here is my web.xml
>>>
>>>   <context-param>
>>>       <param-name>contextConfigLocation</param-name>
>>>       <param-value>/WEB-INF/Springapp-servlet.xml</param-value>
>>>   </context-param>
>>>   <listener>
>>>
>>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>>>
>>>   </listener>
>>>
>>>   <listener>
>>>
>>> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
>>>
>>>   </listener>
>>>
>>>   <!-- Wicket example -->
>>>   <servlet>
>>>       <servlet-name>WicketApplication</servlet-name>
>>>
>>> <servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class>
>>>
>>>       <init-param>
>>>           <param-name>applicationClassName</param-name>
>>>
>>> <param-value>de.pansen.wicket.HelloWorldApplication</param-value>
>>>       </init-param>
>>>       <load-on-startup>1</load-on-startup>
>>>   </servlet>
>>>   <servlet-mapping>
>>>       <servlet-name>WicketApplication</servlet-name>
>>>       <url-pattern>/wicket/*</url-pattern>
>>>   </servlet-mapping>
>>>   <!-- dev only... -->
>>>   <context-param>
>>>       <param-name>configuration</param-name>
>>>       <param-value>development</param-value>
>>>   </context-param>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: URL Mapping (Beginner)

Posted by Matthew Hanlon <mr...@gmail.com>.
You can use PackageRequestTargetUrlCodingStrategy to mount an entire
package.  E.g., if you have a package com.company.pages with classes Page1,
Page2, etc., you can mount the package
mount(new PackageRequestTargetUrlCodingStrategy("/pages",
PackageName.forClass(Page1.class))).
 This will mount your pages as "/pages/Page1", "pages/Page2", etc.
Regards,
Matt.

On Mon, Feb 9, 2009 at 10:12 AM, Andreas Balke <an...@doppelpop.de> wrote:

> Thank you Stefan.
>
> Is there even a more generic way, like telling Wicket: take all in this
> directory? Guess not, since this should be scanned on boot... ?! I just
> would like to skip to register each single class.
>
> Andi
>
>
> Stefan Lindner wrote:
>
>> You need to do 2 things.
>>
>> 1. Mount your Page in Applicatioin.init() methode like
>>        mountBookmarkablePage("/Login", Login.class);
>>   As you see, you can give your page any name you want
>> 2. Your e.g. Login.class must have a parameterless constructor or a
>> constructor like
>>      public Login(final PageParameters parameters)
>>
>> Then you can call your Login-Page directly with URL ....../Login
>>
>> Stefan
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Andreas Balke [mailto:andi@doppelpop.de] Gesendet: Montag, 9.
>> Februar 2009 16:59
>> An: users@wicket.apache.org
>> Betreff: URL Mapping (Beginner)
>>
>> Hi guys,
>>
>> I'm playing around with wicket a bit, but I cannot solve an (probably
>> easy) problem: my pages cannot be resolved. The Homepage class is reachable,
>> but only be calling the "Root" URL. Calling an explicit html file gives me a
>> Tomcat 404 without useless message...
>>
>> Am I something missing?
>>
>> Cheers, Andi
>>
>>
>> Here is my web.xml
>>
>>   <context-param>
>>       <param-name>contextConfigLocation</param-name>
>>       <param-value>/WEB-INF/Springapp-servlet.xml</param-value>
>>   </context-param>
>>   <listener>
>>
>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>>
>>   </listener>
>>
>>   <listener>
>>
>> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
>>
>>   </listener>
>>
>>   <!-- Wicket example -->
>>   <servlet>
>>       <servlet-name>WicketApplication</servlet-name>
>>
>> <servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class>
>>
>>       <init-param>
>>           <param-name>applicationClassName</param-name>
>>
>> <param-value>de.pansen.wicket.HelloWorldApplication</param-value>
>>       </init-param>
>>       <load-on-startup>1</load-on-startup>
>>   </servlet>
>>   <servlet-mapping>
>>       <servlet-name>WicketApplication</servlet-name>
>>       <url-pattern>/wicket/*</url-pattern>
>>   </servlet-mapping>
>>   <!-- dev only... -->
>>   <context-param>
>>       <param-name>configuration</param-name>
>>       <param-value>development</param-value>
>>   </context-param>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Matthew Rollins Hanlon
http://squareoftwo.org
_____________________
Hanlon's Razor:
"Never attribute to malice that which can be adequately explained by
stupidity."
http://wikipedia.org/wiki/Hanlon's_razor

Re: URL Mapping (Beginner)

Posted by Andreas Balke <an...@doppelpop.de>.
Thank you Stefan.

Is there even a more generic way, like telling Wicket: take all in this 
directory? Guess not, since this should be scanned on boot... ?! I just 
would like to skip to register each single class.

Andi

Stefan Lindner wrote:
> You need to do 2 things.
>
> 1. Mount your Page in Applicatioin.init() methode like
> 	mountBookmarkablePage("/Login", Login.class);
>    As you see, you can give your page any name you want
> 2. Your e.g. Login.class must have a parameterless constructor or a constructor like
>       public Login(final PageParameters parameters)
>
> Then you can call your Login-Page directly with URL ....../Login
>
> Stefan
>
> -----Ursprüngliche Nachricht-----
> Von: Andreas Balke [mailto:andi@doppelpop.de] 
> Gesendet: Montag, 9. Februar 2009 16:59
> An: users@wicket.apache.org
> Betreff: URL Mapping (Beginner)
>
> Hi guys,
>
> I'm playing around with wicket a bit, but I cannot solve an (probably 
> easy) problem: my pages cannot be resolved. The Homepage class is 
> reachable, but only be calling the "Root" URL. Calling an explicit html 
> file gives me a Tomcat 404 without useless message...
>
> Am I something missing?
>
> Cheers, Andi
>
>
> Here is my web.xml
>
>    <context-param>
>        <param-name>contextConfigLocation</param-name>
>        <param-value>/WEB-INF/Springapp-servlet.xml</param-value>
>    </context-param>
>    <listener>
>        
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
>
>    </listener>
>
>    <listener>
>        
> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> 
>
>    </listener>
>
>    <!-- Wicket example -->
>    <servlet>
>        <servlet-name>WicketApplication</servlet-name>
>        
> <servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class> 
>
>        <init-param>
>            <param-name>applicationClassName</param-name>
>            
> <param-value>de.pansen.wicket.HelloWorldApplication</param-value>
>        </init-param>
>        <load-on-startup>1</load-on-startup>
>    </servlet>
>    <servlet-mapping>
>        <servlet-name>WicketApplication</servlet-name>
>        <url-pattern>/wicket/*</url-pattern>
>    </servlet-mapping>
>    <!-- dev only... -->
>    <context-param>
>        <param-name>configuration</param-name>
>        <param-value>development</param-value>
>    </context-param>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: URL Mapping (Beginner)

Posted by Stefan Lindner <li...@visionet.de>.
You need to do 2 things.

1. Mount your Page in Applicatioin.init() methode like
	mountBookmarkablePage("/Login", Login.class);
   As you see, you can give your page any name you want
2. Your e.g. Login.class must have a parameterless constructor or a constructor like
      public Login(final PageParameters parameters)

Then you can call your Login-Page directly with URL ....../Login

Stefan

-----Ursprüngliche Nachricht-----
Von: Andreas Balke [mailto:andi@doppelpop.de] 
Gesendet: Montag, 9. Februar 2009 16:59
An: users@wicket.apache.org
Betreff: URL Mapping (Beginner)

Hi guys,

I'm playing around with wicket a bit, but I cannot solve an (probably 
easy) problem: my pages cannot be resolved. The Homepage class is 
reachable, but only be calling the "Root" URL. Calling an explicit html 
file gives me a Tomcat 404 without useless message...

Am I something missing?

Cheers, Andi


Here is my web.xml

   <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>/WEB-INF/Springapp-servlet.xml</param-value>
   </context-param>
   <listener>
       
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 

   </listener>

   <listener>
       
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> 

   </listener>

   <!-- Wicket example -->
   <servlet>
       <servlet-name>WicketApplication</servlet-name>
       
<servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class> 

       <init-param>
           <param-name>applicationClassName</param-name>
           
<param-value>de.pansen.wicket.HelloWorldApplication</param-value>
       </init-param>
       <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
       <servlet-name>WicketApplication</servlet-name>
       <url-pattern>/wicket/*</url-pattern>
   </servlet-mapping>
   <!-- dev only... -->
   <context-param>
       <param-name>configuration</param-name>
       <param-value>development</param-value>
   </context-param>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org