Re: [OT] thanks

2013-08-14 Thread Dan Retzlaff
Have you considered nginx? We use httpd but our reverse-proxying needs are
pretty simple. I've been meaning to try nginx.

http://nginx.org/en/docs/http/websocket.html


On Wed, Aug 14, 2013 at 7:42 AM, Pierre Goupil goupilpie...@gmail.comwrote:

 I use only Tomcat (7.0.40) and I must admit that with NIO connector and
 useNative=true, the performance looks nice. I have no use for an httpd for
 the moment, but I'm not in production.

 I plan to load test my app, if you're interested, I can communicate the
 results to you.

 As a side-note, on the Tomcat list, many people are starting to talk about
 better WebSockets support in Tomcat 8 and the dev seem to realize that
 there is a strong expectation for them, so maybe they'll try and convince
 to work hand-in-hand with the httpd / AJP people?

 Anyway, thanks again and keep up the good work!

 And of course a big thank you to the people from the great Wicket, too!
 :-)

 Regards,

 Pierre


 On Wed, Aug 14, 2013 at 3:33 PM, Emond Papegaaij 
 emond.papega...@topicus.nl
  wrote:

  Hi Pierre,
 
  Good to hear you like it! Unfortunately, we are still waiting for the
 rest
  of
  the server stack to support websockets before we can actually use it in
  production applications. Hopefully, with the release of jee7 (with
 jsr356)
  maintainers of httpd and ajp will finally realize they need to support
  websockets as well.
 
  Best regards,
  Emond
 
  On Wednesday 14 August 2013 12:01:05 Pierre Goupil wrote:
   Good morning,
  
   All apologies for this totally off-topic message, but I would like to
  say a
   big THANK YOU to Emond for his work on wicket-atmosphere.
  
   His code is far from trivial, yet it is a real pleasure to use it.
   According to me, the killer-feature is the fact that we have an
   AjaxRequestTarget to work with which triggers a Comet / WebSocket
  response.
  
   Thanks again, man!
  
   Pierre
 



 --
 Un truc bien avec la musique, c'est que quand elle te frappe, tu n'as pas
 mal.
 Alors frappez-moi de musique !
 Frappez-moi de musique, maintenant !

 (Bob Marley : Trenchtown Rock)



Re: How to resolve this java.util.ConcurrentModificationException

2013-08-06 Thread Dan Retzlaff
I'd use a debugger to look for live references to the map. In Eclipse, if
you right-click the variable line in the Variables view, there is an All
References option. The trick is instantiating the offending Wicket
component to create the reference. But once created it should stick around
at least until the next GC.

Dan


On Tue, Aug 6, 2013 at 9:27 AM, Michael Mosmann mich...@mosmann.de wrote:

 IMHO nothing in Application is serialized. But its far to easy to leak an
 instance of this LRU-Map into some components (anon classes).

 Can you provide some code or error message?

 Am 06.08.13 18:22, schrieb saty:

  I need to understand what and when Wicket tries to serialize stuff in a
 running wicket application. I am not able to fix this error and it keeps
 growing with more users starting to use the application. It does not
 affect
 the application usage but it keeps beaming error email.

 I am using LRU map to cache certain data being used in the application and
 that is a shared data in a static context not tied to any particular user.
 Why would wicket try to serialize this object, this should not be
 serialized
 at all. LRU map this is not synchronized and is not thread-safe and
 application code treats it that way but the serialization keeps generating
 concurrent modification exception as its obvious its trying to serialize
 this when something changes the map.
 if i declare this as transient, will this prevent wicket from serializing
 this map too, what are the possible repercussion in wicket application if
 i
 declare this transient.

 Thanks for your help.



 --
 View this message in context: http://apache-wicket.1842946.**
 n4.nabble.com/How-to-resolve-**this-java-util-**
 ConcurrentModificationExceptio**n-tp4660273p4660725.htmlhttp://apache-wicket.1842946.n4.nabble.com/How-to-resolve-this-java-util-ConcurrentModificationException-tp4660273p4660725.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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




Re: How to resolve this java.util.ConcurrentModificationException

2013-08-06 Thread Dan Retzlaff
There isn't much information in that stack. Why don't you subclass LRUMap
with a custom writeObject() implementation? Then you can breakpoint it, log
from it, and maybe throw NotSerializableException to trigger Wicket
SerializableChecker which gives nicer output. That way it triggers every
time the map is serialized, not just when a concurrent modification happens.


On Tue, Aug 6, 2013 at 10:52 AM, saty satya...@gmail.com wrote:

 Thanks Mike,

 This is the complete exception trace, thanks for your help. It does appear
 that this is thrown when wicket trying to serialize page.


 06 Aug 2013 13:30:20.917 [http-apr--exec-3] ERROR
 o.a.w.serialize.java.JavaSerializer - Error serializing object class
 com.a.b.web.HomePage [object=[Page class = com.a.b.web.HomePage, id = 0,
 render count = 1]]
 org.apache.wicket.WicketRuntimeException:
 java.util.ConcurrentModificationException
 at

 org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:278)
 ~[wicket-core-6.6.0.jar:6.6.0]
 at
 java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
 ~[na:1.7.0_21]
 at

 org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:78)
 ~[wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.pageStore.DefaultPageStore.serializePage(DefaultPageStore.java:376)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:150)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:383)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:171)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.page.AbstractPageManager.commitRequest(AbstractPageManager.java:98)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.page.PageManagerDecorator.commitRequest(PageManagerDecorator.java:73)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.page.PageAccessSynchronizer$2.commitRequest(PageAccessSynchronizer.java:281)
 [wicket-core-6.6.0.jar:6.6.0]
 at org.apache.wicket.Application$2.onDetach(Application.java:1628)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:105)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:101)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.util.listener.ListenerCollection$1.notify(ListenerCollection.java:120)
 [wicket-util-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.util.listener.ListenerCollection.reversedNotify(ListenerCollection.java:144)
 [wicket-util-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.util.listener.ListenerCollection.reversedNotifyIgnoringExceptions(ListenerCollection.java:113)
 [wicket-util-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.request.cycle.RequestCycleListenerCollection.onDetach(RequestCycleListenerCollection.java:100)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.request.cycle.RequestCycle.onDetach(RequestCycle.java:619)
 [wicket-core-6.6.0.jar:6.6.0]
 at
 org.apache.wicket.request.cycle.RequestCycle.detach(RequestCycle.java:568)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:286)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:244)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:267)
 [wicket-core-6.6.0.jar:6.6.0]
 at

 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 [catalina.jar:7.0.39]
 at

 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 [catalina.jar:7.0.39]
 at

 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:344)
 [spring-security-web-3.0.0.M2.jar:na]
 at

 org.springframework.security.ui.ntlm.NtlmProcessingFilter.doFilter(NtlmProcessingFilter.java:355)
 [spring-security-ntlm-3.0.0.M2.jar:na]
 at

 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
 [spring-security-web-3.0.0.M2.jar:na]
 at

 org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:98)
 [spring-security-web-3.0.0.M2.jar:na]
 at

 

Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Dan Retzlaff
@Inject the implementation, not the interface. @Inject'd implementations
have some code smell, but no more than downcasting.


On Tue, Jul 23, 2013 at 8:40 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 That being the case, is there any way to get an instance that I can cast to
 a concrete type?


 On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.org
 wrote:

  Hi,
 
 
  On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com
  wrote:
 
   Hi,
  
   I'm having an issue that I suspect is related to the wicket integration
   with Guice. Any help is appreciated.
  
   I have a Page class that uses field injection to inject a DAO. I then
  want
   to cast my DAO to a more specific type (what I inject is the
 interface).
   Here's what that looks like
  
   public class CnavModify extends ConsoleBasePage {
  
   @Inject private CnavUrlDAO cnavUrlDAO;
   public CnavModify(PageParameters parameters) {
   super(parameters);
   if (parameters.get(cnavid).toString() != null) {
   cnavid = new ObjectId(parameters.get(cnavid).toString());
   }
   if (cnavid != null) {
   cnavUrlModel = new
  
  
 
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
   }
   }
   }
  
   When I try to cast it I get the following error:
  
   Last cause: $Proxy23 cannot be cast to
   com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO
  
   I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is
 $Proxy23
   and I am unable to cast it to a concrete type.
  
   Is this Guice or Wicket related? Any idea how to get around this?
  
 
  It is an error in your assumption.
 
  Wicket injects a proxy that implements CnavUrlDAO but knows nothing about
  the specific implementation about this interface.
  Whenever the proxy is used it delegates the call to the bean/service
  returned by Guice's injector (something like:
  Injector.getBinding(CnavUrlDAO.class).doSomething()).
 
 
  
   Thanks,
   Daniel
  
 



Re: Append elements in ajax request

2013-07-19 Thread Dan Retzlaff
Hi Bertrand,

You can render into a hidden div, then use some JavaScript to move them
into view. Something like this which uses jQuery.
response.render(OnDomReadyHeaderItem.forScript($('#hiddenfeedback
div').appendTo($('#visiblefeedback'));));

That behavior doesn't seem exactly right though. If a form is
AJAX-submitted twice with the same error, do you really want to show the
error twice?

We just allow user-initiated AJAX requests to re-render/clear the feedback
panel. Generally the user is either re-submitting a form, or
navigating/panel-swapping away. In either case the old feedback isn't
relevant anymore. In the few places where we have AJAX polling, e.g.
through AjaxSelfUpdatingTimerBehavior, we set a RequestCycle-scoped flag in
onTimer() or whatever to indicate that the request wasn't user-initiated.
This suppresses the feedback panel from being rendered. It's not pretty,
but it's what we do. :) Fortunately this polling stuff is going away as we
move to Wicket-Atmosphere.

Dan


On Fri, Jul 19, 2013 at 7:25 AM, Bertrand Guay-Paquet 
ber...@step.polymtl.ca wrote:

 Hello,

 I have a catch-all feedback panel which displays feedback messages at the
 top of my web pages. It slides-in the message boxes and adds a close link
 to each one.

 It also has an event handler which makes sure it redraws itself each time
 Wicket handles an ajax request:

 @Override
 public void onEvent(IEvent? a_event) {
 // This makes sure the panel always adds itself to the ajax
 response
 if (a_event.getPayload() instanceof AjaxRequestTarget) {
 ((AjaxRequestTarget) a_event.getPayload()).add(**this);
 }
 }

 This way, I don't have to add it explicitly to the request target each
 time a component adds a session message.

 After each request, the default behavior is to clear all rendered feedback
 messages from the session. My problem is that each time an ajax request is
 made, the currently displayed feedback message list is replaced by a new
 one. This removes any unclosed messages still present from the DOM.

 How can I tell Wicket ajax to append DOM elements to a parent instead of
 re-rendering the parent and its children? Is there another solution?

 Not clearing the messages from the session and displaying them again is
 not an option because the fade-in animation would be repeated.

 Regards,
 Bertrand

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




Re: Grouping tags in a ListView without a parent tag

2013-07-19 Thread Dan Retzlaff
If you associate your ListView with a div that wraps your two li
elements, you can call item.setRenderBodyOnly(true) to suppress the div
from the markup. The two inner lis will remain.


On Fri, Jul 19, 2013 at 10:34 AM, Victor Dolirio Ferreira Barbosa 
victor...@gmail.com wrote:

 Hello Everybody,

 I got stuck in a situation that I could not resolve in a graceful way
 yet.

 I have in my HTML a menu built with ul and li tags and it use a
 separator concept. Like this:

 ul
   li class=separator/li
   li wicket:id=item class=itemAdmin/li

   li class=separator/li
   li class=itemHelp/li
 /ul

 What I want is to iterate a menu list in Java code with a Repeater but
 grouping 2 li tags in a way that it outputs the tag with its separator
 sibling.

 Its not possible to group them with another tag like a span or div, cause
 HTML don't render it.

 I naively tried to group them with a wicket:enclosure but it not worked.

 What is the better way to do this?

 --
 []s,
 Victor Dolirio
 http://victordolirio.com



Re: http://wicketinaction.com/ broken?

2013-07-19 Thread Dan Retzlaff
Busted for me.


On Fri, Jul 19, 2013 at 12:54 PM, William Speirs wspe...@apache.org wrote:

 Worked for me... try again?

 Bill-


 On Fri, Jul 19, 2013 at 2:52 PM, Gabriel Landon glan...@piti.pf wrote:

  Hi,
 
  The website wicketinaction.com seems to be down, only the home page is
  working.
  All the other pages return a 404.
 
  Where can I find a working version of the website?
 
  Regards,
  Gabriel.
 
 
 
 
  --
  View this message in context:
 
 http://apache-wicket.1842946.n4.nabble.com/http-wicketinaction-com-broken-tp4660379.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: http://wicketinaction.com/ broken?

2013-07-19 Thread Dan Retzlaff
Huh. Maybe some kind of dynamic DNS.

~$ wget http://wicketinaction.com/book/
--2013-07-19 13:35:29--  http://wicketinaction.com/book/
Resolving wicketinaction.com (wicketinaction.com)... 94.124.120.40
Connecting to wicketinaction.com (wicketinaction.com)|94.124.120.40|:80...
connected.
HTTP request sent, awaiting response... 404 Not Found
2013-07-19 13:35:29 ERROR 404: Not Found.


On Fri, Jul 19, 2013 at 1:26 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 works for me


 On Fri, Jul 19, 2013 at 1:19 PM, Dan Retzlaff dretzl...@gmail.com wrote:

  Busted for me.
 
 
  On Fri, Jul 19, 2013 at 12:54 PM, William Speirs wspe...@apache.org
  wrote:
 
   Worked for me... try again?
  
   Bill-
  
  
   On Fri, Jul 19, 2013 at 2:52 PM, Gabriel Landon glan...@piti.pf
 wrote:
  
Hi,
   
The website wicketinaction.com seems to be down, only the home page
 is
working.
All the other pages return a 404.
   
Where can I find a working version of the website?
   
Regards,
Gabriel.
   
   
   
   
--
View this message in context:
   
  
 
 http://apache-wicket.1842946.n4.nabble.com/http-wicketinaction-com-broken-tp4660379.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: Last cause: can't serialize class $Proxy23

2013-07-18 Thread Dan Retzlaff
No, Wicket is not trying to serialize your DAO. The exception occurs in the
action phase of the request handling. It looks like you've passed an object
to MongoDB which has a reference to the @Injected DAO, or at least to the
component that has the DAO. It's this MongoDB DefaultDBEncoder.writeObject
thing that's serializing/encoding something it shouldn't.

If it's not clear by inspection how the object being passed to save() holds
a reference (e.g. by being an inner class) then set a breakpoint and the
debugger should point to the offending reference.


On Thu, Jul 18, 2013 at 2:34 PM, Daniel Watrous dwmaill...@gmail.comwrote:

 I found that having my DAO implement Serializable got me past the
 exception.

 Is Wicket attempting to serialize my DAO?


 On Thu, Jul 18, 2013 at 11:24 AM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  My Wicket application uses Guice for DI and some AOP. I have successfully
  injected a DAO and used that to display records. However, when I try to
  save a new record in my form, I get the following exception
 
  
 
  Root cause:
 
  java.lang.IllegalArgumentException: can't serialize class $Proxy23
   at
 org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:270)
   at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
 
   at
 org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226)
   at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
   at
 org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226)
 
   at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
   at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120)
   at
 com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)
 
   at com.mongodb.OutMessage.putObject(OutMessage.java:289)
   at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:239)
   at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:204)
   at com.mongodb.DBCollection.insert(DBCollection.java:148)
 
   at com.mongodb.DBCollection.insert(DBCollection.java:91)
   at com.mongodb.DBCollection.save(DBCollection.java:810)
   at
 com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:731)
   at
 com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:793)
 
   at
 com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:787)
   at
 com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO.save(MorphiaCnavUrlDAO.java:50)
   at java.lang.reflect.Method.invoke(Method.java:601)
 
   at
 org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:435)
   at $Proxy23.save(Unknown Source)
   at
 com.hp.honeybadger.console.forms.CnavForm$1.onSubmit(CnavForm.java:72)
 
   at
 org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1253)
   at org.apache.wicket.markup.html.form.Form.process(Form.java:925)
   at
 org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:771)
 
   at
 org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:704)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at
 org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
 
   at
 org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
   at
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:240)
 
   at
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:226)
   at
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:854)
 
   at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
   at
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254)
   at
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211)
 
   at
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282)
   at
 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
   at
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
 
   at
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
   at
 com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
   at
 com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
 
   at
 com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
   at
 com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
   at
 org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)
 
   at
 

Re: How to resolve this java.util.ConcurrentModificationException

2013-07-16 Thread Dan Retzlaff
Wicket serializes access to each page instance, but provides no further
synchronization. Non-transient references to application data must be
synchronized by you.


On Tue, Jul 16, 2013 at 2:39 PM, saty satya...@gmail.com wrote:

 Thanks, but could you please explain how wicket handles serialization of
 objects that could throw this error.
 I could be wrong but it appears to me wicket is iterating the data
 structure
 for its serialization efforts when its being modified by other threads as
 well and the iteration results in ConcurrentModificationException being
 thrown by data structure iterator.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-this-java-util-ConcurrentModificationException-tp4660273p4660296.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: Juniper Systems Network Filters Recently Updated Block Some Wicket URLs

2013-06-14 Thread Dan Retzlaff
Wild guess: link in query parameter is suspected of injecting malicious
link into application's rendered page.


On Fri, Jun 14, 2013 at 9:41 AM, Sven Meier s...@meiers.net wrote:

 Thanks for your information.

 I wonder what embedded HTML Script Tag Juniper sees in the given url:


 http://130.126.114.121/**cgdashboard/?wicket:interface=**
 :1:pubpan:publishersform:**datatable:body:rows:2:cells:1:**
 cell:actionlink::ILinkListenerhttp://130.126.114.121/cgdashboard/?wicket:interface=:1:pubpan:publishersform:datatable:body:rows:2:cells:1:cell:actionlink::ILinkListener

 Sven



 On 06/14/2013 04:37 PM, Duane Searsmith wrote:

 Hi,

 I work in a user group at a large US university that uses Juniper Networks
 security software to filter traffic on the borders of their campus
 network.  I administer a wicket web app that has been running just fine
 for
 the last 2 years.  Last Saturday, certain wicket generated URLs were not
 being successfully passed through the aforementioned filter. Long story
 short and one week later, turns out that their was a recent update made to
 one of the filter signatures that causes this problem, and when the
 signatures were updated to the campus filter software our problems began.
 Fortunately the network admins recognized this as a false positive and
 agreed to disable this signature.

 I'm posting this message to let folks know that this is an issue.  I have
 posted the info about the error below with an example of a URL that is
 blocked going from the browser to the web app.

 ==
 Example url that was being blocked:

 http://xxx.http://130.126.**114.121/cgdashboard/?wicket:**
 interface=:1:pubpan:**publishersform:datatable:body:**
 rows:2:cells:1:cell:**actionlink::ILinkListenerhttp://130.126.114.121/cgdashboard/?wicket:interface=:1:pubpan:publishersform:datatable:body:rows:2:cells:1:cell:actionlink::ILinkListener
 
 xxx
 .xxx.xxx//?wicket:**interface=:1:pubpan:**
 publishersform:datatable:body:**rows:2:cells:1:cell:**
 actionlink::ILinkListenerhttp**://130.126.114.121/**
 cgdashboard/?wicket:interface=**:1:pubpan:publishersform:**
 datatable:body:rows:2:cells:1:**cell:actionlink::ILinkListenerhttp://130.126.114.121/cgdashboard/?wicket:interface=:1:pubpan:publishersform:datatable:body:rows:2:cells:1:cell:actionlink::ILinkListener
 **
 ::

 ==
 Error generated at the filter:

 The traffic to that host is triggering and IDP error
 HTTP:XSS:HTML-SCRIPT-IN-URL-**VAR
 which the vendor describes as:

 Juniper Networks
 Solutions
 Products  Services
 Company
 Partners
 Support
 Education
 Signature Detail
 Security Intelligence Center
 Signatures
 Print
 Share
 Short Name
  HTTP:XSS:HTML-SCRIPT-IN-URL-**VAR
 Severity
  High
 Recommended
  Yes
 Recommended Action
  Drop
 Category
  HTTP
 Keywords
  CSS XSS Cross Site Scripting KB983438 39776
 Release Date
  2003/12/17
 Update Number
  1213
 Supported Platforms
  di-5.3+, idp-4.0+, isg-3.0+, j-series-9.5+, mx-9.4+, srx-9.2+,
 srx-branch-9.4+

 HTTP: HTML Script Tag Embedded in URL Variables

 This signature detects attempts at cross-site scripting attacks. Attackers
 can create a malicious Web site that includes HTML embedded in the
 hyperlinks, which can violate site security settings. A victim that
 accesses these hyperlinks can allow the attacker to view the victim's Web
 cookies. Web cookies typically contain sensitive information. This
 technique is also used by some advertisement company to gather information
 about people, since the extend of the information gathered cannot be
 controlled, this behavior is considered by default malicious.

 ===

 Best,
 Duane



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




