Re: formComponentPanel with content generated by RepeatingView

2011-04-22 Thread kamiseq
hej,
on the second thought I can implement (in this simple case) a model backuped
by List or Set and then let Form (or FormComponentPanel) to process all
fields.

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


Understanding Wicket 1.5 page mapping

2011-04-22 Thread drewzilla80
Hi,

I'm really keen to have a clearer understanding of the page mapping changes
in Wicket 1.5 - right now it is still not totally clear in my mind.

The best way to explain is by highlighting some requirements I have based on
the URL scheme we are trying to achieve in a project.

We have the concept of Locations and Categories. To visit a location
page, the following URL would be used:

www.mycompany.com/someLocation

To visit a category page, the URL would be:

www.mycompany.com/someCategory

Additionally, a search page exists combining a location and a category - the
url being:

www.mycompany.com/someLocation/someCategory

So we have three page types:

- Location page 
- Category page
- Combination location and category page (a search page)

I've not found a solution to implementing this URL scheme using Wicket. One
issue being that the URLs are dynamic, i.e. we need to lookup locations and
categories from a database to determine whether a specified URL is actually
a location page, category page, search page or none of the above.

The steps would be:

1. If only a single path...
2. If it is a valid category, forward to CategoryPage.class
3. If it is a valid location, forward to LocationPage.class
4. If there is a second path element (validLocation/validCategory) forward
to SearchPage.class
5. If no matching page found by now, fall through to other mappers/handlers
to handle the URL

My problem up to now is that none of these pages is prefixed with anything
to uniquely identify them, e.g.

/location/someLocation
/category/someCategory

and thus I need to perform logic (including database calls) to determine the
semantics of the URL before I know what the intended destination is.

Hopefully I've been clear enough as to what the issue is I'm trying to
solve. Having briefly read up about the great work that is being done in
Wicket 1.5, I'm thinking that maybe I could achieve this now.

I'd be really grateful for some ideas/opinions on this.

Thanks,

dz

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3467619.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Understanding Wicket 1.5 page mapping

2011-04-22 Thread Martin Grigorov
Hi,

Create a new IRequestMapper and set it as root mapper - see the
examples for HttpsMapper and CryptoMapper to see how.
This new mapper will process the URL and decide which page to use
(CategoryPage vs. LocationPage) and use BookmarkablePageRequestHandler
to render it.

The new mapper should be compound (ICompoundRequestMapper) and
fallback to default mappers for Wicket internal works (link/form
listeners, ajax, ...).

Have fun!

On Fri, Apr 22, 2011 at 11:46 AM, drewzilla80 andrew.eas...@gmail.com wrote:
 Hi,

 I'm really keen to have a clearer understanding of the page mapping changes
 in Wicket 1.5 - right now it is still not totally clear in my mind.

 The best way to explain is by highlighting some requirements I have based on
 the URL scheme we are trying to achieve in a project.

 We have the concept of Locations and Categories. To visit a location
 page, the following URL would be used:

 www.mycompany.com/someLocation

 To visit a category page, the URL would be:

 www.mycompany.com/someCategory

 Additionally, a search page exists combining a location and a category - the
 url being:

 www.mycompany.com/someLocation/someCategory

 So we have three page types:

 - Location page
 - Category page
 - Combination location and category page (a search page)

 I've not found a solution to implementing this URL scheme using Wicket. One
 issue being that the URLs are dynamic, i.e. we need to lookup locations and
 categories from a database to determine whether a specified URL is actually
 a location page, category page, search page or none of the above.

 The steps would be:

 1. If only a single path...
 2. If it is a valid category, forward to CategoryPage.class
 3. If it is a valid location, forward to LocationPage.class
 4. If there is a second path element (validLocation/validCategory) forward
 to SearchPage.class
 5. If no matching page found by now, fall through to other mappers/handlers
 to handle the URL

 My problem up to now is that none of these pages is prefixed with anything
 to uniquely identify them, e.g.

 /location/someLocation
 /category/someCategory

 and thus I need to perform logic (including database calls) to determine the
 semantics of the URL before I know what the intended destination is.

 Hopefully I've been clear enough as to what the issue is I'm trying to
 solve. Having briefly read up about the great work that is being done in
 Wicket 1.5, I'm thinking that maybe I could achieve this now.

 I'd be really grateful for some ideas/opinions on this.

 Thanks,

 dz

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3467619.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Understanding Wicket 1.5 page mapping

2011-04-22 Thread drewzilla80
Hey Martin.

Thanks for the awesome reply speed!

It is amazing how committed you guys are to solving the real world problems
we face as developers. Wicket is such a cool framework and it's great to see
these new features constantly evolving to add the sort of flexibility needed
when there's an SEO analyst breathing down your neck!