Re: wicket-atmosphere issues

2013-06-11 Thread Dan Retzlaff
On Tue, Mar 26, 2013 at 4:31 AM, Emond Papegaaij emond.papega...@topicus.nl
 wrote:

 On Monday 25 March 2013 00:59:30 Leonid Bogdanov wrote:
  3) In my app Apache Shiro framework is integrated via a plugin adapted
  from fiftyfive-wicket-shiro project. User credentials are checked in an
  AJAX login form. In order to prevent a session fixation attack there is a
  call to invalidate old and create new session right before credentials
  check: getSession().replaceSession(); // inside
  AjaxFallbackButton.onSubmit() After integration with Atmosphere this code
  no longer works, an exception in thrown on login attempt:
 
 cut IllegalStateException in Session
 I'm not sure what happens here. It seems Wicket tries to read an attribute
 from the invalidated session. Does this happen even without a suspended
 connected?


I encountered this same issue, and traced it back to the AtmosphereRequest
caching and returning the original session, even after it had been
invalidated and replaced. I reported it upstream.
https://github.com/Atmosphere/atmosphere/pull/1139

Dan


Re: PageableListView with two rows

2013-06-10 Thread Dan Retzlaff
Hi Pierre,

Associate your PageableListView with a div that wraps your two trs.
Use item.setRenderBodyOnly(true) to prevent the div from being rendered
so your table markup is still valid.

Dan


On Mon, Jun 10, 2013 at 12:49 PM, Pierre Goupil goupilpie...@gmail.comwrote:

 Good evening,

 Is there a way to have a PageableListView with two rows?

 Here is my code:

 final PageableListViewProfile columnListView = new
 PageableListViewProfile(
 columnListView, secondLine, SearchPage.RESULTS / 2)
 {
 private static final long serialVersionUID = 1L;

 @Override
 protected void populateItem(final ListItemProfile item)
 {
 final IModelProfile p = item.getModel();

 item.add(new ProfilePanel(profile, p));
 }
 };

 this.add(columnListView);
 this.add(new AjaxPagingNavigator(navigator, columnListView));

 It works perfectly well for one line of results, but I'd like to have two
 lines of 4 columns instead of one line of 8 columns.

 I don't think a DataTable would fit my needs since the ProfilePanel object
 is a complex display.

 Any help will be much appreciated.

 Regards,

 Pierre


 --
 Un truc bien avec la musique, c'est que quand elle te frappe, tu n'as pas
 mal.
 Alors frappez-moi de musique !
 Frappez-moi de musique, maintenant !

 (Bob Marley : Trenchtown Rock)



Re: PageableListView with two rows

2013-06-10 Thread Dan Retzlaff
Maybe I just don't understand your requirements. I thought you want two
rows for each Profile. So:

add(new PageableListView(profile, profiles) {
  populateItem(item) {
item.add(new Label(row1column1));
item.add(new Label(row2column1));
item.setRenderBodyOnly(true);
  }
});

table
div wicket:id=profile
  trtd wicket:id=row1column1/td/tr
  trtd wicket:id=row2column1/td/tr
/div
/table

Obviously you can add as many columns as you'd like.


On Mon, Jun 10, 2013 at 1:58 PM, Pierre Goupil goupilpie...@gmail.comwrote:

 I'm sorry, but I don't understand what you mean. I've tried this:

 table class=large-space-centered-table align=center
 div wicket:id=columnListView
 tr wicket:id=separator
 td class=normal-text border-cell
 span wicket:id=profile/span
 /td
 /tr
 /div
 /table




 final PageableListViewProfile columnListView = new
 PageableListViewProfile(
 columnListView, allMatches, SearchPage.COLUMNS)
 {
 private static final long serialVersionUID = 1L;

 @Override
 protected void populateItem(final ListItemProfile item)
 {
 final IModelProfile p = item.getModel();

 final WebMarkupContainer separator = new
 WebMarkupContainer(separator);
 if (item.getIndex() == (SearchPage.COLUMNS / 2))
 {
 separator.setRenderBodyOnly(false);
 }
 else
 {
 separator.setRenderBodyOnly(true);
 }

 separator.add(new ProfilePanel(profile, p));
 item.add(separator);
 }
 };

 columnListView.setRenderBodyOnly(true);
 this.add(columnListView);
 this.add(new AjaxPagingNavigator(navigator, columnListView));




 I think I did what you've suggested but instead of two rows of 5 columns, I
 got one line of 5 columns, one of one column and a last line of 4 columns.
 I've missed something, I'm afraid.

 Thank you anyway!

 Regards,

 Pierre




 On Mon, Jun 10, 2013 at 10:17 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:

  Hi Pierre,
 
  Associate your PageableListView with a div that wraps your two trs.
  Use item.setRenderBodyOnly(true) to prevent the div from being rendered
  so your table markup is still valid.
 
  Dan
 
 
  On Mon, Jun 10, 2013 at 12:49 PM, Pierre Goupil goupilpie...@gmail.com
  wrote:
 
   Good evening,
  
   Is there a way to have a PageableListView with two rows?
  
   Here is my code:
  
   final PageableListViewProfile columnListView = new
   PageableListViewProfile(
   columnListView, secondLine, SearchPage.RESULTS / 2)
   {
   private static final long serialVersionUID = 1L;
  
   @Override
   protected void populateItem(final ListItemProfile item)
   {
   final IModelProfile p = item.getModel();
  
   item.add(new ProfilePanel(profile, p));
   }
   };
  
   this.add(columnListView);
   this.add(new AjaxPagingNavigator(navigator, columnListView));
  
   It works perfectly well for one line of results, but I'd like to have
 two
   lines of 4 columns instead of one line of 8 columns.
  
   I don't think a DataTable would fit my needs since the ProfilePanel
  object
   is a complex display.
  
   Any help will be much appreciated.
  
   Regards,
  
   Pierre
  
  
   --
   Un truc bien avec la musique, c'est que quand elle te frappe, tu n'as
  pas
   mal.
   Alors frappez-moi de musique !
   Frappez-moi de musique, maintenant !
  
   (Bob Marley : Trenchtown Rock)
  
 



 --
 Un truc bien avec la musique, c'est que quand elle te frappe, tu n'as pas
 mal.
 Alors frappez-moi de musique !
 Frappez-moi de musique, maintenant !

 (Bob Marley : Trenchtown Rock)



Re: Handling user-specific timezones

2013-05-09 Thread Dan Retzlaff
Thanks, Bertrand.

On Thu, May 9, 2013 at 9:47 AM, Bertrand Guay-Paquet ber...@step.polymtl.ca
 wrote:

  Do you avoid MessageFormats in StringResourceModels? (I don't see a way to
 configure its MessageFormat.)

 I convert my Dates to strings with the proper converter before passing
 them on to string resources.


If StringResourceModel accounted for the session's timezone (like
wicket-datetime's DateConverter), would you consider using
MessageFormat-based resources? Or is there another advantage to converting
to String in application code? This is an example of what I'd like to make
sensitive to user timezone, but don't see how.