Thanks again!

dz

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3467643.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Understanding Wicket 1.5 page mapping

2011-04-22 Thread drewzilla80
Martin,

Just playing with the code now - I'm afraid I'm not sure exactly what you
mean by:

The new mapper should be compound (ICompoundRequestMapper) and 
fallback to default mappers for Wicket internal works (link/form 
listeners, ajax, ...)

Could you elaborate briefly on this piece?

Thanks,

dz

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3467769.html
Sent from the Users forum mailing list archive at Nabble.com.

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



mountPage(...) issuing a 302 redirect

2011-04-22 Thread drewzilla80
I'm using Wicket 1.5-rc2 and have noticed that I'm getting what I believe to
be unnecessary 302 redirects for bookmarkable/stateless pages.

In my application.init(), I'm doing the following:

mountPage(/myPage, MyPage.class)

When I request this page in my browser at http://localhost:8080/myPage, the
application issues a 302 Found response to which the client responds to by
making a second request to 
http://localhost:8080/myPage from which it receives a 200 OK response.

I'm also see this with the homepage as well, i.e. a request to
http://localhost:8080/

I can see that, under the covers, Wicket is creating a
RenderPageRequestHandler for bookmarkable pages with the default redirect
policy of AUTO_REDIRECT. The code has a comment to specify under which
conditions a redirect with be issued when auto redirect policy is in use.
However, I'm not convinced a redirect should be taking place in this
situation.

It makes me feel nervous that I don't really understand this behaviour. I
started an earlier thread about building my own root request mapper, within
which I'm creating a RenderPageRequestHandler that specifies REDIRECT_NEVER,
but I'm concerned about fiddling with these settings when I clearly seem to
be missing some form of understanding about it.

Can someone explain why I might be getting the 302 redirect for what is a
completely static page?

Thanks,

dz 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/mountPage-issuing-a-302-redirect-tp3468114p3468114.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Fwd: wicket 1.5-rc2 and aggregate jar for osgi

2011-04-22 Thread Daniele Dellafiore
Hi, sorry I read your reply only today...
I got basically to the same results yesterday, but I've some problem which I
summarized in the last message in this thread on felix mailing list:

http://old.nabble.com/A-better-life%3A-quick-webapp-deploy-to31334158.html

I'll go into details point by point.

On Fri, Apr 8, 2011 at 3:29 PM, Eike Kettner n...@eknet.org wrote:

 Hi Daniele,

 I might have not understood your concern well enough... But here is what I
 do: I deploy a really small war file (without any deps of course) into the
 osgi container (I use felix...). There is another bundle from pax,
 called pax-web-extender, that listens for war files coming into the
 container and will then register them on the embedded jetty instance.

 I use the following pax bundles:
 * org.ops4j.pax.web.pax-web-extender-war
 * org.ops4j.pax.web.pax-web-jetty-bundle
 * org.ops4j.pax.web.pax-web-jsp   (might be superfluous)


yeah I've everything installed. I do not remember what osgi features
installed this but there is:

[  54] [Active ] [] [   ] [   60] OPS4J Pax Web -
Runtime (1.0.1)
[  55] [Active ] [] [   ] [   60] OPS4J Pax Web - API
(1.0.1)
[  56] [Active ] [] [   ] [   60] OPS4J Pax Web - Jetty
(1.0.1)
[  57] [Active ] [] [   ] [   60] OPS4J Pax Web -
Service SPI (1.0.1)
[  59] [Active ] [] [   ] [   60] OPS4J Pax Web -
Extender - Whiteboard (1.0.1)
[  60] [Active ] [] [   ] [   60] OPS4J Pax Web -
FileInstall Deployer (1.0.1)
[  61] [Active ] [] [   ] [   60] OPS4J Pax Url - war:,
war-i: (1.2.5)
[  62] [Active ] [] [   ] [   60] OPS4J Pax Web -
Extender - WAR (1.0.1)
[  63] [Active ] [] [   ] [   60] OPS4J Pax Web - Jsp
Support (1.0.1)

on Karaf 2.2.0



 Then I use the felix-bundle plugin to create a MANIFEST.MF for my war
 file. It looks like that:

plugins
  plugin
groupIdorg.apache.felix/groupId
artifactIdmaven-bundle-plugin/artifactId
executions
  execution
idbundle-manifest/id
phaseprocess-classes/phase
goals
  goalmanifest/goal
/goals
  /execution
/executions
configuration
  supportedProjectTypes
supportedProjectTypejar/supportedProjectType
supportedProjectTypewar/supportedProjectType
supportedProjectTypebundle/supportedProjectType
  /supportedProjectTypes
  instructions
_include-osgi.bnd/_include
  /instructions
/configuration
  /plugin
  plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-war-plugin/artifactId
configuration
  archive
manifestFile
  ${project.build.outputDirectory}/META-INF/MANIFEST.MF
/manifestFile
  /archive
/configuration
  /plugin
/plugins



it's almost the same as mine, also the war-plugin config is identical.
I do not have

   _include-osgi.bnd/_include

but I have this instructions

  _wabsrc/main/webapp/_wab
Web-ContextPath/myApp/Web-ContextPath

There are some more instructions in the osgi.bnd file. You could have
 written them directly in the instructions section of the bundle plugin:

  Bundle-Classpath: ., WEB-INF/classes
  Web-ContextPath: mywebapp
  DynamicImport-Package: *
  Webapp-Context: mywebapp


It seems that maven-bundle-plugin, at least 2.3.4 version, automatically
add  Bundle-Classpath: WEB-INF/classes if the project is a WAR or have a
Webapp-Context (that make the bundle a WAB, as for OSGI in Action), in fact
I do not have that intructions and the war project  Bundle-Classpath:
WEB-INF/classes in the MANIFEST (note, without the dot).
I think also that Webapp-Context has been deprecated in favor of the new
Web-ContextPath you also have.

As for DynamicImport-Package: *
what does this do?

It does not seem you do not have specific Import or Export package
instructions, so you use the maven-bundle-plugin defaults, so every dep is
explicitly written in the MANIFEST right?



 This creates a MANIFEST with Import-Package statements for all your
 dependencies - they are not included in the war file. The war file has
 no /lib folder, just WEB-INF/classes and META-INF/ are there. The bundle
 classpath is extended to include the classes in WEB-INF/classes. I
 use the scope provided for all dependencies.


where do you specify the provided scope? In all the maven deps explicitly?
There is not a way to tell just maven-bundle-plugin to consider everything
as provided just when building the bundle? I think that this is the reason
why you do not have jars in the lib folder, right?



 When the war file is deployed to the osgi container, the pax bundles
 from above will make it available to jetty.


In fact, it seems that if I just manually remove the jars 

Re: mountPage(...) issuing a 302 redirect

2011-04-22 Thread Martin Grigorov
Try with trunk. I believe this is fixed.

On Fri, Apr 22, 2011 at 5:51 PM, drewzilla80 andrew.eas...@gmail.com wrote:
 I'm using Wicket 1.5-rc2 and have noticed that I'm getting what I believe to
 be unnecessary 302 redirects for bookmarkable/stateless pages.

 In my application.init(), I'm doing the following:

 mountPage(/myPage, MyPage.class)

 When I request this page in my browser at http://localhost:8080/myPage, the
 application issues a 302 Found response to which the client responds to by
 making a second request to
 http://localhost:8080/myPage from which it receives a 200 OK response.

 I'm also see this with the homepage as well, i.e. a request to
 http://localhost:8080/

 I can see that, under the covers, Wicket is creating a
 RenderPageRequestHandler for bookmarkable pages with the default redirect
 policy of AUTO_REDIRECT. The code has a comment to specify under which
 conditions a redirect with be issued when auto redirect policy is in use.
 However, I'm not convinced a redirect should be taking place in this
 situation.

 It makes me feel nervous that I don't really understand this behaviour. I
 started an earlier thread about building my own root request mapper, within
 which I'm creating a RenderPageRequestHandler that specifies REDIRECT_NEVER,
 but I'm concerned about fiddling with these settings when I clearly seem to
 be missing some form of understanding about it.

 Can someone explain why I might be getting the 302 redirect for what is a
 completely static page?

 Thanks,

 dz

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/mountPage-issuing-a-302-redirect-tp3468114p3468114.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Understanding Wicket 1.5 page mapping

2011-04-22 Thread Martin Grigorov
Ignore this.
getRootRequestMapperAsCompound() will convert it for you anyway.
Just follow how Https and Crypto mappers work

On Fri, Apr 22, 2011 at 1:54 PM, drewzilla80 andrew.eas...@gmail.com wrote:
 Martin,

 Just playing with the code now - I'm afraid I'm not sure exactly what you
 mean by:

 The new mapper should be compound (ICompoundRequestMapper) and
 fallback to default mappers for Wicket internal works (link/form
 listeners, ajax, ...)

 Could you elaborate briefly on this piece?

 Thanks,

 dz

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3467769.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Understanding Wicket 1.5 page mapping

2011-04-22 Thread drewzilla80
Thanks, Martin. That's what I already ended up doing as it turns out (I dug
into the code and noticed the method you specified). I've got my whole
original use case working very nicely indeed - thanks for your help.

dz

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3468850.html
Sent from the Users forum mailing list archive at Nabble.com.

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



[MIGRATE 1.5] NPE trying to use JavaScriptTemplate