localtime=Your local time is {0,time,medium}
add(new Label(localtime, new StringResourceModel(localtime, null, new
Date(;

Instead I have essentially:
localtime=Your local time is {0}
add(new Label(localtime, new StringResourceModel(localtime, null,
MySession.formatTime(new Date(), DateFormat.MEDIUM;

Using converters with applyTimeZoneDifference=true works fine for me once
 the timezone is set in the Session.


Holy smokes, I didn't realize wicket-datetime wasn't on my classpath! The
Joda-based classes there definitely obviate a couple of my classes.

1-The application's JVM and joda-time default time zones are UTC
 (-Duser.timezone=UTC). Throw an exception in application init if that's not
 the case.
 2-MySQL is set to the UTC timezone (default-time-zone=UTC)


That's hardcore to require that in dev environments. We've been allowing
system time in dev, and UTC in CI builds, stage and prod. I'll think about
moving dev over. I can't say we haven't had bugs because of the
inconsistency.


 3-MySQL jdbc connector: set useLegacyDatetimeCode=false


This protects against issues with Calendars in your JPA entities / JDBC
statements, right? We use j.u.Date pretty consistently in entities so I
think this is not relevant to us. That's a good bug to know about, and it's
too bad they can't simply default to the improved behavior.

4-Never store timezone information in database date fields


AFAIK, neither DATETIME nor TIMESTAMP actually stores the timezone, so I'm
not sure what you're warning against specifically.

We use TIMESTAMP for auto-updated fields (created, updated), and DATETIME
elsewhere. I think our system would be simpler if we used TIMESTAMP
consistently. TIMESTAMP's use of millis reduces impedance mismatch with
Java types, and the automatic conversion into DB session's timezone makes
business analytics easy to run in any timezone without lots of CONVERT_TZ.
Plus TIMESTAMP is 4 bytes vs DATETIME's 8 bytes. We have only a couple of
use cases that actually need wall clock time.

(I know this discussion deviates from Wicket, but I'm trying to develop a
holistic view.)

Dan


Handling user-specific timezones

2013-05-08 Thread Dan Retzlaff
Hi all,

I'd like to know what conventions you've established for your sites that
deal with users in many time zones.

Do you simply replace the converters (Date, SqlDate, SqlTime, SqlTimestamp)?

Do you avoid MessageFormats in StringResourceModels? (I don't see a way to
configure its MessageFormat.)

We currently bypass this stuff and do our formatting with application
utility methods, and adapting input into users' timezones as manual steps,
e.g. with Joda-Time's DateTime#withZoneRetainFields().

I'd like to sweep this stuff under the rug with some application-level
configuration, e.g. of converters. But before I embark, I was hoping to
hear from someone who's already gone on this journey.

And related: maybe you have some golden rules time zone handling to share?
A couple of mine are:
1. Avoid date types in SQL tables because it's hard to correctly compare
to now across timezones.
2. Anything that shifts millis to adjust for timezones is a red flag
(including the aforementioned #withZoneRetainFields() sadly).
3. java.util.Date is evil and you should avoid it whenever possible.
Calendar is marginally better, but Joda-Time is the way to go.

Thanks,
Dan


Re: May Ajax handlers in Wicket 6 slow down rendering?

2013-05-02 Thread Dan Retzlaff
Martin-G elaborated a bit on this last year:
http://mail-archives.apache.org/mod_mbox/wicket-users/201209.mbox/%3ccamomwmqdf3ytlstb_kbnvn9t1pump_-+npdtmtvyt+ac6ec...@mail.gmail.com%3E

I think the gist is that you can avoid attaching listeners to each child
with a single listener on the parent with enough smarts to figure out which
child generated the event.


On Thu, May 2, 2013 at 3:25 PM, Martin Dietze d...@fh-wedel.de wrote:

 Than you for your help!

 On Thu, May 02, 2013, Martin Grigorov wrote:

   long blocks of Javascript code executed at domready.
  
 
  This depends on how many Ajax components/behaviors you have in your page
  and how many OnDomReadyHeaderItems are contributed.
 
  If you use JavaScript event delegation with Wicket Ajax Behavior that
  broadcasts events then you can decrease this dramatically.

 That sounds interesting, but - forgive me my ignorance - this is
 the first time I hear about this kind of thing. Can you hint me
 at some example?

 Cheers,

 M'bert

 --
 --- / http://herbert.the-little-red-haired-girl.org /
 -
 =+=
 Katz' Law: Man and nations will act rationally when all other
possibilities have been exhausted.

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




Re: Interpolating variables inside web.xml

2013-04-20 Thread Dan Retzlaff
No, sorry. I'm familiar with Spring's PropertyPlaceholderConfigurer, but
that only pulls properties into context definitions. The deployment
descriptor lives outside of that, so that approach does not make sense to
me.


On Sat, Apr 20, 2013 at 5:30 AM, Leonardo D'Alimonte 
leonardo.dalimo...@loginet.it wrote:

 Actually we have another WebApplication integrated with Spring where used
 successfully this interpolation mechanism, unfortunately I can't find the
 exact place where this behaviour is coded inside the webapp.

 Do you have any idea where i can look inside the xml's configuration?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Interpolating-variables-inside-web-xml-tp4658095p4658139.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: Interpolating variables inside web.xml

2013-04-19 Thread Dan Retzlaff
No, I don'It can't interpolate a deployment descriptor.


On Fri, Apr 19, 2013 at 1:17 AM, Leonardo D'Alimonte 
leonardo.dalimo...@loginet.it wrote:

 Hey Dan,

 Maven War plugin is working fine as you suggested, it interpolates the
 ${wicket.configuration} variable correctly.
 I would like to see the same magic also when I launch the mvn jetty:run
 command, so that using maven profiles i can change the configuration of
 Wicket (6.6.0) when I run my WebApplication for testing or whatever.

 May the Spring framework be also responsable for the interpolation?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Interpolating-variables-inside-web-xml-tp4658095p4658106.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: Interpolating variables inside web.xml

2013-04-19 Thread Dan Retzlaff
Oops, premature send. :)

No, I don't think it can interpolate a deployment descriptor. I'd look into
specifying a custom application factory that uses whatever strategy you
want. See WicketFilter for details. I haven't used Spring for web stuff in
years. With Guice it's easy to use a custom WicketFilter subclass that
instantiates the app through the injector, and does whatever configuration
you need. This is described here:
http://software.danielwatrous.com/wicket-guice-including-unittests/ I'd
guess that Spring provides a similar capability.


On Fri, Apr 19, 2013 at 10:44 AM, Dan Retzlaff dretzl...@gmail.com wrote:

 No, I don'It can't interpolate a deployment descriptor.


 On Fri, Apr 19, 2013 at 1:17 AM, Leonardo D'Alimonte 
 leonardo.dalimo...@loginet.it wrote:

 Hey Dan,

 Maven War plugin is working fine as you suggested, it interpolates the
 ${wicket.configuration} variable correctly.
 I would like to see the same magic also when I launch the mvn jetty:run
 command, so that using maven profiles i can change the configuration of
 Wicket (6.6.0) when I run my WebApplication for testing or whatever.

 May the Spring framework be also responsable for the interpolation?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Interpolating-variables-inside-web-xml-tp4658095p4658106.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: Interpolating variables inside web.xml

2013-04-18 Thread Dan Retzlaff
If you're using maven-war-plugin, you probably need to enable filtering of
deployment descriptors.
http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#filteringDeploymentDescriptors


On Thu, Apr 18, 2013 at 9:23 AM, Leonardo D'Alimonte 
leonardo.dalimo...@loginet.it wrote:

 Hi everybody,

 I'm trying to set the wicket.configuration property inside web.xml of my
 new WebApplication.
 The way I'm trying this is interpolating a ${wicket.configuration} variable
 with this snippet:
 ..
 init-param
 param-nameconfiguration/param-name
 param-value${wicket.configuration}/param-value
 /init-param
 ...

 from a property of a profile written inside the pom.xml of the project
 ..
 profile
 idrelease/id
 wicket.configurationdeployment/wicket.configuration
 .

 Unfortunately it's still not working, I've tried many solutions but without
 success...

 Do you have any ideas...suggestionsspellspotions?

 Thanks in advance.

 Leonardo



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Interpolating-variables-inside-web-xml-tp4658095.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: FileUploadField best approach to populating a file

2013-04-08 Thread Dan Retzlaff
If I understand you, the user uploads an Excel template, and the response
is a populated version of that template. In this case, your form's
onSubmit() should
1. get the template from an enclosed FileUploadField's model,
2. create a new file for download (temp directory is okay), and
3. schedule a ResourceRequestHandler to return that file.

The last can be accomplished with:
  IResource resource = new AbstractResource() {
protected ResourceResponse newResourceResponse(Attributes attributes) {
/* TODO */ }
  };
  RequestCycle.get().replaceAllRequestHandlers(new
ResourceRequestHandler(resource, null));

See ByteArrayResource for an example of constructing a resource response.
The OutputStream you want is in the Attributes object given to your
WriteCallback.

Dan


On Mon, Apr 8, 2013 at 4:26 PM, mohallo moha...@qwest.com wrote:

 I have an Excell file that I want to populate with Data .
 I am using the FileUploadField component to do this .
 The user locates the file that they want to populate throgh the microsoft
 popup window .
 The issus I am having is locating an OutputStream to populate .
 When I access a fileItem OutputStream it is pointing to a Temp location .

 Any Ideas how to approach this .

 Thanks for your help .



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/FileUploadField-best-approach-to-populating-a-file-tp4657832.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: Using Wicket-autocomplete.js in own custom textfield

2013-04-03 Thread Dan Retzlaff
Hi Merlijn,

This is not a direct response to your question, but did you consider
wicket-select2 as an alternative to AutoCompleteTextField?
https://github.com/ivaynberg/wicket-select2

I don't know the specific navigation features you're talking about, but in
our experience Select2 is a dramatic improvement to user (and developer!)
experience.

Dan


On Wed, Apr 3, 2013 at 1:08 AM, Merlijn lucas...@gmail.com wrote:

 Hi everybody,

 I am writing my own AutoCompleteTextField to be able to use Components in
 the list instead of the default Strings. Now I want to have all the same
 navigation features that the AutoCompleteTextField from Wicket has such as
 keyboad navigation, etc. I was wondering if it possible to use the default
 js file from Wicket or if not if there is a library that makes this task a
 little easier.

 Kind regards,

 Merlijn



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-autocomplete-js-in-own-custom-textfield-tp4657702.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: Best way to get the base application URL?

2013-04-03 Thread Dan Retzlaff
How about:

Url relative = Url.parse(getRequest().getContextPath());
String full = getRequestCycle().getUrlRenderer().renderFullUrl(relative);

Dan


On Wed, Apr 3, 2013 at 5:44 AM, Andrea Del Bene an.delb...@gmail.comwrote:

 Hi,

 do you know the best way to get the base URL for our Wicket application?
 For example

 http://www.mysite.com/**myapplicationhttp://www.mysite.com/myapplication
 

 I'm using the following code at the moment:


 protected CharSequence extractBaseUrl(Request request) {
 Url originalUrl = request.getOriginalUrl();
 CharSequence baseUrl = originalUrl.getProtocol() + :// +
 originalUrl.getHost() +
 : + originalUrl.getPort() +
 request.getContextPath();


 return baseUrl;
 }

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




Re: Denver

2013-04-03 Thread Dan Retzlaff
You bet! I'm just up the road in Boulder. Happy to meet up in any of the
abundant local breweries.


On Wed, Apr 3, 2013 at 8:01 PM, Jonathan Locke jonathan.lo...@gmail.comwrote:

 Hey there! Any Wicket people in Denver? I'm going on a trip from the 13th
 to
 the 21st of April and wanted to find out a bit about the local tech
 scene...



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Denver-tp4657726.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: Best Way to Perform a Quick Test

2013-04-01 Thread Dan Retzlaff
I think you misunderstand serialization. Only class member data is
serialized, plus a small amount of metadata like the class name and a
version. Normal methods, and any logging in those methods, have no effect
on serialized output. If you tried printing and it didn't work, please
share your code.

On Mon, Apr 1, 2013 at 7:51 AM, madmax108 lifeofna...@gmail.com wrote:

 Hi, I'm just beginning with Wicket Development. I've been used to Java
 development where, when I want to perform a quick test, I simply add a
 sysout to see if a certain code segment is being reached eg.
 System.out.println(Segment 1 reached) or to find out what is being
 returned by a database call eg.
 System.out.println(makeDatabasecall().toString()) and so on. I know this is
 not the best way to debug code, but for minor projects, it makes sense to
 be
 quick testing.

 But as Wicket needs everything to be serialized, adding sysouts breaks the
 code.

 What is the best quick way to perform simple variable value checks (and
 print them out on a console/UI) using Wicket?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Best-Way-to-Perform-a-Quick-Test-tp4657669.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: Wicket and tomcat cluster

2013-03-29 Thread Dan Retzlaff
If you go non-sticky you'll need to experiment with RenderStrategy. Each
has it's pros and cons, and I don't have experience to advise you further.

Yes if you want the user to interact with more than one page at a time
you'll need to make sure they're all available. You'll also need to
replicate synchronously to all nodes.

Since Wicket is a stateful framework, it's simply not well-suited to
nonsticky deployment IMO, and you should just enable stickiness. In the off
chance of a server failure user loses some page history, but at least they
stay logged in and don't lose their current activity.

I've wondered at possibility of replication listener on failover nodes that
maintains complete local disk page store. Not sure if/which containers
provide such hooks.

Dan
On Mar 29, 2013 1:06 AM, Marios Skounakis msc...@gmail.com wrote:

 Dan, thanks for you answer.

 As you said, with the default implementation of DiskDataStore only the most
 recent page is kept in the session state and available on all servers. So
 are using non-sticky sessions and having a stateful page open a modal
 window with a new stateful page will not work. Correct?



 On Thu, Mar 28, 2013 at 10:37 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:

  Sorry I mistyped: default is REDIRECT_TO_BUFFER.
 
  On Thu, Mar 28, 2013 at 2:36 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
 
   Hi Marios,
  
   This behavior is determined by IDataStore interface. DiskDataStore is
  used
   by default, so only the most recent page is kept in the session (and
   available for failover). It puts page history into a directory
 specified
  in
   javax.servlet.context.tempdir servlet attribute (under work
 directory
   in Tomcat). If you want more page history available on failover,
 specify
  a
   IPageManagerProvider in your Application#init() that constructs
   HttpSessionDataStore instead. Note HttpSessionDataStore's
   IDataStoreEvictionStrategy dependency which keeps session usage under
   control.
  
   If Wicket clustering is new to you, also note that Wicket
   uses RenderStrategy.REDIRECT_TO_RENDER by default. See javadoc for
  details,
   but in short: you should configure your load balancer for sticky
  sessions.
  
   Dan
  
   On Thu, Mar 28, 2013 at 2:17 PM, Marios Skounakis msc...@gmail.com
  wrote:
  
   Hi all,
  
   I
   'm planning to setup a terracotta tomcat cluster. The wicket site
 claims
   that all Wicket applications will work on a cluster automatically and
   without additional work
   
   .
  
   I understand that basically since session state is kept in
 serializable
   objects within the http session, it mostly works.
  
   But is it true that NO changes are needed? Do I need to change any
   settings? What does the page store do once it has to push a page from
   memory to disk?
  
  
   T
   hanks in advance
   Marios
  
  
  
 



Re: Proper resource versioning

2013-03-28 Thread Dan Retzlaff
Inline...

On Wed, Mar 27, 2013 at 10:41 PM, Bertrand Guay-Paquet 
ber...@step.polymtl.ca wrote:

 First, when you say you serve files out of webapp folder, do you mean
 you're not using any ResourceReference?

 To answer your question, here's what I use to access my webapp resources:
 -ContextImage which uses context-relative urls
 -RelativePathPrefixHandler which handles hrefs in the markup and makes
 them context-relative
 -UrlResourceReference with, again, context-relative urls


Since your stated goal is better control of caching and versioning, with a
mind to eventual use of CDN, I think this approach is limiting. Changing
images and fonts usually involves files with new names, so there is no
caching problem here. But you probably don't want to manually rename your
CSS every time you tweak a style rule. If you make these resources, then
Wicket's default caching strategy
(FilenameWithVersionResourceCachingStrategy + MessageDigestResourceVersion)
will add an MD5 of the content to the filename, forcing browsers to request
the new CSS. It is our experience that modification timestamps (which is
all your web container can use) are not sufficient. The comment
on QueryStringWithVersionResourceCachingStrategy indicates that we're not
the only ones to notice this-- even versioned query parameters may not be
enough!

What does LESS mean in the first line of the paragraph above? Do you do
 anything special to flatten the css files?


What Martin said. Our CSS files are compiled at build time
with lesscss-maven-plugin.


 So, to not worry about relative-path includes from CSS, you must make
 the images non-versioned, correct? Do you do this using ResourceReferences
 and IStaticCacheableResource#**isCachingEnabled() ?


Partially correct. Images are not versioned in the sense that their
filenames have no version in them. But when I talk about relative-path
includes, I don't mean any kind of ResourceReference. I simply mean CSS
style rules like:
.icon-white { background-image: url('../images/glyphicons-halflings.png'); }

The image always gets loaded from the same server as the CSS. So if we
decorate resource URLs to point at a CDN, the CSS file gets loaded from CDN
and so do any fonts and images to which it refers.

I haven't had a chance to do this yet, but I'm looking forward to trying
the RemoteHostResourceMount in WicketStuff described here:
http://techblog.molindo.at/2011/03/serving-wicket-resources-from-cdn.html

Quite simple if your resources are served through ResourceReferences, but I
think not so simple with ContextImage and friends.

If you use ResourceRefenrecs, does that mean that all your assets (css, js,
 images,...) are stored along with the java class files (i.e.
 src/main/resources in Maven terms) ?


Yes, because we use PackageResourceReference, all assets are on the
classpath.

To be honest, most assets are not finely split into component-specific Java
packages as prevailing wisdom would suggest. Our designers prefer having
their assets in big buckets. So we created a separate Maven artifact with a
directory structure they're happy with (not /src/main/resources, sadly).
Previously we used maven-assembly-plugin to assemble this into a directory
that got served directly from HTTPD (not Wicket) from a top-level /assets
folder. But to solve the CSS caching problems I described previously, we
changed this assets artifact into a JAR deployed with the Wicket app. The
JAR has a class with simple, static factory methods for script, css, and
image HeaderItems.

Obviously if your goal is reusable, self-contained components this approach
is not a good one. But I suppose serving assets from webapp folder already
breaks encapsulation.


 Thanks again!


My pleasure.

Dan


Re: Proper resource versioning

2013-03-28 Thread Dan Retzlaff
On Thu, Mar 28, 2013 at 7:27 AM, Pointbreak
pointbreak+wicketst...@ml1.netwrote:

 I don't think there's anything wrong with serving resources from the
 webapp-folder,


I agree, it can work well for some use cases. But if you want better
control over caching, and the ability point all rendered resource
references to a CDN with a little configuration code, then maybe serving
through Wicket gives you more options.

Dan


Re: how to log an External Link

2013-03-28 Thread Dan Retzlaff
An external link by definition does not make a request to your Wicket
application. The user simply bounces off to the given URL. Consider using a
normal Link, and throwing RedirectToUrlException in its onClick.

On Thu, Mar 28, 2013 at 9:44 AM, Karl-Heinz Golz 
karl-heinz.g...@t-online.de wrote:

 hello,

 I need a link to outside of my wicket application and I'am using an
 ExternalLink for that. That works well.

 Now I would like to write a log message when a user clicks on that link.
 Their is no onClick() and I can't figure out, how to achieve that.

 Suggestions are very welcome.

 Thanks in advance
 Karl


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




Re: Events: Atmosphere vs. Guava vs Wicket native

2013-03-28 Thread Dan Retzlaff
Hi Jarnis. Since this didn't generate a response, I'll share some thoughts.
First a disclaimer: I haven't used Wicket-Atmosphere yet, but I've read
what there is to read and am looking forward to it. (We have several use
cases that will benefit greatly.)

Are there any good arguments for not just using Atmosphere events throughout
 the application, completely avoiding Wicket and Guava events?


Are these events changing the DOM in ways Wicket should know about? It
seems like most non-trivial event content would require corresponding
changes to your Wicket component graph, e.g. preparing for clicks. But if
you have a container that doesn't need to interact with Wicket, and you
don't mind writing the client- and server-side plumbing directly, maybe it
makes sense.


 Are there significants advantages (for instance performance related) to
 using wicket
 native events for the component-component messaging?


Wicket's built-in events work well within the Wicket architecture. If a
random event comes in on a Guava bus, you have to ask yourself, okay now
how do I get access to this or that component that's serialized in the page
store? Wicket events have well-defined access to the important objects
(Application, Session, RequestCycle, Page, Components), and a simple way to
target only a subset of those.

I don't think server-side performance should be your concern here. Unless
you have a super crazy component count Wicket events are plenty fast.

Hope that helps.

Dan


Resource Serving Performance Comparison

2013-03-28 Thread Dan Retzlaff
http://www.techempower.com/blog/2013/03/28/framework-benchmarks/

For what it's worth :)

Dan


Re: Wicket and tomcat cluster

2013-03-28 Thread Dan Retzlaff
Hi Marios,

This behavior is determined by IDataStore interface. DiskDataStore is used
by default, so only the most recent page is kept in the session (and
available for failover). It puts page history into a directory specified in
javax.servlet.context.tempdir servlet attribute (under work directory
in Tomcat). If you want more page history available on failover, specify a
IPageManagerProvider in your Application#init() that constructs
HttpSessionDataStore instead. Note HttpSessionDataStore's
IDataStoreEvictionStrategy dependency which keeps session usage under
control.

If Wicket clustering is new to you, also note that Wicket
uses RenderStrategy.REDIRECT_TO_RENDER by default. See javadoc for details,
but in short: you should configure your load balancer for sticky sessions.

Dan

On Thu, Mar 28, 2013 at 2:17 PM, Marios Skounakis msc...@gmail.com wrote:

 Hi all,

 I
 'm planning to setup a terracotta tomcat cluster. The wicket site claims
 that all Wicket applications will work on a cluster automatically and
 without additional work
 
 .

 I understand that basically since session state is kept in serializable
 objects within the http session, it mostly works.

 But is it true that NO changes are needed? Do I need to change any
 settings? What does the page store do once it has to push a page from
 memory to disk?


 T
 hanks in advance
 Marios



Re: Wicket and tomcat cluster

2013-03-28 Thread Dan Retzlaff
Sorry I mistyped: default is REDIRECT_TO_BUFFER.

On Thu, Mar 28, 2013 at 2:36 PM, Dan Retzlaff dretzl...@gmail.com wrote:

 Hi Marios,

 This behavior is determined by IDataStore interface. DiskDataStore is used
 by default, so only the most recent page is kept in the session (and
 available for failover). It puts page history into a directory specified in
 javax.servlet.context.tempdir servlet attribute (under work directory
 in Tomcat). If you want more page history available on failover, specify a
 IPageManagerProvider in your Application#init() that constructs
 HttpSessionDataStore instead. Note HttpSessionDataStore's
 IDataStoreEvictionStrategy dependency which keeps session usage under
 control.

 If Wicket clustering is new to you, also note that Wicket
 uses RenderStrategy.REDIRECT_TO_RENDER by default. See javadoc for details,
 but in short: you should configure your load balancer for sticky sessions.

 Dan

 On Thu, Mar 28, 2013 at 2:17 PM, Marios Skounakis msc...@gmail.comwrote:

 Hi all,

 I
 'm planning to setup a terracotta tomcat cluster. The wicket site claims
 that all Wicket applications will work on a cluster automatically and
 without additional work
 
 .

 I understand that basically since session state is kept in serializable
 objects within the http session, it mostly works.

 But is it true that NO changes are needed? Do I need to change any
 settings? What does the page store do once it has to push a page from
 memory to disk?


 T
 hanks in advance
 Marios





Re: tomcat session replication

2013-03-27 Thread Dan Retzlaff
Hi, Sauli.

The context of your question is not clear to me. Are you trying to upgrade
a running cluster?

I have not used Nginx, but Apache HTTPD allows you to disable balancer
members from receiving new sessions. Alternatively, Tomcat 7 supports
parallel deployments so theoretically you can upgrade in-place [1]. In any
case, my understanding is that the main risk to abruptly taking a node down
is that the new node won't have users' page history (in DiskDataStore). His
current page and session state will however be available.

Any confirmation or correction of these statements from the community would
be appreciated.

Dan

[1] http://www.tomcatexpert.com/blog/2011/05/31/parallel-deployment-tomcat-7

On Wed, Mar 27, 2013 at 7:50 AM, sauli.ketola sauli.ket...@mbnet.fi wrote:

 Igor Vaynberg-2 wrote
  ..the loadbalancer is
  configured to only send new sessions to A while B is being starved
  of new sessions.

 I know this is an old thread but I found it just now when facing a similar
 case.
 Could you or someone explain more: How do you do this and what load
 balancer
 are you using for this? Do you know would nginx support this?

 I would guess that it would be pretty common to have to wait for sessions
 to
 die before starting to install the server but it seems to be pretty hard to
 find any concrete examples.

 If someone could point me to the right direction, I'd appreciate it.

 -Sauli




 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/tomcat-session-replication-tp1891781p4657571.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: Proper resource versioning

2013-03-27 Thread Dan Retzlaff
Hi, Bertrand. I don't have all your answers, but I can share my experience.

First, when you say you serve files out of webapp folder, do you mean
you're not using any ResourceReference? Just absolute paths from markup? I
think improving that is the first thing to do. You need to process resource
references in Java so you can introduce versions, CDN base URLs, etc.

The main caching problem we had was that after upgrades, some clients had
the old CSS cached and the site looked funky for them. So we went through
and made sure all CSS is served through PackageResourceReferences. Wicket's
default versioning strategy then did its magic and that complaint stopped.

With respect to @import, we have many @imports in our source LESS, but by
the time it's being served, the CSS is flat. So versioning that is enough.
It's possible but I think far less likely that this kind of caching problem
will happen for images and fonts. Direct references to these from our
application still go through ResourceReferences just so they can be served
from CDN, but we don't worry about relative-path includes from CSS.

Hope that helps.

Dan

On Wed, Mar 27, 2013 at 2:15 PM, Bertrand Guay-Paquet 
ber...@step.polymtl.ca wrote:

 Hello,

 I'm trying to figure out the optimal way to deal with caching and out of
 date resources and can't really find which methodology to adopt.

 Considering that:
 a) css and js files are only accessed from web pages
 b) image files are accessed from web pages and from email clients (links
 stored for a long time)
 c) image files are referenced from css (e.g. background-image url)
 d) font files are accessed from web pages and maybe eventually from email
 clients
 e) some css files currently use @import statements to include other css
 files (this could be removed if needed)
 f) css, js, fonts and images currently are all located in the webapp
 folder (i.e. I wasn't able to access them with PackageResourceReference)
 g) whatever the approach, it needs to be compatible with eventual usage of
 CDN services

 Questions:
 1- Which files should be versioned?
 2- Should they be versioned using Wicket's ResourceReferences?
 3- Are there other considerations I haven't thought about?
 4- Which successful approaches are in use now by other Wicker users?

 Thanks for your insight!

 Regards,
 Bertrand

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




Re: Adding a large amount of MarkupContainers into the ListView or RepeatingView

2013-03-26 Thread Dan Retzlaff
The javadoc for Component#put() refers to a now non-existent childForId
map which got removed 8 years ago [1]!

You might consider making your ListViewT into a ListViewListT and
splitting the original dataset into say 10k List#subLists. It ain't pretty,
but for a (nearly finished) app, it beats a serious architecture overhaul
or waiting for a dubious change to wicket-core. Throw in some
item.setRenderBodyOnly(true) and your markup will be none the wiser. :)

[1]
https://github.com/apache/wicket/commit/0a321ea04887a3113e183b46ab20c1c5d7022de0#wicket/src/java/wicket/MarkupContainer.java

On Tue, Mar 26, 2013 at 9:23 AM, Marco Springer ma...@glitchbox.nl wrote:

 I'm building a Gantt like interface with Wicket (nearly finished).
 It was a requirement to see multiple years of planned items, in the extreme
 range even.

 I've down-tuned it to be around max ~3k (8 years) of components in that
 listview, through the power of persuasion and as a test.
 At 3k components, the getId() method is called quite a reasonable amount of
 times. around 4.5M'ish times through the children_indexOf method.

 But you're absolutely right, 100k components is bull.

 Right now I've settled with them that I'd change the view of the Gantt to
 be
 less detailed when that amount of data is in there. The UI is quite
 flexible in
 that I can change what I render.

 With 2 years, only 731 columns are rendered, each day is a column.
 When  2 years, I change the view to a more zoomed out version.
 With 8 years, only 97 columns are rendered, each month being a column.

 Etc...

 Still with all the components taken in as it is a Gantt chart kinda
 interface,
 the browsers that I test in are only getting a bit sluggish when I'm
 displaying around 2k of components on this Intel Q8200.
 I'm not displaying any fancy gif's/flash or whatever, only allot of div's
 and
 some svg overlays through jsPlumb for dependency display.

 I mainly found it staggering that the getId() function was called that
 much.
 As Martin said, I'm targeting to limit the amount of components that
 should be
 rendered now, although sometimes hard with this kind of interface.

 Cheers.

 On Tuesday 26 March 2013 08:23:19 Igor Vaynberg wrote:
  putting a 10 components into a page is ill advised even if they
  are under different parents.

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




Re: readering strategy of the 'head' section

2013-03-25 Thread Dan Retzlaff
I've managed to avoid dealing with multiple versions of jQuery on the same
page. That sounds like a Bad Idea, and probably not necessary since in my
experience jQuery does a good job being backwards compatible. But if you
really must, http://api.jquery.com/jQuery.noConflict/ may be your ticket.

On Sun, Mar 24, 2013 at 11:22 PM, Harrie Hazewinkel
hhazewin...@gmail.comwrote:

 Hi Dan,

 Thanks for the example.

 On Mar 24, 2013, at 7:26 PM, Dan Retzlaff dretzl...@gmail.com wrote:
  Re: duplicate/conflicting contributions, Wicket automatically de-dups
  header contributions. See HeaderItem#getRenderTokens(). Since Wicket
 itself
  pulls in JQuery, your app's use of it should be configured
  through IJavaScriptLibrarySettings as shown here.

 Is that still the case when you have components that use different
 versions of
 jQuery, because the components come from different libraries?
 Guess not, but will give it a try.




 Harrie
 hhazewin...@gmail.com





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




Re: Serverside caching of IResource's that are expensive to generate

2013-03-25 Thread Dan Retzlaff
I believe Wicket's resource versioning and caching logic simply provides
advice in HTTP response headers, and decorates filenames if so configured.
Do your requests come directly to Wicket's container? We reverse proxy with
HTTPD, which is probably better at caching than a Java solution could ever
be.

On Mon, Mar 25, 2013 at 5:01 PM, Pointbreak
pointbreak+wicketst...@ml1.netwrote:

 I have implemented a LessCssResource (it generates a CSS resource from
 Less source files) + LessCssResourceReference. Since computing the CSS
 is expensive, I would like to cache the generated CSS on the server,
 once generated. It is unclear to me whether Wicket has mechanisms to do
 this. I expected that IStaticCacheableResource would also provide the
 means to do server side caching (in addition to setting the correct
 headers and decorating the url for client-side caching). But this
 doesn't seem to be the case.

 When I look at what happens when doing a second page request/refresh
 after all browser caches are cleared, it seems that for IResource's that
 implement IStaticCacheableResource (including my LessCssResource, but
 also e.g. ConcatBundleResource from wicket core):

 * Resource.newResourceResponse is called (which obviously results in a
 recompute of the entire response)
 * Resource.getCacheableResourceStream is called (which also does a
 recompute of the entire response)
 * All implementations of these methods in wicket core resources are
 designed so that both calls do a full recompute of the actual response
 (which duplicates the effort for every page that uses a resource)
 * The Resource itself is recreated for every request (I could cache it
 in e.g. LessCssResourceReference, but nothing in wicket core abuses
 ResourceReferences for server side caching of Resources, so I'd like to
 know if there is a better approach).

 I have looked at Wickets own implementations of Resources that would
 benefit from server side caching and happen to implement
 IStaticCachableResource (e.g. ConcatBundleResource) and they seem to
 have the same behaviour: no server-side caching, and for each request
 the resource is actually computed multiple times: once for the actual
 response, once for computing the cache-key to decorate the url.

 Hence I would like to know:

 * Should the duplicate expensive compute of various Wicket core
 IStaticCacheableResource implementations not be fixed?
 * Does Wicket provide any mechanism for server side caching of IResource
 implementations?

 Thanks

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




Re: readering strategy of the 'head' section

2013-03-24 Thread Dan Retzlaff
We add a site-wide IHeaderContributor in Application#init()
using getHeaderContributorListenerCollection(). Our initial implementation
used wicket:head contributions as you do. This became difficult to
maintain when we had multiple top-level pages. (Your site has only one
top-level page?) We also require programmatic switches to conditionally
include various third-party analytics and customer support chat widget.
This is most easy accomplished for us at the application level. Here is a
snippet of this global decorator to give you an idea.

@Override
public void renderHead(IHeaderResponse response) {
 response.render(StringHeaderItem.forString(
link rel=\shortcut icon\ type=\image/vnd.microsoft.icon\
href=\/images/favicon.ico\/);

response.render(JavaScriptHeaderItem.forReference(
Application.get().getJavaScriptLibrarySettings().getJQueryReference()));
 response.render(Assets.BOOTSTRAP_JS);
response.render(Assets.GLOBAL_JS);

I agree with the point that each component should make its dependencies
clear in its renderHead(), but our jQuery and Bootstrap dependencies are so
pervasive that we got lazy. It makes our components less reusable across
different apps, but that is not an immediate concern for us.

Re: duplicate/conflicting contributions, Wicket automatically de-dups
header contributions. See HeaderItem#getRenderTokens(). Since Wicket itself
pulls in JQuery, your app's use of it should be configured
through IJavaScriptLibrarySettings as shown here.

Dan

On Sun, Mar 24, 2013 at 10:29 AM, Harrie Hazewinkel
hhazewin...@gmail.comwrote:

 Hallo,


 I understand that potentially things could be overridden at a lower child.
 Although,
 you can have the same in the opposite direction. Same counts for bugs, but
 the
 beauty would be the flexibility I would say.


 On top of that, I am wondering how others use it than in combination with
 jQuery.
 Typically, jQuery has some element specific javascript and css, but rely
 on the
 common jQuery (file jqeury-min.js). If now all is driven from the lower
 childs you
 cannot place the common jQuery in the toplevel page from which all pages
 inherit
 and if a lower child adds the common jQuery you may end up with multiple
 (potentailly even different versions as well).

 Therefore, I am curious how most people use it with jQuery as I would say
 adding a single line in the html from which pages inherit from is way
 easier then
 putting a this in Java code.


 I understand the point of view that you may try to avoid a ParentFHRS, but
 disagree that core-developers make such a choice for others. So
 deprecating it
 sounds not the way to go for me, it reduces maybe the burden of
 maintaining it
 by core developers, but for sure also reduces the flexibility of using
 Wicket.



 Harrie
 hhazewin...@gmail.com





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




Re: Serialization of DAO

2013-03-17 Thread Dan Retzlaff
Wicket only injects Components and Behaviors by default. To inject into
anything else, call Injector.get().inject(this) in its constructor.

On Fri, Mar 15, 2013 at 2:27 PM, Stephen Walsh 
step...@connectwithawalsh.com wrote:

 I have a much better understanding on this now.  Are there any plans to
 support injection on LDMs, or is there a suggested work around for this?

 It seems like you'd want a DAO service to get an object from the DB within
 a custom model so you can return that back to your component.

 ___
 Stephen Walsh | http://connectwithawalsh.com


 On Thu, Mar 14, 2013 at 5:03 PM, Martin Grigorov mgrigo...@apache.org
 wrote:

  Take a look at wicket-examples and the unit tests in wicket-guice module.
 
 
  On Thu, Mar 14, 2013 at 10:53 PM, Stephen Walsh 
  step...@connectwithawalsh.com wrote:
 
   Any other thoughts on this?
  
   ___
   Stephen Walsh | http://connectwithawalsh.com
  
  
   On Thu, Mar 14, 2013 at 10:30 AM, Stephen Walsh 
   step...@connectwithawalsh.com wrote:
  
Thanks, Martin.  I intialize here, (which I just realized is not the
  best
spot):
   
private void setUpMongo() {
mongo = MongoUtil.getMongo();
morphia = new Morphia().map(Blog.class).map(Person.class);
blogDAO = new BlogDAO(mongo, morphia);
}
   
I am using the Wicket Guice module, and I think your second point is
  what
I was getting at.  From learning about Guice (
http://www.youtube.com/watch?feature=player_embeddedv=hBVJbzAagfs),
 I
thought the point was to initialize once and then reuse wherever
  needed.
I
figured initialization would happen in the application class.  Maybe
  I'm
misunderstanding.  If it's supposed to happen in the application
 class,
then I don't really have need for a module because I don't have an
interface in this case, right?
   
Thanks for the help on this.
   
___
Stephen Walsh | http://connectwithawalsh.com
   
   
On Thu, Mar 14, 2013 at 3:20 AM, Martin Grigorov 
 mgrigo...@apache.org
   wrote:
   
Hi,
   
I don't see how you initialize blogDAO. If you don't use wicket-ioc
   module
then you will need to lookup the DAO from the application whenever
 you
need
it:
   
public void onSubmit() {
   
  BlogDAO blogDao = MyApplication.get().getBlogDAO();
  blogDao.save(blog);
}
This way you wont keep reference to it in the page/component and it
  wont
be
serialized.
   
If you use wicket-guice module then you can do:
   
@Inject
private  BlogDAO blogDao;
   
and use it anywhere.
Wicket will use Guice to lookup the bean at component creation but
 the
bean
will be wrapped in a serializable proxy. That is a lightweight proxy
   will
be (de)serialized with the page.
This is the recommended way.
wicket-string works the same way.
wicket-cdi leaves the proxy creation to the CDI implementation.
   
   
   
On Thu, Mar 14, 2013 at 5:19 AM, Stephen Walsh 
step...@connectwithawalsh.com wrote:
   
 I'm attempting to implement Guice for my DAO connections as my
 JBoss
server
 keeps running out of memory.  Not entirely sure why that is, but
 I'm
hoping
 this is at least part of it.  I read through
 http://markmail.org/message/sz64l4eytzc3ctkh and understand why
 the
   DAO
 needs to be serialized, and I also followed


   
  
 
 https://cwiki.apache.org/confluence/display/WICKET/Wicket%2C+Guice+and+Ibatis+exampleto
 try and figure out where and how exactly to inject my DAO.

 My DAO already extends a basic DAO class that has all of the
 basics
   for
 getting stuff from the database.  Neither of these are interfaces
  (not
sure
 if this is a problem or not).  My DAO works just fine in panels,
 but
   as
 soon as it's on a page, it throws the not seralizable exception.
  Regardless it doesn't really solve the problem of really only
  needing
one
 DAO for the whole application instead of creating one whenever
 it's
needed
 in every place that it's needed.  If I understand dependency
   injection,
 then this is the whole point.

 Here's my class.  Hopefully someone can point me in the right
   direction
for
 this page and my application class:

 public class EditBlogEntry extends BasePage {

 private Logger logger =
LoggerFactory.getLogger(EditBlogEntry.class);

 private Mongo mongo;
 private Morphia morphia;
 private BlogDAO blogDAO;

 public EditBlogEntry(final Blog blogEntry) {
  // Add edit blogPost form to page
 Form? form = new Form(form);
 form.add(new Button(postIt) {
 @Override
 public void onSubmit() {
 // This merely gets a new mongo 

Re: wicket:for attribute definition in xsd

2013-01-22 Thread Dan Retzlaff
I think taking it to that level gets into the realm of xs:redefine as
described here:
http://www.w3.org/TR/xhtml-modularization/schema_developing.html

On Tue, Jan 22, 2013 at 7:41 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi Jim,

 You are correct!
 I've missed those the other day.

 Do you know what XSD restriction I should use to allow the usage of
 wicket:for attribute *only* in HTML label elements ?


 On Tue, Jan 22, 2013 at 5:14 PM, Olson, Jim (US SSA) 
 jim.ol...@baesystems.com wrote:

  Hello Martin,
 
  Unless I'm not understanding it correctly, wicket-1.5.xsd under
  wicket-core/src/main/resources/META-INF defines wicket attributes as well
  as elements.
  If defines attributes wicket:id, wicket:enclosure, and wicket:message
  attributes
  but not the wicket:for attribute.
 
 
 
 https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-Attributewicket
  says there are 6 attributes but it looks like wicket:unknown and
  wicket:scope have gone away.
 
  Thanks, and please explain if I'm misunderstanding this.
  Jim Olson
 
 
 
  -Original Message-
  From: Martin Grigorov [mailto:mgrigo...@apache.org]
  Sent: Monday, January 21, 2013 3:37 AM
  To: users@wicket.apache.org
  Subject: Re: wicket:for attribute definition in xsd
 
  Hi,
 
  wicket-1.5.xsd defines only the elements - wicket:something.
  wicket:for is an attribute to label element which is part of HTML spec.
  Is there a way to define attributes to elements from a different
 namespace
  ?
  If it is possible then please file a ticket with a patch. The same is
 valid
  for wicket:message when used as an attribute.
 
 
  On Fri, Jan 18, 2013 at 9:23 PM, Jim Olson jimo...@gmail.com wrote:
 
   There’s no attribute definition for wicket:for in the xsd of wicket
  6.4.0.
  
   Shouldn’t it define this attribute?
  
  
   Thank you
  
 
 
 
  --
  Martin Grigorov
  jWeekend
  Training, Consulting, Development
  http://jWeekend.com http://jweekend.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 http://jweekend.com/



Re: Possible to use static IBehavior/ReadOnlyModels?

2012-12-05 Thread Dan Retzlaff
Might be worth noting that as soon as it goes through a serialization
round-trip it's no longer a singleton. Not a concern for a trivial
AttributeAppender, but it's a Wicket+static+serialization gotcha we learned
the hard way. :)

On Wed, Dec 5, 2012 at 4:40 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 yes, you can use singleton instances as long as they are threadsafe.

 -igor

 On Wed, Dec 5, 2012 at 2:40 AM, Davli lidz@gmail.com wrote:
  Well as the title says...
  Would this be possible assuming that they have have no real relation to a
  value in a session?
  For example:
 
  An AttributeAppender that always appends the same value.
 
 
 
  --
  View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Possible-to-use-static-IBehavior-ReadOnlyModels-tp4654507.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
 

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




Re: Session Destroy

2012-11-12 Thread Dan Retzlaff
Martin G put together a Session#onInvalidate() callback for this, but it
didn't receive much interest. See
https://issues.apache.org/jira/browse/WICKET-

On Mon, Nov 12, 2012 at 8:32 PM, Corbin, James jcor...@iqnavigator.comwrote:

 Is there any way in Wicket 6+ to be notified when the session is ABOUT to
 be destroyed?  The UnboundListener.sessionUnbound(…) API is too late in the
 cycle for me to interact with the session state.

 Thanks,
 J.D.



Re: DownloadLink

2012-10-14 Thread Dan Retzlaff
Michael, check out the DownloadLink example here:
http://www.wicket-library.com/wicket-examples/linkomatic/home

Also check out the code for DownloadLink itself, and you'll see
1. Your IModel must return a File, but yours returns bytes.
2. The download is initiated in DownloadLink#onClick, which you have
blocked with your subclass.

Hope that helps,
Dan

On Sun, Oct 14, 2012 at 5:09 PM, Michael Jaruska
michael.jaru...@gmail.comwrote:

 Hi,

 what to add into onClick() in DownloadLink if I need return to client
 generated .pdf
 stream as a .pdf file?

 My code:

 IModel pdfStreamModel = new AbstractReadOnlyModel()
 {
 public Object getObject()
 {
 return getPdfStreamBytes();
 }
 };
 DownloadLink downloadLink = new DownloadLink(downloadLink,
 pdfStreamModel, getPdfDocumentName())
 {
 public void onClick()
 {
 System.out.println(clicking works);
 }
 };

 Model works, DownloadLink is added into my markup. But I can't find any
 example how to deal
 code into onClick() in DownloadLink in a way it will return my generated
 .pdf stream in model.

 Thank folks,

 MJ

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




Re: DownloadLink

2012-10-14 Thread Dan Retzlaff
I usually wrap a custom AbstractResource instance in a ResourceReference,
and put that into the ResourceLink. AbstractResource#newResourceResponse()
is called when the link is clicked. You can query for the bytes there, and
write them to the response in your ResourceResponse's WriteCallback. For a
download, the relevant setters are:

ResourceResponse response = new ResourceResponse();
response.setFileName(...);
response.setContentType(...);
response.setContentLength(...);
response.setContentDisposition(ContentDisposition.ATTACHMENT);
response.setWriteCallback(new WriteCallback() {...});

On Sun, Oct 14, 2012 at 7:45 PM, Michael Jaruska
michael.jaru...@gmail.comwrote:

 Dan, thank you for links and points.

 The true is that I have data in database so I would like streaming them.
 Is the right
 way put them in temp file first and then send it into browser with
 DownloadLink?

 After some googling I noticed that ResourceLink should be like
 DownloadLink but for me
 better - it's for streamed data. But can't find any example for wicket 1.5
 :-(

 MJ



 On 14.10.2012 21:00, Dan Retzlaff wrote:

 Michael, check out the DownloadLink example here:
 http://www.wicket-library.com/**wicket-examples/linkomatic/**homehttp://www.wicket-library.com/wicket-examples/linkomatic/home

 Also check out the code for DownloadLink itself, and you'll see
 1. Your IModel must return a File, but yours returns bytes.
 2. The download is initiated in DownloadLink#onClick, which you have
 blocked with your subclass.

 Hope that helps,
 Dan

 On Sun, Oct 14, 2012 at 5:09 PM, Michael Jaruska
 michael.jaru...@gmail.com**wrote:

  Hi,

 what to add into onClick() in DownloadLink if I need return to client
 generated .pdf
 stream as a .pdf file?

 My code:

 IModel pdfStreamModel = new AbstractReadOnlyModel()
 {
  public Object getObject()
  {
  return getPdfStreamBytes();
  }
 };
 DownloadLink downloadLink = new DownloadLink(downloadLink,
 pdfStreamModel, getPdfDocumentName())
 {
  public void onClick()
  {
  System.out.println(clicking works);
  }
 };

 Model works, DownloadLink is added into my markup. But I can't find any
 example how to deal
 code into onClick() in DownloadLink in a way it will return my generated
 .pdf stream in model.

 Thank folks,

 MJ

 --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.orghttp://apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 

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




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




Re: DownloadLink

2012-10-14 Thread Dan Retzlaff
This should get you going:
new ResourceLinkVoid(pdf, new AbstractResource() {
@Override
protected ResourceResponse newResourceResponse(Attributes attributes) {
final byte[] pdfBytes = getPdfBytes();
ResourceResponse r = new ResourceResponse();
r.setFileName(yourpdf.pdf);
r.setContentType(application/pdf);
r.setContentDisposition(ContentDisposition.ATTACHMENT);
r.setContentLength(pdfBytes.length);
r.setWriteCallback(new WriteCallback() {
@Override
public void writeData(Attributes attributes) throws IOException {
attributes.getResponse().write(pdfBytes);
}
});
return r;
}
}
On Sun, Oct 14, 2012 at 8:14 PM, Michael Jaruska
michael.jaru...@gmail.comwrote:

 Is there more complex example? Do you build link with DownloadLink or
 ResourceLink? -I suppouse you use ResourceLink. And yes, I would like to
 build response data at the link click moment, no temp file if possible
 (in fact I have data as byte[] from database).



 On 14.10.2012 21:59, Dan Retzlaff wrote:

 I usually wrap a custom AbstractResource instance in a ResourceReference,
 and put that into the ResourceLink. AbstractResource#**
 newResourceResponse()
 is called when the link is clicked. You can query for the bytes there, and
 write them to the response in your ResourceResponse's WriteCallback. For a
 download, the relevant setters are:

 ResourceResponse response = new ResourceResponse();
 response.setFileName(...);
 response.setContentType(...);
 response.setContentLength(...)**;
 response.**setContentDisposition(**ContentDisposition.ATTACHMENT)**;
 response.setWriteCallback(new WriteCallback() {...});

 On Sun, Oct 14, 2012 at 7:45 PM, Michael Jaruska
 michael.jaru...@gmail.com**wrote:

  Dan, thank you for links and points.

 The true is that I have data in database so I would like streaming them.
 Is the right
 way put them in temp file first and then send it into browser with
 DownloadLink?

 After some googling I noticed that ResourceLink should be like
 DownloadLink but for me
 better - it's for streamed data. But can't find any example for wicket
 1.5
 :-(

 MJ



 On 14.10.2012 21:00, Dan Retzlaff wrote:

  Michael, check out the DownloadLink example here:
 http://www.wicket-library.com/wicket-examples/linkomatic/homehttp://www.wicket-library.com/**wicket-examples/linkomatic/**home
 http://www.wicket-**library.com/wicket-examples/**linkomatic/homehttp://www.wicket-library.com/wicket-examples/linkomatic/home
 


 Also check out the code for DownloadLink itself, and you'll see
 1. Your IModel must return a File, but yours returns bytes.
 2. The download is initiated in DownloadLink#onClick, which you have
 blocked with your subclass.

 Hope that helps,
 Dan

 On Sun, Oct 14, 2012 at 5:09 PM, Michael Jaruska
 michael.jaru...@gmail.comwrote:

   Hi,


 what to add into onClick() in DownloadLink if I need return to client
 generated .pdf
 stream as a .pdf file?

 My code:

 IModel pdfStreamModel = new AbstractReadOnlyModel()
 {
   public Object getObject()
   {
   return getPdfStreamBytes();
   }
 };
 DownloadLink downloadLink = new DownloadLink(downloadLink,
 pdfStreamModel, getPdfDocumentName())
 {
   public void onClick()
   {
   System.out.println(clicking works);
   }
 };

 Model works, DownloadLink is added into my markup. But I can't find any
 example how to deal
 code into onClick() in DownloadLink in a way it will return my
 generated
 .pdf stream in model.

 Thank folks,

 MJ

 --**--**--**
 --**-
 To unsubscribe, e-mail: users-unsubscribe@wicket.apa**che.org
 http://apache.org**
 users-unsubscribe@**wicket.**apache.org http://wicket.apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 



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




  --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.orghttp://apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 
 For additional commands, e-mail: users-h...@wicket.apache.org




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




Re: CompoundPropertyModel not working... Warning message

2012-10-13 Thread Dan Retzlaff
Hi!

It's not clear what you mean by not working but I'll assume you expect
your Invoice object to be populated when the submit button is clicked. It
won't work with your code because you have disabled default form processing
with your submit button. You actually don't even need a Wicket component
for the submit button. Just include an input type=submit inside your
form markup. To handle the submit, you can override Form#onSubmit().

The warning message is not related to your form model issues. Maybe you're
referring to wicket-logo.png with a PackageResourceReference but it's not
actually alongside BasePage?

Hope that helps,
Dan

On Sun, Oct 14, 2012 at 12:12 AM, delta458 delta...@hotmail.com wrote:

 Tried so much... still not working..
 I get the following warning message:
 /WARNING: A ResourceReference wont be created for a resource with key
 [scope: template.BasePage; name: wicket-logo.png; locale: null; style:
 null;
 variation: null] because it cannot be located./

 Here is the Java File:


 And the HTML file:




 What am I missing?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/CompoundPropertyModel-not-working-Warning-message-tp4652942.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: CompoundPropertyModel not working... Warning message

2012-10-13 Thread Dan Retzlaff
If you don't add any of the standard validators, doesn't that accomplish
your goal? I think you still want form processing which includes
population of model objects from the raw submitted strings.

If you're using another post-submit validation framework, you probably want
to override Form#onValidateModelObjects() which is for that purpose.

On Sun, Oct 14, 2012 at 1:19 AM, delta458 delta...@hotmail.com wrote:

 I disabled default form processing because I need to, for my project. I
 will
 use another validation framework for validating.

 Also when it is enabled, my object was not populated...

 I will try again though...



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/CompoundPropertyModel-not-working-Warning-message-tp4652942p4652944.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: Wicket + Guice + unittests

2012-10-12 Thread Dan Retzlaff
I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a
different way of getting your Injector into your Wicket Application. Rather
than getting the Injector from your servlet context attributes, I'm
suggesting that you let Guice instantiate your Application so you can
@Inject the injector like any other dependency. The binding code I posted
previously does the (non-test) setup; for the test itself it's as simple as
https://gist.github.com/3880246.

Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for
that. :)

On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote:

 Dan,

 I'm not talking about my application. I'm talking about unittests.
 I've followed the Guice recommended way to integrate with servlets
 using the GuiceFilter.

 Now I'm trying to make the Wicket unittests work and I need the
 injector to be available in WicketTester.

 Daniel

 On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
  For what it's worth, we instantiate our applications through Guice.
 Having
  your application go get its Injector kind of violates the DI concept.
 
  filter(/*).through(WicketFilter.class);
  bind(WebApplication.class).to(CustomWebApplication.class);
  bind(WicketFilter.class).to(CustomWicketFilter.class);
 
  @Singleton
  private static class CustomFilter extends WicketFilter {
  @Inject private ProviderWebApplication webApplicationProvider;
   @Override
  protected IWebApplicationFactory getApplicationFactory() {
  return new IWebApplicationFactory() {
  @Override
  public WebApplication createApplication(WicketFilter filter) {
  return webApplicationProvider.get();
  }
  @Override
  public void destroy(WicketFilter filter) {
  }
  };
  }
  }
 
  On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous
  daniel.watr...@gmail.comwrote:
 
  Dan,
 
  I think you're right. Since in the WicketApplication init() function I
  attempt to get the bootStrapInjector like this:
  Injector bootStrapInjector = (Injector)
  this.getServletContext().getAttribute(Injector.class.getName());
 
  I just can't figure out how to get the injector into the
  ServletContext before init() is run in my WicketApplication.
 
  Daniel
 
  On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
   Daniel,
  
   What you're doing should work, but I think you're giving
   your GuiceComponentInjector a null Injector. Unit tests don't go
 through
   web.xml to set up its context listeners, so
   your GuiceServletContextListener never has a chance to construct and
   register an Injector with the ServletContext.
  
   Dan
  
   On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
  daniel.watr...@gmail.comwrote:
  
   Hi,
  
   I've integrated Guice into Wicket successfully, but I'm struggling
   with the unittests. I'm not sure how to get the injector into my
   HomePage class. Here's my setup.
  
   I'm using GuiceFilter with a GuiceServletContextListener. That
 creates
   the injector and a ServletModule which defines the WicketApplication.
   I followed:
   http://code.google.com/p/google-guice/wiki/ServletModule
  
   Here's some of MyGuiceServletConfig extends
 GuiceServletContextListener
  
   @Override
   protected Injector getInjector() {
   return Guice.createInjector(createServletModule(), new
   MongoHoneybadgerModule());
   }
  
   private ServletModule createServletModule() {
   return new ServletModule() {
   ...
  
   In my WicketApplication extends WebApplication I have this init()
 method
  
   @Override
   public void init()
   {
   super.init();
   Injector bootStrapInjector = (Injector)
   this.getServletContext().getAttribute(Injector.class.getName());
   getComponentInstantiationListeners().add(new
   GuiceComponentInjector(this, bootStrapInjector));
   }
  
   Now, in my HomePage.java class I have
  
   public class HomePage extends WebPage {
   private static final long serialVersionUID = 1L;
   @Inject private Injector injector;
  
   public HomePage(final PageParameters parameters) {
   super(parameters);
   SomeType myobj = injector.getInstance(SomeType.class);
  
   add(new Label(version, myobj.getValue()));
   }
   }
  
   This all runs great inside a web container as a servlet.
  
   The PROBLEM: I'm getting a NullPointerException on the line where I
   reference the injector:
   SomeType myobj = injector.getInstance(SomeType.class);
  
   My test class is what was generated by the wicket quickstart. I'm not
   sure how to make an injector available in setUp.
  
   @Before
   public void setUp() {
   tester = new WicketTester(new WicketApplication());
   }
  
   Any ideas?
  
   Thanks,
   Daniel
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users

Re: Wicket + Guice + unittests

2012-10-12 Thread Dan Retzlaff
Yes, CustomFilter = CustomWicketFilter... Those aren't our actual names.
And yes, we provide filter parameters too. I just omitted them since they
weren't relevant to the Guice-based application instantiation I was
describing.

Do you have this in your web.xml?
filter
filter-nameguiceFilter/filter-name
filter-classcom.google.inject.servlet.GuiceFilter/filter-class
/filter
filter-mapping
filter-nameguiceFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping

On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous daniel.watr...@gmail.comwrote:

 Dan,

 Thanks. I've got unittests running now, but the WicketFilter doesn't
 seem to be processing. All I get when I run the applicaiton shows a
 jetty produced directory listing.

 In the snippet you provided before I think that CustomFilter and
 CustomeWicketFilter should be the same thing. Is that right?

 In my previous approach, when I bound the WicketFilter I included some
 parameters, like this:
 filter(/*).through(WicketFilter.class,
 createWicketFilterInitParams());

 With this function

 private MapString, String createWicketFilterInitParams() {
 MapString, String wicketFilterParams = new HashMapString,
 String();
 wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*);
 wicketFilterParams.put(applicationClassName,
 com.hp.honeybadger.web.WicketApplication);
 return wicketFilterParams;
 }

 I'm now trying to figure out how to make sure that the wicket filter
 is called...

 Daniel

 On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com
 wrote:
  I follow you. WicketTester doesn't know about GuiceFilter, so you'll
 need a
  different way of getting your Injector into your Wicket Application.
 Rather
  than getting the Injector from your servlet context attributes, I'm
  suggesting that you let Guice instantiate your Application so you can
  @Inject the injector like any other dependency. The binding code I posted
  previously does the (non-test) setup; for the test itself it's as simple
 as
  https://gist.github.com/3880246.
 
  Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks
 for
  that. :)
 
  On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:
 
  Dan,
 
  I'm not talking about my application. I'm talking about unittests.
  I've followed the Guice recommended way to integrate with servlets
  using the GuiceFilter.
 
  Now I'm trying to make the Wicket unittests work and I need the
  injector to be available in WicketTester.
 
  Daniel
 
  On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
   For what it's worth, we instantiate our applications through Guice.
  Having
   your application go get its Injector kind of violates the DI
 concept.
  
   filter(/*).through(WicketFilter.class);
   bind(WebApplication.class).to(CustomWebApplication.class);
   bind(WicketFilter.class).to(CustomWicketFilter.class);
  
   @Singleton
   private static class CustomFilter extends WicketFilter {
   @Inject private ProviderWebApplication webApplicationProvider;
@Override
   protected IWebApplicationFactory getApplicationFactory() {
   return new IWebApplicationFactory() {
   @Override
   public WebApplication createApplication(WicketFilter filter) {
   return webApplicationProvider.get();
   }
   @Override
   public void destroy(WicketFilter filter) {
   }
   };
   }
   }
  
   On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous
   daniel.watr...@gmail.comwrote:
  
   Dan,
  
   I think you're right. Since in the WicketApplication init() function
 I
   attempt to get the bootStrapInjector like this:
   Injector bootStrapInjector = (Injector)
   this.getServletContext().getAttribute(Injector.class.getName());
  
   I just can't figure out how to get the injector into the
   ServletContext before init() is run in my WicketApplication.
  
   Daniel
  
   On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
  wrote:
Daniel,
   
What you're doing should work, but I think you're giving
your GuiceComponentInjector a null Injector. Unit tests don't go
  through
web.xml to set up its context listeners, so
your GuiceServletContextListener never has a chance to construct
 and
register an Injector with the ServletContext.
   
Dan
   
On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
   daniel.watr...@gmail.comwrote:
   
Hi,
   
I've integrated Guice into Wicket successfully, but I'm struggling
with the unittests. I'm not sure how to get the injector into my
HomePage class. Here's my setup.
   
I'm using GuiceFilter with a GuiceServletContextListener. That
  creates
the injector and a ServletModule which defines the
 WicketApplication.
I followed:
http://code.google.com/p/google-guice/wiki/ServletModule
   
Here's some of MyGuiceServletConfig extends
  GuiceServletContextListener
   
@Override
protected Injector getInjector

Re: Wicket + Guice + unittests

2012-10-11 Thread Dan Retzlaff
For what it's worth, we instantiate our applications through Guice. Having
your application go get its Injector kind of violates the DI concept.

filter(/*).through(WicketFilter.class);
bind(WebApplication.class).to(CustomWebApplication.class);
bind(WicketFilter.class).to(CustomWicketFilter.class);

@Singleton
private static class CustomFilter extends WicketFilter {
@Inject private ProviderWebApplication webApplicationProvider;
 @Override
protected IWebApplicationFactory getApplicationFactory() {
return new IWebApplicationFactory() {
@Override
public WebApplication createApplication(WicketFilter filter) {
return webApplicationProvider.get();
}
@Override
public void destroy(WicketFilter filter) {
}
};
}
}

On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous
daniel.watr...@gmail.comwrote:

 Dan,

 I think you're right. Since in the WicketApplication init() function I
 attempt to get the bootStrapInjector like this:
 Injector bootStrapInjector = (Injector)
 this.getServletContext().getAttribute(Injector.class.getName());

 I just can't figure out how to get the injector into the
 ServletContext before init() is run in my WicketApplication.

 Daniel

 On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
  Daniel,
 
  What you're doing should work, but I think you're giving
  your GuiceComponentInjector a null Injector. Unit tests don't go through
  web.xml to set up its context listeners, so
  your GuiceServletContextListener never has a chance to construct and
  register an Injector with the ServletContext.
 
  Dan
 
  On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:
 
  Hi,
 
  I've integrated Guice into Wicket successfully, but I'm struggling
  with the unittests. I'm not sure how to get the injector into my
  HomePage class. Here's my setup.
 
  I'm using GuiceFilter with a GuiceServletContextListener. That creates
  the injector and a ServletModule which defines the WicketApplication.
  I followed:
  http://code.google.com/p/google-guice/wiki/ServletModule
 
  Here's some of MyGuiceServletConfig extends GuiceServletContextListener
 
  @Override
  protected Injector getInjector() {
  return Guice.createInjector(createServletModule(), new
  MongoHoneybadgerModule());
  }
 
  private ServletModule createServletModule() {
  return new ServletModule() {
  ...
 
  In my WicketApplication extends WebApplication I have this init() method
 
  @Override
  public void init()
  {
  super.init();
  Injector bootStrapInjector = (Injector)
  this.getServletContext().getAttribute(Injector.class.getName());
  getComponentInstantiationListeners().add(new
  GuiceComponentInjector(this, bootStrapInjector));
  }
 
  Now, in my HomePage.java class I have
 
  public class HomePage extends WebPage {
  private static final long serialVersionUID = 1L;
  @Inject private Injector injector;
 
  public HomePage(final PageParameters parameters) {
  super(parameters);
  SomeType myobj = injector.getInstance(SomeType.class);
 
  add(new Label(version, myobj.getValue()));
  }
  }
 
  This all runs great inside a web container as a servlet.
 
  The PROBLEM: I'm getting a NullPointerException on the line where I
  reference the injector:
  SomeType myobj = injector.getInstance(SomeType.class);
 
  My test class is what was generated by the wicket quickstart. I'm not
  sure how to make an injector available in setUp.
 
  @Before
  public void setUp() {
  tester = new WicketTester(new WicketApplication());
  }
 
  Any ideas?
 
  Thanks,
  Daniel
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




Re: Wicket + Guice + unittests

2012-10-10 Thread Dan Retzlaff
Daniel,

What you're doing should work, but I think you're giving
your GuiceComponentInjector a null Injector. Unit tests don't go through
web.xml to set up its context listeners, so
your GuiceServletContextListener never has a chance to construct and
register an Injector with the ServletContext.

Dan

On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote:

 Hi,

 I've integrated Guice into Wicket successfully, but I'm struggling
 with the unittests. I'm not sure how to get the injector into my
 HomePage class. Here's my setup.

 I'm using GuiceFilter with a GuiceServletContextListener. That creates
 the injector and a ServletModule which defines the WicketApplication.
 I followed:
 http://code.google.com/p/google-guice/wiki/ServletModule

 Here's some of MyGuiceServletConfig extends GuiceServletContextListener

 @Override
 protected Injector getInjector() {
 return Guice.createInjector(createServletModule(), new
 MongoHoneybadgerModule());
 }

 private ServletModule createServletModule() {
 return new ServletModule() {
 ...

 In my WicketApplication extends WebApplication I have this init() method

 @Override
 public void init()
 {
 super.init();
 Injector bootStrapInjector = (Injector)
 this.getServletContext().getAttribute(Injector.class.getName());
 getComponentInstantiationListeners().add(new
 GuiceComponentInjector(this, bootStrapInjector));
 }

 Now, in my HomePage.java class I have

 public class HomePage extends WebPage {
 private static final long serialVersionUID = 1L;
 @Inject private Injector injector;

 public HomePage(final PageParameters parameters) {
 super(parameters);
 SomeType myobj = injector.getInstance(SomeType.class);

 add(new Label(version, myobj.getValue()));
 }
 }

 This all runs great inside a web container as a servlet.

 The PROBLEM: I'm getting a NullPointerException on the line where I
 reference the injector:
 SomeType myobj = injector.getInstance(SomeType.class);

 My test class is what was generated by the wicket quickstart. I'm not
 sure how to make an injector available in setUp.

 @Before
 public void setUp() {
 tester = new WicketTester(new WicketApplication());
 }

 Any ideas?

 Thanks,
 Daniel

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




Re: wicket-guice and Logger injection

2012-08-09 Thread Dan Retzlaff
Hi Sean,

Keep in mind that Guice isn't directly injecting your Wicket components.
That happens through org.apache.wicket.guice.GuiceComponentInjector. More
specifically, see GuiceFieldValueFactory#supportsField() which only
recognizes @Inject annotated fields as requiring injection.

HTH,
Dan

On Thu, Aug 9, 2012 at 7:32 AM, Lawrence, Sean sean.lawre...@mantech.comwrote:

 Hi,

 I'm attempting to use wicket-guice to inject Logger references into my
 application with logging.

 So instead of:

 Logger logger = LoggerFactory.getLogger(HomePage.class);

 I would rather:

 @Log
 Logger logger;

 I've followed the guice documentation closely and have been frustratingly
 unable to get these statements working. Does anyone have any experience
 with this and can provide insight to why it's not (see links below)? All
 other objects I have provided or binded are getting injected, however, all
 my logger statements are throwing NPE.

 See the following two links for the documentation I have been using. I
 also have a quick-start wicket application that I have prepared if anyone
 is curious (it's a zipped up eclipse project ... I may have to rename
 .zippp to get around the corporate firewall)

 http://code.google.com/p/google-guice/wiki/CustomInjections

 http://forkbomb-blog.de/2012/slf4j-logger-injection-with-guice

 I have also tried the Sli4j library, but was getting NPEs as well:
 http://sli4j.googlecode.com/svn/site/1.0/index.html Does anyone have
 experience with sli4j?

 Finally, does anyone have a maven archetype? My coworker is looking into
 adding logger injection to the 55minutes prototype.

 Thank you!


 Sean Lawrence

 
 This e-mail and any attachments are intended only for the use of the
 addressee(s) named herein and may contain proprietary information. If you
 are not the intended recipient of this e-mail or believe that you received
 this email in error, please take immediate action to notify the sender of
 the apparent error by reply e-mail; permanently delete the e-mail and any
 attachments from your computer; and do not disseminate, distribute, use, or
 copy this message and any attachments.



Re: How to Mount Multiple URLS to Same Class in wicket 1.5.7

2012-08-02 Thread Dan Retzlaff
There is probably a better way, but I just create very simple subclasses to
allow separate mounts.
class ProductPage extends DynamicWebPage {
ProductPage(PageParagemeters p) {
super(p);
}
}

On Wed, Aug 1, 2012 at 12:10 PM, vinitty vini...@gmail.com wrote:

 I am making an application where multiple urls need to mount to Same Class

 Like
 /product
 /category
 /upgrades

 to DynamicWebPage.class
 I have mount like new MountMapper(url, class);

 Now when i hit the page /product its coming fine, but all the links on that
 page is coming like this
 /category?fsadas:dgs

 which should be /product?fsadas:dgs

 My thought is that its coming like that because both urls pointing to same
 class


 Please help on this




 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-Mount-Multiple-URLS-to-Same-Class-in-wicket-1-5-7-tp4650932.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: Which is the best way to manage the visibility of a component?

2012-07-29 Thread Dan Retzlaff
You could override C's onConfigure() to set its visibility based on B, and
override C's onEvent() to add C to the ART if it's current visibility is
wrong.
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Defaultajaxevent

On Sun, Jul 29, 2012 at 6:17 AM, Alberto abros...@ogs.trieste.it wrote:

 Hi,

 I'm using wicket 1.5.7 and I have the following scenario.
 A page with two DropDownChoice that we will call A and B. Values of B
 depend on value of A and are updated by Ajax.
 Then a WebMarkupContainer component that we will call C. The visibility
 of C depends on value of B.
 I added in the method onUpdate of
 AjaxFormComponentUpdatingBehavior(onchange) of B some statements  to
 check the value of B and set the visibility of C accordingly.
 But it's triggered only when the user change the value of B. That value
 can be changed by ajax when the user change the value of A.
 So, which is the best practice to deal with this kind of problem?
 I have to add the same code in the
 AjaxFormComponentUpdatingBehavior(onchange) of A too? Is there a
 better solution avoiding duplication of code?

 Best regards

 Alberto

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




Re: HTTPS FORM POST FROM EXTERNAL SITE TO WICKET WEBPAGE

2012-07-29 Thread Dan Retzlaff
If your constructor isn't being called, you have something more basic to
figure out. I just tested with a quickstart, and it worked as expected. See
https://gist.github.com/3204518. Hitting localhost:8080 shows value is not
specified, then submitting the (non-Wicketized) form shows value is
whatever I entered.

On Sun, Jul 29, 2012 at 8:36 PM, hannach hann...@solutiondynamics.comwrote:

 Thanks for the reply.
 I don't think Webpage is called at all. Do I need to add crazy wicket url
 like

 pay_result?form7_hf_0=wicket%3Ainterface=%3A1%3Aform%3A%3AIFormSubmitListener
 in returnURL in order to get what's been submitted from external site to my
 web page?

 Perhaps it's HTTPS and it's using POST method to submit a form?
 But it should work same as GET method that passed via query string (e.g.
 www.mywicketsite.com/pay_result?status=success) right?

 parameters.getString(status)







 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/HTTPS-FORM-POST-FROM-EXTERNAL-SITE-TO-WICKET-WEBPAGE-tp4650857p4650859.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: Really slow code

2012-07-24 Thread Dan Retzlaff
Pro: session is a broader scope, so query will happen less often
Con: session is serialized so cached value needs to be serializable or
transient/detached
Con: session is accessed by multiple threads simultaneously, so you need to
handle synchronization

Your call. :)

On Tue, Jul 24, 2012 at 12:46 PM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 Thanks,
 I just found some code that uses 'session' as opposed to the request
 cycle for caching.  Does that matter?  Or is the requestcycle preferred?

 getSession().setMetaData

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Tuesday, July 24, 2012 3:20 PM
 To: users@wicket.apache.org
 Subject: Re: Really slow code

 static class MetaDataKeyMyData MYDATA=new MetaDateKeyMyData() {};

 ^ thats the type-safe singleton key you use to acces the metadata store

 checking for metadata

 MyData data=RequestCycle.get().getMetaData(MYDATA);

 ^ null means none

 writing metadata

 RequestCycle.get().setMetaData(MYDATA, data);

 -igor


 On Tue, Jul 24, 2012 at 9:26 PM, Brown, Berlin [GCG-PFS]
 berlin.br...@primerica.com wrote:
  You have any more specifics or an example?  Is there a metadata class?
 
  -Original Message-
  From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
  Sent: Tuesday, July 24, 2012 1:34 PM
  To: users@wicket.apache.org
  Subject: Re: Really slow code
 
  cache it in request cycle's metadata
 
  -igor
 
  On Tue, Jul 24, 2012 at 8:18 PM, Brown, Berlin [GCG-PFS]
  berlin.br...@primerica.com wrote:
  With code like this, I have a model and within the 'load' method, I
  am
 
  making a slower call that I don't want to call to get the data again.
 
 
 
  I may need the result 'bean' for another part of the UI on that
  particular page and I don't want to make that call again.  How can I
  do this?
 
 
 
  1.   OnBeforeRender, get a reference to the component and return
  the
  defaultmodelobject?
 
  2.   Use a field reference in my parent component to the result
  set?
 
 
 
  final LoadableDetachableModelBean modelReqList = new
  LoadableDetachableModelBean() {
 
  public Bean load() {
 
return
  runReallySlowCodeOnlyWantToCallOnce();
 
  }
 
  };
 
 
 
  -
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 

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




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




Re: Preventing users from re-submitting wizards

2012-07-18 Thread Dan Retzlaff
Martijn, I am familiar with Igor's CDI approach, and while I have not
implemented it myself, it seems like it would suffer the same multiple
page versions problem. Setting isSubmitted=true on the last page version
doesn't prevent the user from going back past that version.

Sven, I think we'll take this approach. We actually create/persist the
target entity at the beginning of our wizards for exactly this reporting
purpose. I was hoping for a general solution within Wicket, but writing a
wizard-specific entity state check should not be too bad.

Thanks for your inputs!

On Wed, Jul 18, 2012 at 3:55 AM, Sven Meier s...@meiers.net wrote:

 I'd just keep a workflow identifier in the database
 If your workflow is so important, sooner or later your business people
 will want to an know about aborted wizards anyway.

 My 2 cents
 Sven

 Dan Retzlaff dretzl...@gmail.com schrieb:

 Hi all,
 
 We have a wizard workflow for our users that collects various inputs, and
 when submitted, persists entities and kicks off some processing. After the
 wizard is submitted, the user should not be able to navigate back and
 resubmit the wizard. The obvious solution of maintaining a boolean
 isSubmitted state within the page does not work, because during wizard
 navigation many page IDs were created due to model and hierarchy changes.
 The isSubmitted=true is seen by the first history entry, but page
 instances
 further back have isSubmitted=false. Another solution is
 setVersioned(false), but we like the back button to work while wizard is
 active.
 
 It seems like we need to maintain wizard state at a higher scope such as
 the session, keyed uniquely by some wizard instance identifier (maybe a
 UUID). Ensuring that this set of submitted (or in-progress) wizards
 remains
 bounded seems challenging, though probably not a practical concern. Do you
 have a more clever solution to this problem?
 
 Regards,
 Dan



Preventing users from re-submitting wizards

2012-07-17 Thread Dan Retzlaff
Hi all,

We have a wizard workflow for our users that collects various inputs, and
when submitted, persists entities and kicks off some processing. After the
wizard is submitted, the user should not be able to navigate back and
resubmit the wizard. The obvious solution of maintaining a boolean
isSubmitted state within the page does not work, because during wizard
navigation many page IDs were created due to model and hierarchy changes.
The isSubmitted=true is seen by the first history entry, but page instances
further back have isSubmitted=false. Another solution is
setVersioned(false), but we like the back button to work while wizard is
active.

It seems like we need to maintain wizard state at a higher scope such as
the session, keyed uniquely by some wizard instance identifier (maybe a
UUID). Ensuring that this set of submitted (or in-progress) wizards remains
bounded seems challenging, though probably not a practical concern. Do you
have a more clever solution to this problem?

Regards,
Dan


Re: Retaining non-injected properties of a SpringBean

2012-07-15 Thread Dan Retzlaff
Hi Shu,

We essentially use option 2. Since we use Guice, @Component and @Scope are
unfamiliar to me. (DAODataProvider isn't created/managed by Spring, so why
specify a scope like that?) Aside from those, I don't see any undue
coupling... just an @Inject.

Our general rule is that @Inject'd dependencies should never have mutable
state. Your options 1 and 3 are tricky workarounds necessary only because
you violated this simple rule. Once you introduce things like data filters
and variable sorting into your data provider, you'll find these approaches
even more problematic.

Hope that helps,
Dan

On Sun, Jul 15, 2012 at 8:10 PM, Shu webblaz...@yahoo.com wrote:

 In the Spring-enabled example below, the DAODataProvider object has an
 entityClass property. When the user navigates to the DemoPage via the Back
 button, the dataProvider and dataProvider.dao properties are available, but
 dataProvider.entityClass is null. This is because dataProvider is a proxy
 which doesn't serialize its own non-injected state fields.




 public class DemoPage extends WebPage {
 @Inject @SpringBean DAODataProvider dataProvider;

 public DemoPage(final PageParameters parameters) throws
 ClassNotFoundException, IntrospectionException {
 super(parameters);
 dataProvider.setEntityClass(UserAccount.class);
 add(new CRUDPanel(panel, UserAccount.class, dataProvider));
 }
 }

 @Component
 @Scope(request)
 public class DAODataProvider extends SortableDataProvider {
 @Inject protected GeneralDAO dao;
 private Class? entityClass;

 public DAODataProvider() {
 super();
 }
 }


 The solution for retaining the state of a non-Wicket component seems to be
 to either do this (Option 1):

 (Option 1)
 public class DemoPage extends WebPage {
 @Inject @SpringBean DAODataProvider dataProvider;

 public DemoPage(final PageParameters parameters) throws
 ClassNotFoundException, IntrospectionException {
 super(parameters);
 dataProvider.setEntityClass(UserAccount.class);
 add(new CRUDPanel(panel, UserAccount.class, dataProvider));
 }

 @Override
 protected void onBeforeRender()
 {
 dataProvider.setEntityClass(UserAccount.class);
 super.onBeforeRender();
 }
 }


 or use Injector (Option 2):

 (Option 2)

 public class DemoPage extends WebPage {
 DAODataProvider dataProvider;

 public DemoPage(final PageParameters parameters) throws
 ClassNotFoundException, IntrospectionException {
 super(parameters);
 dataProvider = new DAODataProvider();
 dataProvider.setEntityClass(UserAccount.class);
 add(new CRUDPanel(panel, UserAccount.class, dataProvider));
 }
 }

 @Component
 @Scope(request)
 public class DAODataProvider extends SortableDataProvider {
 @Inject protected GeneralDAO dao;
 private Class? entityClass;

 public DAODataProvider() {
 super();
 Injector.get().inject(this);
 }
 }


 or use Session scope (Option 3):


 @Component
 @Scope(session)
 public class DAODataProvider extends SortableDataProvider {
 @Inject protected GeneralDAO dao;
 private Class? entityClass;

 public DAODataProvider() {
 super();
 }
 }


 The first 2 options create a tighter dependency between my code and
 Spring, which I would like to avoid. With the 3rd option it is difficult to
 have many instances of DAODataProvider within the same user session.

 Is there a better way to indicate that a SpringBean-injected object should
 have its non-injected properties serialized? Or is there some sort of Page
 scope where dependencies are bound to a page and deserialized appropriately?


 Thanks,
 Shu

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




Re: Components do not re-render when page is refreshed...

2012-06-30 Thread Dan Retzlaff
DataView/IDataProvider queries the database for each request too. The
reason it is preferred over PageableListView is that it allows only the
current page of results to be pulled from the database. PageableListView
requires *all* results to be pulled, but then only renders a single page.

At any rate, using an IModel-backed PageableListView will look something
like this:

IModelListMyItem itemsModel = new
LoadableDetachableModelListMyItem() {
protected ListMyItem load() {
// query database for items
}
};
add(new PageableListViewMyItem(item, itemsModel, 10) {
protected void populateItem(ListItemMyItem item) {
// populate item
}
});

On Sat, Jun 30, 2012 at 1:20 AM, kshitiz k.agarw...@gmail.com wrote:

 Actually I am using listview because I do want to query database every
 time I
 change page of pageable listview. How would I use IModel in
 pageableListview?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650303.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: how to connect elements - label and input (checkbox)

2012-06-30 Thread Dan Retzlaff
The easiest way is probably to use a wicket:for attribute:
label wicket:for=enabledCheckEnabled/label
input type=checkbox wicket:id=enabledCheck/

Alternatively, you can also use FormComponent#setLabel(IModelString) in
Java to define an input's label value, then show that label by adding
(Simple)FormComponentLabel as a separate component (i.e. with its own
wicket:id).

On Sat, Jun 30, 2012 at 9:13 AM, Dan12321 wee...@centrum.cz wrote:

 Hi,
 when I click on text in  element, it select or unselect checkbox. But I
 need
 to set attribute for in label and attribute id in checkbox input.
 I use it in repeater. So I have to generate random text for this
 attributes.
 Is there any better way how to do it?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/how-to-connect-elements-label-and-input-checkbox-tp4650304p4650308.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: Components do not re-render when page is refreshed...

2012-06-29 Thread Dan Retzlaff
That's how Wicket manages stateful pages: it constructs it once, and
subsequent actions (including re-rendering all or part) are handled by the
same instance. If you want a label's content to be recomputed with each
rendering, give it an IModelString at construction instead of the actual
string.

On Fri, Jun 29, 2012 at 10:50 AM, kshitiz k.agarw...@gmail.com wrote:

 Hi,

 Like this is one page:


 public UserHome(final PageParameters pageParameters, UserDomain userDomain)
 {
 super(pageParameters, userDomain);
if (userDomain == null)
userDomain = getUserById(this.userId);

add(new SearchPanel(searchPanel));

// user name to appear in required pages
*   Label nameLabel = new Label(name, userDomain.getName());
add(nameLabel);
 *
 *system.out.println(This should be printed every time);*

 }

 Now, when the page loads the first time, *This should be printed every
 time*
 is printed. That means, contructor is called. But when the page is
 refreshed, nothing is printed. To give you more details, suppose this is
 the
 url of the page:

 /http://localhost:8080/Page?32/

 When, I just refresh the whole url, nothings happens but when I remove
 parameters of the url(/http://localhost:8080/Page/, rendering happens
 again. Why is this happening?



 scott.swank wrote
 
  How do you construct your panels? This sounds like a model issue...
 
  Scott
 
  On Fri, Jun 29, 2012 at 9:02 AM, kshitiz lt;k.agarwal4@gt; wrote:
  Hi,
 
  In my wicket application, each page carries many panels. *Now every
 panel
  is
  rendered when the page is loaded but when it is refreshed, nothing
  happens.
  * No panel is getting rendered again, not even sysouts are printing
  anything. *Now this is a good thing for performance but I want them to
 be
  re-rendered.Is there any way to make it happen...??*
 
  --
  View this message in context:
 
 http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290.html
  Sent from the Users forum mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscribe@.apache
  For additional commands, e-mail: users-help@.apache
 
 
  -
  To unsubscribe, e-mail: users-unsubscribe@.apache
  For additional commands, e-mail: users-help@.apache
 

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650292.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: Components do not re-render when page is refreshed...

2012-06-29 Thread Dan Retzlaff
Instead of using entities and strings in your constructors, use IModels
such as LoadableDetachableModel. When re-rendering (AJAX or reload), your
constructors aren't called again, but IModel#getObject() are called.

On Fri, Jun 29, 2012 at 12:09 PM, kshitiz k.agarw...@gmail.com wrote:

 Hi,

 Thanks for the reply. Just to clarify, like if I am adding a panel:

 *add(new PostPanel(postPanel, pageParameters, userTypeDomain,
userDomain));*

 So, how do I make it render at every page refresh...?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650294.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: Components do not re-render when page is refreshed...

2012-06-29 Thread Dan Retzlaff
Are you giving your ListView an IModelListT or a ListT? It needs to
be the former to be redetermined on refresh.

On Fri, Jun 29, 2012 at 12:48 PM, kshitiz k.agarw...@gmail.com wrote:

 Actually in that post panel, I am taking data from the database and
 displaying it as listview. Now, when I manually enter a new entry in the
 database and then refresh page, the new entry is not getting displayed.
 This
 simple means that the given panel is not picking up the data from the
 database at every refresh or in other words, methods are not being called
 of
 that panel.


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650297.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: Components do not re-render when page is refreshed...

2012-06-29 Thread Dan Retzlaff
I can't guess what your errors are, but for pageable lists you should
probably be using DataView. There are examples here:
http://www.wicket-library.com/wicket-examples/repeater/

On Fri, Jun 29, 2012 at 1:08 PM, kshitiz k.agarw...@gmail.com wrote:

 I am using list only like this:


 PageableListViewPostDomain postDomainListView = new
 PageableListViewPostDomain(
postList, *postDomainList*, postsPerPage)
 {
 // .

 }

 How am I suppose to use IModel for list? It is giving errors over here...


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Components-do-not-re-render-when-page-is-refreshed-tp4650290p4650299.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: Feedback next to each input field on form

2012-06-12 Thread Dan Retzlaff
You might find my wiki post on application-wide validation error styling
helpful:
https://cwiki.apache.org/confluence/display/WICKET/Automatic+styling+of+form+errors

Putting the actual validation text next to the form component is trickier
since it affects layout. If you can't make an application listener work,
then I think you're stuck manually placing component-scoped feedback
components as in Sandor's link.

Dan

On Tue, Jun 12, 2012 at 11:44 AM, Sandor Feher sfe...@bluesystem.hu wrote:

 Hi,

 Have you seen this ?

 http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Feedback-next-to-each-input-field-on-form-tp4649886p4649888.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: How to manage redirects using rewrite maps

2012-06-01 Thread Dan Retzlaff
Hi Jan,

Have you tried proxying with AJP instead of HTTP? Some of this complexity
goes away then.

Using mod_rewrite's [P] flag to proxy requests shouldn't be incompatible
with ProxyPassReverse or ProxyPassReverseCookieDomain. Did you try it?

Dan

On Fri, Jun 1, 2012 at 2:51 AM, Jan Riehn jan.ri...@1und1.de wrote:

 Hello,

 we use a tomcat behind a apache. we also use mod_rewrite proxy rules to
 manage requests from the apache to the tomcat. Our wicket application
 modifies the location header:

 curl -I 
 http://wicket-application/**application-context/loginhttp://wicket-application/application-context/login

 HTTP/1.1 302 Moved Temporarily
 Date: Wed, 30 May 2012 13:45:15 GMT
 Server: Apache-Coyote/1.1
 Expires: Thu, 01 Jan 1970 00:00:00 GMT
 Pragma: no-cache
 Cache-Control: no-cache, no-store
 Location: 
 http://localhost:8080/**application-context/loginhttp://localhost:8080/application-context/login
 Set-Cookie: JSESSIONID=**5F08FEDBAAABD7F3E83C7EF785C6A6**88;
 Path=/application-context
 Vary: User-Agent
 Content-Type: text/plain


 So we get a redirect to localhost. the hint: https://cwiki.apache.org/**
 WICKET/wicket-application-**behind-modproxyhttp-and-https.**htmlhttps://cwiki.apache.org/WICKET/wicket-application-behind-modproxyhttp-and-https.htmldoes
  not work, because we are using rewrite maps for our mod_rewrite proxy
 rules. So we have no chance to use ReverseProxy.

 How can I solve this issue?

 Best regards,

 Jan



Re: Batch process message to user

2012-06-01 Thread Dan Retzlaff
Hi Kemal,

You could register your own root IRequestMapper. See the last paragraph
under The new way in Wicket 1.5:
https://cwiki.apache.org/WICKET/request-mapping.html

Dan

On Fri, Jun 1, 2012 at 9:52 AM, chrome1235 kemal.m...@gmail.com wrote:

 Hi,
 My Application has some batch processes, therefore I want to response to
 users a message like server is busy now.
 I mean, all user request will forward to single page. And I want to do it
 in
 Application class, not pages.

 Can I solve this problem?


 Best regards,
 kemal.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Batch-process-message-to-user-tp4649662.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: Single sign on (SSO) for two WicketApplication

2012-05-10 Thread Dan Retzlaff
Jens, I describe some details of our homegrown application handoff
solution here:
http://mail-archives.apache.org/mod_mbox/wicket-users/201202.mbox/%3ccac-l2fym4txq7733aeuvfdnustlte_nbsix2zojvytqkoga...@mail.gmail.com%3E


On Thu, May 10, 2012 at 4:02 AM, jensiator jens.alen...@gmail.com wrote:

 What about if I say that its only wicket applications? Can we narrow it
 down
 even more then?
 In both apps have a link to each other so the end user can toggle between
 them. If these link's are external links. How could you send/share the
 username password between den in a secure way? Https of course but I don't
 have a clue when it comes to coding. Never worked with this.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Single-sign-on-SSO-for-two-WicketApplication-tp4620516p4623142.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: Loadable-detachable model for ListView

2012-05-10 Thread Dan Retzlaff
I may have been wrong about that... I can't setup a test app right now, but
I think the default configuration of DataView also discards models on
detach. Sorry for the confusion.

On Thu, May 10, 2012 at 12:06 PM, sudeivas sureshkumar@gmail.comwrote:

 Dan has mentioned I think
 ListView is better than DataView because it naturally discards its contents
 after the request where data view saves models, keeping your session size
 the same.

 So if my list has 1000 entries, will the session store all these values if
 I
 use DataView/IDataProvider and LoadableDetachableModel?

 -Suresh

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Loadable-detachable-model-for-ListView-tp4621232p4624338.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: igor's select2 script

2012-05-09 Thread Dan Retzlaff
I'll post to github shortly. I was thinking it'd be more accessible if
rolled into one of these existing Wicket component libraries, but since I
haven't had time to coordinate that, I'll just license it ASL and somebody
else can do it if desired.

Good timing on the reminder... I leave on Friday for a 4-5 month hike!

On Wed, May 9, 2012 at 8:12 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 hi Uwe,

 Dan Retzlaff has created a wrapper, but as far as i know he hasnt
 publicly shared it yet. i havent really had much time to work on my
 own wrapper or to look at his yet.

 my recommendation, barring Dan doesnt share his code, is to create a
 very thin integration that you can later replace with either mine or
 Dan's or someone else's who takes the time to write a proper
 integration. or maybe share your own if you write something that is
 worth sharing.

 -igor


 On Wed, May 9, 2012 at 5:10 AM, Uwe Schäfer u...@thomas-daily.de wrote:
  hi
 
  in order not to duplicate work: is there a wicket wrapper component out
  there using igor's select2 script, already?
 
  cu uwe
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 

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




Re: igor's select2 script

2012-05-09 Thread Dan Retzlaff
Here you go, Uwe (and all): https://github.com/dretzlaff/wicket-select2

If you provide feedback in the next couple of days I'm happy to address it.

Props to Igor for sharing Select2 itself.

On Wed, May 9, 2012 at 10:01 AM, Dan Retzlaff dretzl...@gmail.com wrote:

 I'll post to github shortly. I was thinking it'd be more accessible if
 rolled into one of these existing Wicket component libraries, but since I
 haven't had time to coordinate that, I'll just license it ASL and somebody
 else can do it if desired.

 Good timing on the reminder... I leave on Friday for a 4-5 month hike!


 On Wed, May 9, 2012 at 8:12 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 hi Uwe,

 Dan Retzlaff has created a wrapper, but as far as i know he hasnt
 publicly shared it yet. i havent really had much time to work on my
 own wrapper or to look at his yet.

 my recommendation, barring Dan doesnt share his code, is to create a
 very thin integration that you can later replace with either mine or
 Dan's or someone else's who takes the time to write a proper
 integration. or maybe share your own if you write something that is
 worth sharing.

 -igor


 On Wed, May 9, 2012 at 5:10 AM, Uwe Schäfer u...@thomas-daily.de wrote:
  hi
 
  in order not to duplicate work: is there a wicket wrapper component out
  there using igor's select2 script, already?
 
  cu uwe
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 

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





Re: igor's select2 script

2012-05-09 Thread Dan Retzlaff
Use in 1.4 requires some relatively simple code changes. For example the
resource syntax (for serving Select2 AJAX requests) is different. But after
little changes like that, it should work fine.

On Wed, May 9, 2012 at 1:04 PM, Emmanouil Batsis (Manos) ma...@abiss.grwrote:



 this is cool! Any chance it works with wicket 1.4.x?

 Manos


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




Re: Loadable-detachable model for ListView

2012-05-09 Thread Dan Retzlaff
Suresh,

I haven't seen a packaged solution for inifinte scroll in Wicket. But the
way I'd implement it is to detect that more content is needed with
JavaScript (some kind of jQuery event listeners), then make a request to a
Wicket AJAX behavior. I'd have the behavior render content into a hidden
list view, then use jQuery to move those list view items to the bottom of
the visible list. This way each response only sends new content. I think
ListView is better than DataView because it naturally discards its contents
after the request where data view saves models, keeping your session size
the same. You should probably pass the current page of results as a query
parameter in your AJAX behavior request (instead of keeping that state
server-side). That way if the user reloads the page, they simply go back to
the first page of results.

Hope that helps.

Dan

On Wed, May 9, 2012 at 4:11 PM, sudeivas sureshkumar@gmail.com wrote:

 Thanks Igor for the response.

 If I use dataview.setItemsPerPage(50), then my Data View loads only the
 first 50 entries. But how can I trigger or ask the data view to load the
 next 50 entries when we scroll down the list or when we reach the end of
 the
 list?

 -Suresh

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Loadable-detachable-model-for-ListView-tp4621232p4622091.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: Store models short-term

2012-05-05 Thread Dan Retzlaff
Yes, you still deal with detached entities
(LazyInitializationException, StaleStateException, last writer wins, etc).
And worse in my opinion, it makes things different when responding from the
latest page vs. a page recovered with the back button, or if another
window/tab has made an intervening request. It's this reason that I'm not a
huge fan of the optimization in the first place. It's added another layer
of complexity to a couple of debugging sessions in the past year or so.

But since suppressing detach() is so easy and exactly satisfies the
requirements, I figured it was worth mentioning with a caveat. And I do
appreciate your emphasizing the caveat. :)

On Sat, May 5, 2012 at 2:31 PM, Jeremy Thomerson
jer...@wickettraining.comwrote:

 On Fri, May 4, 2012 at 6:15 PM, Dan Retzlaff dretzl...@gmail.com wrote:

  I'll mention one hack for which another Wicket user should rightly
  reprimand me. As I mentioned recently, Wicket keeps the most recently
  accessed page is a deserialized state to optimize serving the next
 request.
  All components are still detached, but if you override IModel#detach() in
  your LDM and suppress super.detach() then your entity will hang around.
  This has the behavior you describe, since (1) the entity does not need to
  be reloaded on subsequent requests, and since it's object reference is
  transient (2) it goes away as soon as another page is accessed, and (3)
 it
  does not get replicated among the cluster.
 


 Well, you admitted you should be reprimanded :)  Doesn't that hack
 still leave you with lots of problems like stale/detached entities etc?  I
 definitely would not recommend that hack to someone new who is just trying
 to learn Java *and* Wicket.  I'd instead say (like you started off with)
 don't prematurely optimize, learn and get experience with the new way of
 doing things and make sure you 150% understand them (and everything else
 that's going on) before trying to 'fix' things.

 --
 Jeremy Thomerson
 http://wickettraining.com
 *Need a CMS for Wicket?  Use Brix! http://brixcms.org*



Re: Store models short-term

2012-05-04 Thread Dan Retzlaff
Hi, Jason. Welcome to Wicket!

If you want to tie an entity to a page, best save the entity within the
page itself. You can do this by using a simple o.a.w.model.Model. If you
don't want to detach between requests, then LDM is not a good fit.

There are use cases where serializing entities at the app level (instead of
the database) makes sense, such as wizards where saving prematurely results
in an invalid data model. However, if your motivation is simply performance
then I suggest you verify your assumptions. Retrieving entities by primary
key is generally very fast, and if it's not fast then it's because it's
really large and you probably don't want that serialized in the session
anyway. The optimization is especially moot in clusters where the
undetached entities are replicated across the network as part of the HTTP
session. And there are other disadvantages such as having to deal with
detached entities, with potentially stale state.

I'll mention one hack for which another Wicket user should rightly
reprimand me. As I mentioned recently, Wicket keeps the most recently
accessed page is a deserialized state to optimize serving the next request.
All components are still detached, but if you override IModel#detach() in
your LDM and suppress super.detach() then your entity will hang around.
This has the behavior you describe, since (1) the entity does not need to
be reloaded on subsequent requests, and since it's object reference is
transient (2) it goes away as soon as another page is accessed, and (3) it
does not get replicated among the cluster.

Best of luck,
Dan

On Fri, May 4, 2012 at 2:40 PM, JASON HOLT j_holt5...@msn.com wrote:


 I'm new to Java and Wicket. My only previous experince with web
 applications has been with Asp.net forms (not MVC). Please be patient;
 coming from the postback event paradigm, I'm struggling to grasp the
 concepts in Wicket. In my simple scenario, assume there is no AJAX. I need
 to build the model from a database. If I use an LDM, on a postback Wicket
 calls to the database to rebuild the model before updating it with the new
 values. But if I don't use an LDM, Wicket will serialize the model in the
 PageMap. I would like to keep the model 'in memory' long enough to process
 the postback to avoid unecessary calls to the database, but release it when
 I have moved on to a different page. I thought of something like this... In
 the LDM  @Override
  public Object load()
  {
   ...somehow get the session.
   if (session.getAttribute(PageAModel)!=null)
   {
return (PageAModel)session.getAttribute(PageAModel);
   }
   else
   {
PageAModel pageAModel = ...build from database.
session.setAttribute(PageAModel, PageAModel);
return pageAModel;
   }
  } Then in the Page...  @Override
  public void onSubmit()
  {
   PageAModel pageAModel=(PageAModel)session.getAttribute(PageAModel);
   ...update the database with   PageAModel pageAModel =
 (PageAModel)ldm.getObject();
   ...   //removes the model from session?
   session.setAttribute(PageAModel)=null;
   this.setResponsePage(...);
 } I suspect there is a better way to handle this. Can I avoid using an
 LDM, but somehow remove the model from the PageMap after leaving the page?



Re: AW: Open page in new window when clicking on button

2012-05-03 Thread Dan Retzlaff
Your back button isn't really taking the user back; it's taking the user to
a new instance of the search page. How about:
button value=Back type=button
onclick=window.history.back()Back/button

On Thu, May 3, 2012 at 12:54 PM, laine78 meldsa...@hotmail.com wrote:

 I went ahead and terminated the tags with /
 Here is the html code generated by my browser.  Everything looks okay to me
 as best as I can tell.

 div align=center
 button id=back2d class= xmlns:wicket=http://wicket.apache.org;
 value=Back name=back type=submit Back/button
 button id=display2e class= xmlns:wicket=http://wicket.apache.org;
 value=Print name=print onclick=target='_blank';return true;
 type=submit Display/button
 /div

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Open-page-in-new-window-when-clicking-on-button-tp4606719p4606960.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: Wicket 1.5 and jbpm spring configuration

2012-05-03 Thread Dan Retzlaff
I think you're trying to post code, but as Igor indicated, it's not coming
through. Maybe you should paste into https://gist.github.com/ and give us a
link.

Not sure what your IDE is, but you might look into heap analysis tools such
as the Eclipse Memory Analysis Tool[1]. I kind of doubt there will be a
smoking gun, so you might provide a working quickstart [2].

[1] http://www.eclipse.org/mat/
[2] http://wicket.apache.org/start/quickstart.html

On Thu, May 3, 2012 at 9:06 PM, jensiator jens.alen...@gmail.com wrote:

 I'm sorry
 I will need to describe it better.
 The Jbpm is at this point out of my reach. No doubt it has been implemented
 badly (by others) and I will look into it when I got time. The question is
 why this jbpm project is affecting wicket 1.5 more than wicket 1.4.
 Remember
 that I switch to an empty wicket application to rule out any mistake from
 myself (except in following config). So I will start with showing my
 config.
 Im using maven for dependencies
 *in web.xml.* I add spring constextlistener, hibernate strategy and my
 standard wicket config.


 I use wicket-spring to inject dao's in my components
 *in Application init*

 But I have ruled out this because the mem problems still remain if I use a
 empty standard wicket app. Just defining a start page. I just test to start
 the application
 *applicationContext*
 My hibernate knowledge is weak so I have tried to use standard stuff


 That's about it. What is pulling up the memory? Is it data being stored in
 the session? Data from a badly written JBPM layer? How can I investigate
 it.
 TaskManager is not enough. Any tools out there? Or any good hook up point
 in
 wicket to debug?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-and-jbpm-spring-configuration-tp4607670p4607775.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: browser resolution info .. ClientProperties question

2012-05-02 Thread Dan Retzlaff
If you look into the extended browser info detection, you'll see the
results of some JavaScript tests being submitted as a form, and saved in a
session-scoped object for server-side use. Instead of using these results,
you can use your own session-scoped information, and your own Wicket
behavior to detect/submit your data. This behavior can be added at a page
level, or added with an application-level listener, depending on what's
easiest for you.

If you want to avoid the initial if you see this... page, you'll need to
provide some defaults / assumptions for the detected properties for use in
the initial page rendering. In the case of screen resolution detection,
this is not a problem; just choose something conservative.

You can see some details of my solution here:
http://apache-wicket.1842946.n4.nabble.com/Dynamically-sized-image-td4456657.html

Dan

On Tue, May 1, 2012 at 7:49 PM, mlabs mlabs@gmail.com wrote:

 So I added a call to:

  getRequestCycleSettings().setGatherExtendedBrowserInfo(true);

 in my app.init()

 and sure enough I can now see the client's browser resolution...

 but I also see it briefly redirect to a page with some 'if you see this..'
 text on it...

 Q: Is there any way to stop that showing up?

 Q: if not, is there a better way to detect the client's browser resolution?

 TIA

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/browser-resolution-info-ClientProperties-question-tp4602259.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: deserialization - got nulll lastPage

2012-05-02 Thread Dan Retzlaff
Hi Dale,

Wicket keeps the most recent page from each session in a deserialized
state, in addition to writing it to disk. This is an optimization since
most requests interact with only the most recent page. After restart, these
deserialized pages will not be available, forcing Wicket to restore the
page from disk. It's not really an error, and as you've observed should not
affect the user.

I don't have the code with me to verify this explanation, but I'm pretty
sure this is correct.

Dan

On Tue, May 1, 2012 at 5:19 PM, Dale Ogilvie dale_ogil...@trimble.comwrote:

 What does this warning from our wicket 1.4.20 app signify?

 WARN org.apache.wicket.protocol.http.SecondLevelCacheSessionStore
 PageMap deserialization - got nulll lastPage

 It seems to occur in a couple of situations:

 a) when the application is reloaded due to a web.xml change
 b) when restarting the tomcat instance

 nothing out of the ordinary is being done here, just re-loading the app.

 Thanks

 Dale


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




Re: Unusual problem is coming in rendering component

2012-05-02 Thread Dan Retzlaff
I'd guess that you're using CompoundPropertyModel. This kind of confusion
is common with CPM, which is why people often recommend against it.

On Wed, May 2, 2012 at 12:09 PM, Richard W. Adams rwada...@up.com wrote:

 It means it's looking for a method called getPostTextField() in your
 model, but not finding one.




 From:   kshitiz k.agarw...@gmail.com
 To: users@wicket.apache.org
 Date:   05/02/2012 02:08 PM
 Subject:Unusual problem is coming in rendering component



 Hi,

 I am trying to render a text field :

 Java code:

 *final RequiredTextFieldString postTextField = new
 RequiredTextFieldString(
  postTextField);

 *postForm.add(postTextField);*

 Html code
 *input type=text id=postTextField wicket:id=postTextField/*

 But I am gettin the error:

 Root cause:

 org.apache.wicket.WicketRuntimeException: No get method defined for class:
 class domain.PostDomain expression: postTextField
 at

 org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:499)
 at

 org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:341)
 at

 org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
 at

 org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
 at

 org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
 at
 org.apache.wicket.Component.getDefaultModelObject(Component.java:1668)
 at

 org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1695)
 at

 org.apache.wicket.markup.html.form.FormComponent.getModelValue(FormComponent.java:1211)
 at

 org.apache.wicket.markup.html.form.FormComponent.getValue(FormComponent.java:837)
 at

 org.apache.wicket.markup.html.form.TextField.onComponentTag(TextField.java:108)
 at
 org.apache.wicket.Component.internalRenderComponent(Component.java:2510)
 at
 org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1534)
 at org.apache.wicket.Component.internalRender(Component.java:2369)
 at org.apache.wicket.Component.render(Component.java:2297)

 Now, when I replace *postTextField* with *post*, no error comes...!!!

 That is, if my java code is:
 *final RequiredTextFieldString postTextField = new
 RequiredTextFieldString(
 post);

 and Html code is:

 *input type=text id=postTextField wicket:id=post/*

 The code runs fine...

 What can be the problem...?



 --
 View this message in context:

 http://apache-wicket.1842946.n4.nabble.com/Unusual-problem-is-coming-in-rendering-component-tp4604163.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




 **

 This email and any attachments may contain information that is
 confidential and/or privileged for the sole use of the intended recipient.
  Any use, review, disclosure, copying, distribution or reliance by others,
 and any forwarding of this email or its contents, without the express
 permission of the sender is strictly prohibited by law.  If you are not the
 intended recipient, please contact the sender immediately, delete the
 e-mail and destroy all copies.
 **



Re: Passing parameter to a portion of a page

2012-04-30 Thread Dan Retzlaff
I'm not sure what you mean by passing a parameter-- you control the
forms' construction, so you can pass anything you'd like.

If your goal is to make bookmarkable construction parameters available to
all forms, getPage().getPageParameters() would help. (That doesn't change
with AJAX, though, so probably not what you meant.) If your goal is to
share the same IModel among all instances, you might consider stashing it
in metadata on the page (getPage().setMetaData(...)), and having your forms
grab it from there.

Hope that helps,
Dan

On Mon, Apr 30, 2012 at 4:10 AM, kshitiz k.agarw...@gmail.com wrote:

 Hi,

 Lets say there are many forms in a page and in every form, there is drop
 down choice with onselectionchange feature. Is it possible to pass a
 parameter to any one of the form only rather than entire page? Will it be
 done through Ajax?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Passing-parameter-to-a-portion-of-a-page-tp4597887.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: dynamic vertical menu

2012-04-30 Thread Dan Retzlaff
Hi, Lenin. Have you looked into these two examples? They might help you get
started.

http://www.wicket-library.com/wicket-examples/nested/
http://www.wicket-library.com/wicket-examples/navomatic/

Dan

On Mon, Apr 30, 2012 at 12:30 AM, lenin lening...@gmail.com wrote:

 Dear,

 i am new in the wicket1.5.5 framework , how to create dynamic vertical
 menu(with sub menu) 
 i want to display the page within the menu page.
 i am trying this past one month but till not able to find out the solution
 can any one help to resolve the problem...

 thanks in advance

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/dynamic-vertical-menu-tp4597577.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: Setting value to object when validation failed

2012-04-30 Thread Dan Retzlaff
Generally when a field validation fails, the user's raw input is
re-rendered instead of the original model value. This lets the user correct
his input instead of retyping the whole thing. Since this is not the
behavior you want, you can call firstName.clearInput() in your onError().

On Mon, Apr 30, 2012 at 12:45 AM, meduolis meduol...@gmail.com wrote:

 Hello this is quick start project which reproduces my case
 http://apache-wicket.1842946.n4.nabble.com/file/n4597599/project.zip
 project.zip

 The problem is, that I cannot set value for object after form validation
 fails.

 How to reproduce:
 1. Startup my quicstart app;
 2. Do not fill required field and press Save;
 4. Validation error occurs, that field is required;
 3. Press Set name; (this should set first name to John Doe and
 refresh);

 Expected result: input field sets to John Doe;

 Actual result: nothing happens;

 Does anyone knows what I am doing wrong? :)

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Setting-value-to-object-when-validation-failed-tp4597599.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: Passing parameter to a portion of a page

2012-04-30 Thread Dan Retzlaff
What you describe sounds like Wicket's default behavior. It knows which
widgets correspond to which Java components, and routes data accordingly
when submitted.

On Mon, Apr 30, 2012 at 10:05 AM, kshitiz k.agarw...@gmail.com wrote:

 Thanks for the reply Dan...now consider a situation:

 You have 5 drop downs, each with onselectionchange enabled. When you change
 the choice of any one drop down, the chosen value should be passed as
 parameter to that drop down only, so that it will display new value. Rest
 drop downs should not get changed. How will you do that?

 On way would be to allocate each drop down a unique id and then, associate
 each parameter being passed to the same page with that id. This will help
 to
 judge the coming parameter belongs to which drop down. But is there any
 more
 efficient way?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Passing-parameter-to-a-portion-of-a-page-tp4597887p4598758.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: Setting value to object when validation failed

2012-04-30 Thread Dan Retzlaff
Check out Form#clearInput() which calls FormComponent#clearInput() on all
of its components. You can do similiar, but incorporate
FormComponent#hasErrorMessage() so you don't also reset fields with valid
input.

On Mon, Apr 30, 2012 at 11:11 AM, meduolis meduol...@gmail.com wrote:

 This solves my problem. Is there any way to collect all components that
 fails?
 or I just have to check each separate component if it has any feedback
 messages (level  ERROR) and then clear it's value by myself?


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Setting-value-to-object-when-validation-failed-tp4597599p4598947.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: ListView (or other Repeater) with backing map

2012-04-30 Thread Dan Retzlaff
You can call LDM#detach() after the modification, but since this particular
implementation is so light, I'd just use AbstractReadyOnlyModel instead. It
doesn't cache, so detach is not required.

On Mon, Apr 30, 2012 at 11:36 AM, cmagnollay cmagnol...@gmail.com wrote:

 And I can force the model to update, via AJAX, or in other words, how I
 force
 the list view to update after a user action?

 onUpdate(AjaxRequestTarget target)
 {
  target.add(theListView) ??
 }

 or is it something I do with the model itself? Sorry, I have no experience
 with LoadableDetachable, and a quick glance at the API did not enlighten
 me.
 My guess would be to give the listview a new model on each trigger of the
 AJAX code.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/ListView-or-other-Repeater-with-backing-map-tp4598817p4599009.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: ListView (or other Repeater) with backing map

2012-04-30 Thread Dan Retzlaff
I assumed the action phase would dereference the ListItemModel (e.g. to
remove it from the map), hence dereference the LDM, and then require the
explicit detach() before rendering. Agreed that LDM is the way to go if
you're concerned about the ArrayList constructions.

On Mon, Apr 30, 2012 at 11:57 AM, Carl-Eric Menzel cmen...@wicketbuch.dewrote:

 On Mon, 30 Apr 2012 11:38:36 -0700
 Dan Retzlaff dretzl...@gmail.com wrote:

  You can call LDM#detach() after the modification, but since this
  particular implementation is so light, I'd just use
  AbstractReadyOnlyModel instead. It doesn't cache, so detach is not
  required.

 Actually, getObject() can be called pretty often, so that would incur
 the cost of creating the new List object *each time*. I would really
 use the LDM. Since in my example the LDM is passed directly into the
 ListView as its default model, the ListView will take care of
 detaching [1].

 cmagnollay, that means that on each render you should simply see
 whatever is currently in your map, so it should be up to date on its
 own without further action.

 An LDM calls the load() method the first time its getObject() is
 called. The value you return from load() will be cached until detach()
 is called on the LDM. The normal usecase is to do an expensive
 operation (load from DB, create a lot of objects, etc) only once in a
 request but to still have fresh data in each request. Also it reduces
 session size because the cached data is not kept between requests.

 Hope this helps!
 Carl-Eric

 [1] Carl-Eric's rule of detaching models: *always* do one of the
following:
  - detach the model yourself
  - pass the model to one of your child components or your
superclass, thus making it that code's responsibility.

You never know what model implementation you might be getting as a
parameter. Be nice to whoever calls you.

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




Re: getting client's TimeZone and performace

2012-04-26 Thread Dan Retzlaff
That depends on how much you value the landing experience. There will be an
extra page rendering and redirect for each new session. I haven't noticed
this pattern from any big online retailers, for example, but it may make
sense for you.

On Thu, Apr 26, 2012 at 6:56 PM, infiniter infini...@gmail.com wrote:

 So, no risk of a poor user experience?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/getting-client-s-TimeZone-and-performace-tp4590597p4591533.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: how to create DISQUS like web widgets that can be deployed to third party web pages

2012-04-23 Thread Dan Retzlaff
That approach is not a conventional use of Wicket AJAX, and I think it
would be very tricky. Can you have your partner host an IFRAME, populated
from your site with a Wicket page? That page can then easily host
repeaters, AJAX links, and panels.

Dan

On Mon, Apr 23, 2012 at 5:42 PM, bad boy badmas...@yahoo.com wrote:

 Hi  all

 I am looking at a scenario where some of my partner web sites would like
 to show some panels from my wicket application much like DISQUS or
 IntenseDebate.

 My wicket web application would run on my domain.

 My partners page would be on his domain

 The partner would have page with an onLoad(){} javascript script ; I want
 to put AjaxBehavior code in this javascript that would  call my wicket
 application which could send my wicket panel serialized to a string to the
 caller javascript . This way the partner web page would be able to display
 my wicket panels. My wicket panel would only contain AjaxLinks that would
 refresh / redraw the panel as necessary by adding / removing child
 components

 Is this possible ? Can I create a AjaxBehavior that can return a Panel
 serialized  to an HTML string that can be then written to the DOM of the
 caller HTML page.


 Regards

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




Re: How to enable SSI in wicket framework.

2012-04-12 Thread Dan Retzlaff
I think the challenge is getting content from a /ssi/footer request
integrated into a Wicket-rendered page. AFAIK Wicket doesn't provide any
component for that. It might be possible using servlet's forward
capability from a custom Wicket component's onComponentTagBody. It seems to
be used for generating internal requests, but I'm not familiar with the
details.

On Wed, Apr 11, 2012 at 11:35 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 See filter-mapping and servlet-mapping elements in web.xsd

 On Thu, Apr 12, 2012 at 9:20 AM, vaibhav228 vaibhav...@gmail.com wrote:
  Hi Martin,
Thanks for the reply. I am new to wicket framework. Can you
  please elaborate more on how to do the setting that you have provided. It
  would be very helpful.
My app is running at ROOT level. SSI is already enabled in the
  web.xml file by removing the SSI servlet tags comments.
 
  --
  View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-enable-SSI-in-wicket-framework-tp4548962p4551039.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: Page Map versions and Ajax Requests

2012-04-12 Thread Dan Retzlaff
Your second suggestion seems pretty solid, but I think people do make
non-trivial component hierarchy changes in onBeforeRender. Why not just
freeze the page version during rendering of reuseItems=false ListViews? You
know the content will be thrown away so a new page version doesn't seem
appropriate.

On Wed, Apr 11, 2012 at 11:47 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 whats happening is this

 user hits the page /foo
 goes to /foo?1
 does a bunch of ajax stuff, staying on /foo?1
 clicks refresh, so hits /foo?1
 listview refreshes, changing hierarchy, creating page version 2
 the ajax behavior's url is rendered as /foo?2:...
 the page is rendered, but not redirected to /foo?2

 so what we have now is a browser pointing to /foo?1 and ajax (and
 non-ajax) urls pointing to /foo?2

 further clicks work only because the component they repaint has the
 same markup id on page 1 and page 2. however, all model changes are
 stored in page 2. this is why when the browser is refreshed the
 counter reverts to a previous value - because it is page 1 that is
 rerendered.

 there are two ways to fix this:

 1) redirect to correct version. so when the browser is refreshed for
 the first time on /foo?1 the browser would redirect to /foo?2 and it
 would keep doing that for every refresh. not ideal.

 2) freeze the page version when we are accessing a url that we know
 will not mutate the state of the page - meaning urls that just render
 the page and do not invoke any listeners. the only state we will lose
 is noise from component replacement in listviews and user's
 onbeforerender() overrides which i think is acceptable since they do
 not represent true state mutation that comes from intentional
 callbacks.

 -igor


 On Wed, Apr 11, 2012 at 6:40 PM, Dan Retzlaff dretzl...@gmail.com wrote:
  I don't know exactly what is making the page dirty in this case.
 
  The AJAX debug window has a ListView in it.
 
  On Wed, Apr 11, 2012 at 7:09 PM, Nelson Segura nsegu...@gmail.com
 wrote:
 
  Sorry, you dont have to refresh 4 times, just once :p
  -Nelson
 
  On Wed, Apr 11, 2012 at 6:08 PM, Nelson Segura nsegu...@gmail.com
 wrote:
   This is easily reproduceable in the wicket sample pages:
  
   http://www.wicket-library.com/wicket-examples/ajax/links
  
   1. Click on the increment link for Counter 2 for times. Counter shows
 4.
   2. CTRL-R/refresh 4 times, the counter still shows 4.
   3. Click on link 4 more times. Counter shows 8
   4.CTRL-R/refresh once more, the counter shows 4!
  
   I don't know exactly what is making the page dirty in this case.
  
   Can you confirm this behavior in the sample page?
  
   -Nelson
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




Re: Running thread + AJAX + page serialization

2012-04-12 Thread Dan Retzlaff
Hi, Martin. I don't think it's appropriate to have your background thread
referencing page objects, especially not modifying them. In general, pages
get deserialized from the page store, in which case the thread's changes
won't even be seen. Maybe you are saved by an optimization that leaves the
most recent page deserialized for each session. I suggest putting your
shared state somewhere else. Session is next candidate, but the same
serialization challenges exist there. Without resorting to an external
store, I think that leaves servlet context attributes. I think the only
challenge there is developing a strategy for removing content so it doesn't
grow unbounded. (It is not tied to session lifecycle.)

On Thu, Apr 12, 2012 at 7:39 AM, Martin Schayna mscha...@gmail.com wrote:

 Hi,

 I have this scenario:

 - browser requests some time-expensive page
 - page renders lazy component (instead of regular component) and starts
 thread for computation data
 - lazy component use Behavior with AJAX callback, timed in seconds
 - user sees in browser indicator
 - when Behavior fires, checks thread is done
 - if thread is done, renders proper component via AJAX with fresh data
 - if thread is pending, renders javascript to postpone AJAX callback again

 My problem:

 There are some serializable fields in page, which are accessed from thread.
 These fields are properly synchronized. Each AJAX response from
 Behavior causes page serialization -- this runs in context of AJAX request
 in the end. But in same time, thread can also access these fields in page
 (typically add/remove items from collections) and serialization can throw
 ConcurrentModificationException. Again, access to fields is synchronized,
 but during serialization there are no chance to synchronizing access to
 fields.

 Are there some techniques/patterns how to solve this?

 For example, can I inject Wicket page serialization to block access to
 fields for my thread?

 Thanks

 Martin



Re: Page Map versions and Ajax Requests

2012-04-12 Thread Dan Retzlaff
I was thinking the same freeze pattern could be applied in the other
repeaters configured to throw away their content. But the no action phase
= no version increment rule is simpler to explain, and probably more
fool-proof.

On Thu, Apr 12, 2012 at 8:38 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 On Thu, Apr 12, 2012 at 7:26 AM, Dan Retzlaff dretzl...@gmail.com wrote:
  Your second suggestion seems pretty solid, but I think people do make
  non-trivial component hierarchy changes in onBeforeRender.

 my point was that such changes are not worthy of a page version
 increment because they can be safely thrown away since they are
 regenerated every render.

  Why not just
  freeze the page version during rendering of reuseItems=false ListViews?
 You
  know the content will be thrown away so a new page version doesn't seem
  appropriate.

 because that is not enough. what about RefreshingViews? what about
 DataViews? what about custom repeaters that users wrote by extending
 RepeatingView? what about other code that changes hierarchy in
 onBeforeRender().

 even code like this would cause the same break:

 onBeforeRender() {
  addOrReplace(new Label(time, new Date()));
 }

 this needs to be handled at a higher level...

 -igor


 
  On Wed, Apr 11, 2012 at 11:47 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  whats happening is this
 
  user hits the page /foo
  goes to /foo?1
  does a bunch of ajax stuff, staying on /foo?1
  clicks refresh, so hits /foo?1
  listview refreshes, changing hierarchy, creating page version 2
  the ajax behavior's url is rendered as /foo?2:...
  the page is rendered, but not redirected to /foo?2
 
  so what we have now is a browser pointing to /foo?1 and ajax (and
  non-ajax) urls pointing to /foo?2
 
  further clicks work only because the component they repaint has the
  same markup id on page 1 and page 2. however, all model changes are
  stored in page 2. this is why when the browser is refreshed the
  counter reverts to a previous value - because it is page 1 that is
  rerendered.
 
  there are two ways to fix this:
 
  1) redirect to correct version. so when the browser is refreshed for
  the first time on /foo?1 the browser would redirect to /foo?2 and it
  would keep doing that for every refresh. not ideal.
 
  2) freeze the page version when we are accessing a url that we know
  will not mutate the state of the page - meaning urls that just render
  the page and do not invoke any listeners. the only state we will lose
  is noise from component replacement in listviews and user's
  onbeforerender() overrides which i think is acceptable since they do
  not represent true state mutation that comes from intentional
  callbacks.
 
  -igor
 
 
  On Wed, Apr 11, 2012 at 6:40 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
   I don't know exactly what is making the page dirty in this case.
  
   The AJAX debug window has a ListView in it.
  
   On Wed, Apr 11, 2012 at 7:09 PM, Nelson Segura nsegu...@gmail.com
  wrote:
  
   Sorry, you dont have to refresh 4 times, just once :p
   -Nelson
  
   On Wed, Apr 11, 2012 at 6:08 PM, Nelson Segura nsegu...@gmail.com
  wrote:
This is easily reproduceable in the wicket sample pages:
   
http://www.wicket-library.com/wicket-examples/ajax/links
   
1. Click on the increment link for Counter 2 for times. Counter
 shows
  4.
2. CTRL-R/refresh 4 times, the counter still shows 4.
3. Click on link 4 more times. Counter shows 8
4.CTRL-R/refresh once more, the counter shows 4!
   
I don't know exactly what is making the page dirty in this case.
   
Can you confirm this behavior in the sample page?
   
-Nelson
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




Re: Same versioned link opens different pages on different machines

2012-04-12 Thread Dan Retzlaff
When re-rendering a page, can you parse the new request URL and make sure
all the parameters are the same as those used at construction? I don't
think Wicket saves the original parameters now, but maybe it should.

On Thu, Apr 12, 2012 at 12:15 PM, Alec Swan alecs...@gmail.com wrote:

 And I see no way to detect such problem by having just the
 information encoded in the url
 This is VERY scary!

 How do I fix this?

 On Thu, Apr 12, 2012 at 11:39 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
  On Thu, Apr 12, 2012 at 7:47 PM, Bertrand Guay-Paquet
  ber...@step.polymtl.ca wrote:
  I don't know much about HybridUrlCodingStrategy since I use Wicket 1.5,
 but
  based on what you observed (.x changes on every render), I would say
 the x
  is the page version.
 
  I re-read your emails and if I understand correctly, both product 379
 and
  123 use the same page class. If that is the case, I don't think
 WICKET-4488
  is the same problem. That issue concerns rendering a different *Page*
 class
  because of a page version id. In your case, the MyPage page class is the
  single page involved in both the wrong and right pages you see rendered.
 
  ^^This is what I tried to explain in my earlier mail.
 
  user1 visits /product/10.8 then goes to /product/20.9
  later user2 sends /product/30.8 to user1
  user1 opens /product/30.8 but actually sees product/10 because Wicket
  loads page with id = 8 from the store ignoring the current request
  parameter (10)
 
  So this is *not* covered by 4488!
  And I see no way to detect such problem by having just the information
  encoded in the url
 
 
 
  I suggest putting a break point or logging code in your page's
 constructor
  to check 1) if a new page is created or an old version is displayed and
 2)
  if the page parameters are properly decoded.
 
 
  On 12/04/2012 12:32 PM, Alec Swan wrote:
 
  but because of the existence of a page with pageId 0 in the page
  store user sees page1, not page2 as user2 intended
 
  So, what is the page id in ../mp/oid/123.9 url?
 
 
  On Thu, Apr 12, 2012 at 9:58 AM, Igor Vaynbergigor.vaynb...@gmail.com
 
   wrote:
 
  On Thu, Apr 12, 2012 at 8:55 AM, Martin Grigorovmgrigo...@apache.org
 
   wrote:
 
  On Thu, Apr 12, 2012 at 6:43 PM, Igor Vaynberg
 igor.vaynb...@gmail.com
   wrote:
 
  On Thu, Apr 12, 2012 at 8:22 AM, Alec Swanalecs...@gmail.com
  wrote:
 
  Igor,
 
  The link I click ends with /mp/oid/123.9, where 123 is a product
 id.
  However, when the page is rendered its URL changes to end with
  /mp/oid/123.x where x is different every time. Moreover, the page
 is
  displaying the wrong product 379!
 
  So, it's not the wrong version of the page, but the wrong product
 that
  worries me.
 
  Can you explain this?
 
  i never once said the word version in my response :) i was, in
 fact,
  talking about page ids. i dont think the old hybrid url coding
  strategy checks the page id in its url against the mount. so in your
  session page 9 can be something entirely different. i believe this
 is
  what was fixed by WICKET-4488.
 
  Not exactly.
  4488 fixes the problem when user1 has opened page1?0. Then user2
 sends
  a url page2?0 to user1.
  user1 opens this url but because of the existence of a page with
  pageId 0 in the page store user sees page1, not page2 as user2
  intended.
 
  After 4488 Wicket will load page with id == 0 then it will check its
  class against the class of the mountPoint and ignore the stored page
  if they don't match. And will create a completely new instance of
  mountPoint and show it to user1. I.e. a new instance of page2
 
  I hope I described it clearly.
 
  i think thats *exactly* what i said...
 
 
  -igor
 
 
  Thanks,
 
  Alec
 
  On Wed, Apr 11, 2012 at 4:08 PM, Bertrand Guay-Paquet
  ber...@step.polymtl.ca  wrote:
 
  Hi,
 
  A ticket regarding this was created and resolved in 1.5
  (WICKET-4488). From
  the work log:
  There was code for this situation but it didn't cover the case
 100%.
  Now if a request to page2?0 is made and the type of the found page
  with id=0
  is not Page2 then a new instance of Page2 is instantiated.
 
 
 
 
  On 11/04/2012 5:56 PM, Igor Vaynberg wrote:
 
  page 5 in your session can be completely different then page 5 in
  user's session.
 
  non-bookmarkable urls cannot be emailed...thats kind of the
 point.
 
  -igor
 
  On Wed, Apr 11, 2012 at 2:37 PM, Alec Swanalecs...@gmail.com
   wrote:
 
  Hello,
 
  I received a link from a customer to a versioned page (.version
 at
  the
  end of the URL). However, when I click on the link I see a
  completely
  different page.
 
  We are using Wicket 1.4.17 and the page is mounted  as:
 
  mount(new HybridUrlCodingStrategy(mp, MyPage.class));
 
  Why is this happening and how can I fix this?
 
  Thanks,
 
  Alec
 
 
 
 -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 

Re: How to enable SSI in wicket framework.

2012-04-11 Thread Dan Retzlaff
SSI is implemented with its own servlet which is totally separate from
Wicket's filter, so you cannot use both Wicket and SSI for a single page.
However, Wicket provides a variety of ways to include content into pages it
renders: panels, fragments, labels, and more. Once you're familiar with
these mechanisms, you'll find that they're considerably more powerful than
SSI. A good place for examples is
http://www.wicket-library.com/wicket-examples/compref/.

Hope this helps,
Dan

On Wed, Apr 11, 2012 at 8:12 AM, vaibhav228 vaibhav...@gmail.com wrote:

 Hi All,
   I have configured the SSI in apache Tomcat 7.0 by un-commenting the
 tags in web.xml for ssi and adding  privileged=true in the context.xml.
   I am using the wicket framework and the project is running at the
 root level.But unfortunately the framework is not processing the include
 tag
 and it outputs in the HTML as it is.

   Is there anything that I can do to enable the Server Side Include tag
 ion wicket framework. or It will not process that tag.

   If I deploy the project which doesn't uses wicket framework, then SSI
 works properly. It renders the page completely. But when I use project with
 wicket framework, then include tag is not getting rendered.

 Please help me.

 Thanks
 Vaibhav228

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-enable-SSI-in-wicket-framework-tp4548962p4548962.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: rawInput, page reload and error messages

2012-04-11 Thread Dan Retzlaff
You might want to subclass Form to retain additional state. It could save
the validation errors and put them back onto components in onBeforeRender,
clearing them when validation is eventually successful. This could probably
also be accomplished with a Behavior.

On Wed, Apr 11, 2012 at 7:19 AM, Thomas Götz t...@decoded.de wrote:

 Hi!

 I have the following situation (Wicket 1.5.5):

 - a Form with a TextFieldString with some Validator
 - you input invalid data and submit - error message, fine.
 - (invalid) rawInput is shown in the TextField, fine.
 - now I do a page reload, invalid rawInput still in the TextField, but no
 error message shown

 What I'd like to achieve is that upon a page reload the (invalid) rawInput
 is shown in the TextField, but the error message also needs to be shown
 again. How can this be done?

 I already tried to trigger validation manually by calling
 formComponent.validate(), but this calls
 AbstractTextComponent.convertInput(), which tries to pull the input data
 from the request (and there is no data because of page reload, so
 validation won't fail …).

 Cheers,
   -Tom


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




Re: Javascript call on AjaxFallbackDefaultDataTable

2012-04-11 Thread Dan Retzlaff
Yes. You're returning your decorator in an AjaxLink#getAjaxCallDecorator()
override? I think you'll need to pastebin some code for us to help.

On Tue, Apr 10, 2012 at 11:27 PM, cellis christopher.el...@uwa.edu.auwrote:

 I've tried to implement the ajaxCallDecorator as you specified, but I fail
 to
 see the javascript being appended/prepended. ie only the var wcall
 =wicketAjaxGet... is ever decorated. Has anyone else attempted this
 successfully?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Javascript-call-on-AjaxFallbackDefaultDataTable-tp1850777p4548007.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




  1   2   3   >