2011-04-22 Thread Alexandros Karypidis

Hi,

I've just started preparing for 1.5 and have been modifying my code in  
order to conform with the new API. I've managed to get my application to  
compile and launch, but in my first attempt to render a page I get an NPE  
as follows:


java.lang.NullPointerException
 at  
org.apache.wicket.util.template.TextTemplateDecorator.setLastModified(TextTemplateDecorator.java:195)
 at  
org.apache.wicket.util.resource.AbstractStringResourceStream.init(AbstractStringResourceStream.java:76)
 at  
org.apache.wicket.util.resource.AbstractStringResourceStream.init(AbstractStringResourceStream.java:62)
 at  
org.apache.wicket.util.template.TextTemplate.init(TextTemplate.java:42)
 at  
org.apache.wicket.util.template.TextTemplateDecorator.init(TextTemplateDecorator.java:52)
 at  
org.apache.wicket.util.template.JavaScriptTemplate.init(JavaScriptTemplate.java:42)

 at assets.wicket.ovimaps.OviMap.renderHead(OviMap.java:46)
 at org.apache.wicket.Component.renderHead(Component.java:2644)

Now this part of the code is an adaptation of what used to be a  
template-based javascript header contribution as follows:


 add(TextTemplateHeaderContributor.forJavaScript(OviMap.class,  
OviMap.js, model));


The above has been removed from the component constructor (where it used  
to be) and replaced with the following in code inside my component:


 @Override
 public void renderHead(IHeaderResponse response) {
  super.renderHead(response);
  JavaScriptTemplate template = new JavaScriptTemplate(
   new PackagedTextTemplate(OviMap.class, OviMap.js));
   response.renderString(template.asString(model.getObject()));
 }

What am I doing wrong?

P.S. I am using 1.5-rc2.

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



Re: formComponentPanel with content generated by RepeatingView

2011-04-22 Thread Pedro Santos
You can set any model in your form component panel. But its value will be
set during the form processing, after the validation step.
FormComponent#convertInput is invoked before the validation step, and it
only sets the converted input in the FormComponent (see
FormComponent#setConvertedInput). It don't set the model already.

On Fri, Apr 22, 2011 at 4:12 AM, kamiseq kami...@gmail.com wrote:

 hej,
 on the second thought I can implement (in this simple case) a model
 backuped
 by List or Set and then let Form (or FormComponentPanel) to process all
 fields.

 pozdrawiam
 Paweł Kamiński

 kami...@gmail.com
 pkaminski@gmail.com
 __




-- 
Pedro Henrique Oliveira dos Santos


Re: [MIGRATE 1.5] NPE trying to use JavaScriptTemplate

2011-04-22 Thread Pedro Santos
Move to 1.5-RC3, if this problem remains report in
https://issues.apache.org/jira/browse/WICKET-3187

On Fri, Apr 22, 2011 at 7:26 PM, Alexandros Karypidis akary...@yahoo.grwrote:

 Hi,

 I've just started preparing for 1.5 and have been modifying my code in
 order to conform with the new API. I've managed to get my application to
 compile and launch, but in my first attempt to render a page I get an NPE as
 follows:

 java.lang.NullPointerException
 at
 org.apache.wicket.util.template.TextTemplateDecorator.setLastModified(TextTemplateDecorator.java:195)
 at
 org.apache.wicket.util.resource.AbstractStringResourceStream.init(AbstractStringResourceStream.java:76)
 at
 org.apache.wicket.util.resource.AbstractStringResourceStream.init(AbstractStringResourceStream.java:62)
 at
 org.apache.wicket.util.template.TextTemplate.init(TextTemplate.java:42)
 at
 org.apache.wicket.util.template.TextTemplateDecorator.init(TextTemplateDecorator.java:52)
 at
 org.apache.wicket.util.template.JavaScriptTemplate.init(JavaScriptTemplate.java:42)
 at assets.wicket.ovimaps.OviMap.renderHead(OviMap.java:46)
 at org.apache.wicket.Component.renderHead(Component.java:2644)

 Now this part of the code is an adaptation of what used to be a
 template-based javascript header contribution as follows:

 add(TextTemplateHeaderContributor.forJavaScript(OviMap.class,
 OviMap.js, model));

 The above has been removed from the component constructor (where it used to
 be) and replaced with the following in code inside my component:

 @Override
 public void renderHead(IHeaderResponse response) {
  super.renderHead(response);
  JavaScriptTemplate template = new JavaScriptTemplate(
   new PackagedTextTemplate(OviMap.class, OviMap.js));
   response.renderString(template.asString(model.getObject()));
 }

 What am I doing wrong?

 P.S. I am using 1.5-rc2.

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




-- 
Pedro Henrique Oliveira dos Santos