Re: WebSocket Filter to open a Hibernate Session

2015-09-16 Thread Marco Springer
Hi Martin,

That's something I figured out as well, the bypassing of the Filters by 
WebSocket requests.

I did as you said and implemented a custom IRquestCycleListener to 
respond on the onBeginRequest & onEndRequest in case there is a 
WebSocketRequest.
This is working correctly now! Thanks for the pointer.

One other question though, since this seems awfully similar to how OSIV 
works.
If I do not filter on WebSocketRequest and allow the Session opening for 
each incoming request, in theory I should not need to apply the 
"OpenSessionInViewFilter" anymore correct?

But then another thing I noticed...
I set a debug point inside the onBeginRequest & onEndRequest to see 
what's is passing through those functions.
Apparently for a single page request the onBeginRequest & onEndRequest 
are called multiple times while I have no Lazy Loading components on that 
page.
My guess would be that those multiple requests are for the resources that 
needed to be loaded, e.g. images/js/css/whatever.
In that respect, it would absolutely not be wise to use that to open & close 
hibernate sessions ;-)

Upon a WebSocket event, the onBeginRequest & onEndRequest are called 
only once, so that's correct.

Again thanks.

Best Regards,
Marco Springer

On Tuesday 15 September 2015 18:06:51 Martin Grigorov wrote:
> Hi,
> 
> Servlet Filters are not used when sending messages in web socket
> connection. This is how Servlets work at the moment.
> 
> You can use Wicket's IRequestCycleListener's 
onBeginRequest/onEndRequest.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Tue, Sep 15, 2015 at 4:32 PM, Marco Springer <ma...@glitchbox.nl> 
wrote:
> > Hi,
> > 
> > Using normal requests and long-polling ajax timers to update an 
interface
> > works fine with hibernate sessions.
> > Now I'm trying to implement WebSockets to update small parts of a 
web
> > application that come from server side events. I want to get rid of the
> > long
> > polling.
> > 
> > For now I'm only using a @Scheduled annotation to broadcast an 
event to
> > all attached clients. As a simple scenario.
> > 
> > The web application should, in response, update with loading new 
data
> > from a database using Hibernate.
> > 
> > This is where it fails, giving the message:
> > /Caused by: org.hibernate.HibernateException: No Hibernate Session
> > bound to thread, and configuration does not allow creation of non-
> > transactional one here/
> > 
> > I know this fails due to the fact that WebSocket events don't go 
through
> > the normal filters, e.g. OpenSessionInViewFilter that I'm using.
> > 
> > 
> > *My question:*
> > Where can I create a hook where I can start the Hibernate Session 
the
> > same way the OpenSessionInViewFilter does?
> > 
> > If I'm totally off with my thoughts, I'd like to hear that too :)
> > 
> > Used libraries:
> > wicket 6.19.0
> > wicket-sprint 6.19.0
> > wicket-native-websocket-jetty9 6.19.0
> > hibernate 3.6.10-Final
> > springframework 3.2.13-RELEASE
> > (Why the old Hibernate/Spring versions: haven't had time to migrate 
yet,
> > too much to do!)
> > 
> > Thank you very much in advance.
> > 
> > Best regards,
> > Marco Springer


WebSocket Filter to open a Hibernate Session

2015-09-15 Thread Marco Springer
Hi,

Using normal requests and long-polling ajax timers to update an interface 
works fine with hibernate sessions.
Now I'm trying to implement WebSockets to update small parts of a web 
application that come from server side events. I want to get rid of the long 
polling.

For now I'm only using a @Scheduled annotation to broadcast an event to 
all attached clients. As a simple scenario.

The web application should, in response, update with loading new data 
from a database using Hibernate.

This is where it fails, giving the message:
/Caused by: org.hibernate.HibernateException: No Hibernate Session 
bound to thread, and configuration does not allow creation of non-
transactional one here/

I know this fails due to the fact that WebSocket events don't go through 
the normal filters, e.g. OpenSessionInViewFilter that I'm using.


*My question:*
Where can I create a hook where I can start the Hibernate Session the 
same way the OpenSessionInViewFilter does?

If I'm totally off with my thoughts, I'd like to hear that too :)

Used libraries:
wicket 6.19.0
wicket-sprint 6.19.0
wicket-native-websocket-jetty9 6.19.0
hibernate 3.6.10-Final
springframework 3.2.13-RELEASE
(Why the old Hibernate/Spring versions: haven't had time to migrate yet, 
too much to do!)

Thank you very much in advance.

Best regards,
Marco Springer




Re: NPE in AbstractSingleSelectChoice

2014-05-25 Thread Marco Springer
Haven't run the code but my guess is that the idValue returns a null instead 
of  0.
Take a look at AbstractSingleSelectChoice.convertChoiceIdToChoice(String) line 
281. (Wicket 6.15.0)
if(renderer.getIdValue(choice, index).equals(id)
This would trigger a NPE if a null is returned, which would be the case with 
your nullItem.

Cheers,
Marco

On Sunday 25 May 2014 21:06:41 Lucio Crusca wrote:
 I'm pretty sure it's my fault, but I can't spot it. I'm trying to use a
 DropDownChoice with custom renderer and a PropertyModel, without a Form.
 
 I get a NullPointerException in AbstractSingleSelectChoice, here is the
 quickstart:
 
 http://www.sulweb.org/download/sparsi/quickstart.zip
 
 -
 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 resources with nginx as frontend proxy

2014-05-23 Thread Marco Springer
Hi Martin,

Thank you for the suggestions.

I did manage to get the applications working together.
But... I'm not very sure if, what I am doing, is the correct way.

Therefor I created the minimal quickstart that does what I want it to do.
The quickstart is downloadable from:
http://www.glitchbox.nl/nginx_proxy.zip

It has a deployable war, the nginx.conf, the sources and a README that 
describes what kind of requests the application should intercept.

Let me know if you need more information.

Cheers,
Marco


On Tuesday 20 May 2014 10:18:38 Martin Grigorov wrote:
 Hi,
 
 On Mon, May 19, 2014 at 11:03 PM, Marco Springer ma...@glitchbox.nl wrote:
  Hi all,
  
  I'm trying to get something working that should be fairly easy, I think.
  
  I have Nginx sitting in-front of Jetty.
  An incoming URL could be: http://rage.glitchbox.nl/param1
  The proxy should proxy this to: http://localhost:8080/app/param1
  The webapplication is deployed as root application and is the only
  application
 
 You say it is deployed as root app and below we see that WicketFilter
 listens on /*.
 So what is /app in this case ?!
 
  in that Jetty instance (or Tomcat if that would've been used)
  The wicket mount:
  mountPage(/app/${param}, AppPage.class); (the param1 is a dynamic
  value)
  
  The actual generated HTML is fine.
  No images are loaded, no JS, nor any wicket resource.
  I've traced this back as to probably being a resource mapping or nginx
  config
  problem, but I'd love some confirmation on this.
  The generated HTML points to the resources as:
  ../../wicket/resource/etc
  Due to the proxy setting, nginx sets this to:
  /app/wicket/resource/etc...
  Do I need to adjust the nginx configuration to filter on /wicket/ and
  sent
  those requests through directly? Or do I need to do something about how
  wicket
  generates the paths for it's requests? No sure how to continue here.
 
 Requests to /wicket/** should be no different to the other requests.
 But if you want to change the values of these special segments then see
 Application#newMapperContext. This won't help you much IMO.
 
  Also, some pages need authentication before they can be accessed, I'm
  using
  the wicket auth-roles package for this. But when that's being used,
  something
  weird is going on..
  If I request a page that needs authentication it does redirect me to the
  proper login page, that's fine (doesn't load the resources, images/css,
  though).
  Upon succesful login the browser is redirected to
  localhost:8080/app/privilegedpage, instead of
  http://rage.glitchbox.nl/privilegedpage;. Which I find very strange, is
  this
  also something in nginx that's wrong or wicket behavior?
 
 it looks to me like not finished *reverse* proxy config.
 Wicket generates only relative urls and will not generate
 http://someHost/unless you explicitly ask for a full url.
 
  This login requirement is enforced through this code, which is in a
  AuthenticatedWebPage implementation:
  @Override
  protected void onConfigure() {
  
AuthenticatedWebApplication app = (AuthenticatedWebApplication)
  
  Application.get();
  
if(!AuthenticatedWebSession.get().isSignedIn()) {

  app.restartResponseAtSignInPage();

}
  
  }
  
  The SignInPage is the default SignInPage in the authroles package.
  
  I've googled around quite a bit for fellow nginx/wicket users. But to no
  real
  avail of a solution.
  Examples:
  
  http://www.mysticcoders.com/blog/how-to-setup-a-wicket-application-with-ng
  inx-and-jetty/(where I've taken my first attempt from and still seems to
  give the best result)
  I've also taken a look at:
  
  https://cwiki.apache.org/confluence/display/WICKET/Wicket+and+localized+UR
  Ls 
  http://blog.jteam.nl/2010/02/24/wicket-root-mounts/
  This for making http://localhost:8080/app/param1; into
  http://localhost:8080/param1;, for the dynamic root mounts but seemed
  like a
  lot of hassle for something relatively easy, an http proxy in-front of
  jetty.
  
  If anyone can point me into the right direction, that would be great.
  
  The Nginx reverse proxy mapping:
  location / {
  
proxy_pass  http://localhost:8080/app/;
proxy_pass_header   Set-Cookie;
proxy_pass_header   X-Forwarded-For;
proxy_set_headerX-Real-IP $remote_addr;
proxy_pass_header   Host;
  
  }
  
  Wicket web.xml:
  (only thing noteworthy, as Im not sure this correct?)
  filter-mapping
  
filter-nameapplicationname/filter-name
url-pattern/*/url-pattern
 
 I think this should be /app/*
 
  /filter-mapping
  
  I'm using the WicketFilter, not the WicketServlet approach.
  
  If required, I'll whip up some quickstart tomorrow, not enough time for
  that
  now.
 
 If you don't manage to setup it then please create a quickstart together
 with nginx conf.
 
  Thanks in advance.
  
  Cheers,
  Marco Springer
  
  -
  To unsubscribe, e

wicket resources with nginx as frontend proxy

2014-05-19 Thread Marco Springer
Hi all,

I'm trying to get something working that should be fairly easy, I think.

I have Nginx sitting in-front of Jetty.
An incoming URL could be: http://rage.glitchbox.nl/param1
The proxy should proxy this to: http://localhost:8080/app/param1
The webapplication is deployed as root application and is the only application 
in that Jetty instance (or Tomcat if that would've been used)
The wicket mount:
mountPage(/app/${param}, AppPage.class); (the param1 is a dynamic value)

The actual generated HTML is fine.
No images are loaded, no JS, nor any wicket resource.
I've traced this back as to probably being a resource mapping or nginx config 
problem, but I'd love some confirmation on this.
The generated HTML points to the resources as:
../../wicket/resource/etc
Due to the proxy setting, nginx sets this to: 
/app/wicket/resource/etc...
Do I need to adjust the nginx configuration to filter on /wicket/ and sent 
those requests through directly? Or do I need to do something about how wicket 
generates the paths for it's requests? No sure how to continue here.

Also, some pages need authentication before they can be accessed, I'm using 
the wicket auth-roles package for this. But when that's being used, something 
weird is going on..
If I request a page that needs authentication it does redirect me to the 
proper login page, that's fine (doesn't load the resources, images/css, 
though).
Upon succesful login the browser is redirected to 
localhost:8080/app/privilegedpage, instead of 
http://rage.glitchbox.nl/privilegedpage;. Which I find very strange, is this 
also something in nginx that's wrong or wicket behavior?
This login requirement is enforced through this code, which is in a 
AuthenticatedWebPage implementation:
@Override
protected void onConfigure() {
  AuthenticatedWebApplication app = (AuthenticatedWebApplication) 
Application.get();

  if(!AuthenticatedWebSession.get().isSignedIn()) {
app.restartResponseAtSignInPage();
  }
}

The SignInPage is the default SignInPage in the authroles package.

I've googled around quite a bit for fellow nginx/wicket users. But to no real 
avail of a solution.
Examples:
http://www.mysticcoders.com/blog/how-to-setup-a-wicket-application-with-nginx-and-jetty/
 (where I've taken my first attempt from and still seems to give the 
best result)
I've also taken a look at:
https://cwiki.apache.org/confluence/display/WICKET/Wicket+and+localized+URLs

http://blog.jteam.nl/2010/02/24/wicket-root-mounts/
This for making http://localhost:8080/app/param1; into 
http://localhost:8080/param1;, for the dynamic root mounts but seemed like a 
lot of hassle for something relatively easy, an http proxy in-front of jetty.

If anyone can point me into the right direction, that would be great.

The Nginx reverse proxy mapping:
location / {
  proxy_pass  http://localhost:8080/app/;
  proxy_pass_header   Set-Cookie;
  proxy_pass_header   X-Forwarded-For;
  proxy_set_headerX-Real-IP $remote_addr;
  proxy_pass_header   Host;
}

Wicket web.xml:
(only thing noteworthy, as Im not sure this correct?)
filter-mapping
  filter-nameapplicationname/filter-name
  url-pattern/*/url-pattern
/filter-mapping

I'm using the WicketFilter, not the WicketServlet approach.

If required, I'll whip up some quickstart tomorrow, not enough time for that 
now.

Thanks in advance.

Cheers,
Marco Springer

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



Re: problem with message order delivered to wicket users list

2014-05-14 Thread Marco Springer

Aye, experiencing the same problem.

On 2014-05-14 06:21, Ernesto Reinaldo Barreiro wrote:

Hi,

I the last couple of days I have been experiencing problems with the 
order
of messages delivered to wicket users list: sometimes I receive an 
answer

and then a few minutes after the original message. Is someone else
experiencing this behavior?


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



Re: Detecting when nothing is added to AjaxRequestTarget

2014-01-05 Thread Marco Springer
Hi Josh,

We also had that ComponentNotFoundException problem so now and
then.

My experience might be a different than yours but I'll mention it anyway,
you never know!.

From my experience with our clients, when the client has to wait a bit
longer, he/she re-clicks the same ajax link, where that ajax link will repaint
a panel when it's done processing whatever it has to do, causing the
button/link to disappear or entire panel disappear completely. The second
incoming request is then invalid for the current state of the page.

What I've done is override the updateAjaxAttributes function in the
AjaxLink/AjaxFallbackLink by the following:
/@Override/
/protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {/
/  super.updateAjaxAttributes(attributes);/
/  attributes.setChannel(new AjaxChannel(blocking,
AjaxChannel.Type.ACTIVE));/
/}/

This makes sure that even though multiple AJAX requests are received,
only the first request is being processed, any following request is dropped.

Since I've applied this, I've seen no more ComponentNotFoundException.
Atleast not due to double-clicks/impatient clicks.

Rest of the wicketeers: is this bad practice? It's working very well for me
atm.

Cheers,
Marco


On Saturday, January 04, 2014 07:15:26 PM jchappelle wrote:
 We get a lot of ComponentNotFoundExceptions in production and I have
not
 been able to reproduce them. I've had discussions on here before about
this
 and I think what is happening is that the user clicks something to
change
 the state of the page, say it removes a button. If we don't add the panel
 to the AjaxRequestTarget then the button will still be there on the
browser
 for the user to click. When they click that button wicket throws this
 exception because the server side does not find that button in the
 component hierarchy(or it isn't visible or whatever).

 So my question is how can I detect when an Ajax request happens and
nothing
 gets added to the AjaxRequestTarget and log it out? Or is there a better
way
 to run this down? I'm open to any ideas or strategies for fixing this
 issue.

 Thanks,

 Josh

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Detecting-when-nothing-is-added- 
 to-AjaxRequestTarget-tp4663469.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


smime.p7s
Description: S/MIME cryptographic signature


Re: Detecting when nothing is added to AjaxRequestTarget

2014-01-05 Thread Marco Springer
That's great!

For tabbed panels that take a while to load I just apply lazy loading panels, 
that way that tab gets loaded immediately and an indicator is shown that the 
panel is being loaded.
The user knows that the panel is being loaded and is unable to click any links 
on the old panel.

I handle it like how it's described here:
http://www.mkyong.com/wicket/how-do-use-ajaxlazyloadpanel-in-wicket/

This also handles the scenario where non-JS enabled browser must be able to 
load the page (it's 2014 already, c'mon!).

Cheers

On Sunday, January 05, 2014 11:07:33 AM jchappelle wrote:
 I have found the issue and I can finally reproduce it!
 
 The issue is similar to what you described. We have a dashboard panel that
 has several tabs. Those tabs are ajax tabs. If a user clicks a tab and it
 takes a while to load then they click on a link on the current tab while
 waiting then you will get a ComponentNotFoundException. I tried to use the
 updateAjaxAttributes approach by making custom tab links, but that didn't
 work. Probably because the link they are clicking on the tab panel itself
 does not have that attribute.
 
 My simple solution to this is to just use a regular TabbedPanel instead of
 AjaxTabbedPanel. It seems to fix the issue.
 
 Thanks a bunch for your input because it pointed me in the right direction!
 
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Detecting-when-nothing-is-added- 
 to-AjaxRequestTarget-tp4663469p4663477.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

smime.p7s
Description: S/MIME cryptographic signature


Re: Detecting when nothing is added to AjaxRequestTarget

2014-01-05 Thread Marco Springer
That's what I use as well, depending on the scenario.

Usually when there's a second modal window open, and closing that second modal 
requiring the first modal window to do a repaint on it's current content, I 
display a blocking layer, if the process takes longer than average (e.g. ~8 
seconds).

On Sunday, January 05, 2014 10:50:27 PM Ernesto Reinaldo Barreiro wrote:
 Another way to achieve this is using a blocking layer...
 
 On Sun, Jan 5, 2014 at 6:05 PM, jchappelle jchappe...@4redi.com wrote:
  Thanks for the replies.
  
  Marco there is a good possibility that is what we are facing too. I have
  just been guessing at the causes at this point and haven't considered the
  double click.
  
  I wonder if there is there a more global way to set that for all Ajax
  links
  instead of creating a custom AjaxLink component. I would have to touch a
  lot
  of code otherwise.
  
  --
  View this message in context:
  http://apache-wicket.1842946.n4.nabble.com/Detecting-when-nothing-is-added
  -to-AjaxRequestTarget-tp4663469p4663475.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

smime.p7s
Description: S/MIME cryptographic signature


Re: Render email with Javascript

2013-07-30 Thread Marco Springer
I've used jasper reports for functionality like that.
http://community.jaspersoft.com/

All it really requires is a jrxml file that can be turned into a jasper file.
This in turn can be fed with data to produce charts or whatever.
This jrxml can be designed with iReport, which is also freely downloadable.

There is even a wicketstuff-jasper project to make things even easier to 
intergrate things.

Cheers,
Marco

On Tuesday, July 30, 2013 01:51:55 AM kevin94 wrote:
 In fact, my goal is to render the page in String to render it after in a PDF
 file attach to the mail.
 
 
 
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Render-email-with-Javascript-tp4
 660534p4660539.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: Draw inside Apache Wicket

2013-07-29 Thread Marco Springer
Hi,

I've used http://jsplumbtoolkit.com and intergrated that library into my 
wicket application without too much work.
It also allows for partial updates or complete repaints depending on the HTML 
structure that's currently rendered in the browser.

Of course it depends on the requirements but this library is pretty flexible in 
it's usage.
I've created a MS Project/Gantt like interface with Wicket  jsPlumb and it's 
working very well, even with larger data sets.
And it has different render strategies, depending on the browser. Canvas or SVG 
or VML for IE.

Cheers,
Marco

On Monday, July 29, 2013 04:32:42 PM Marco Di Sabatino Di Diodoro wrote:
 Hi all,
 
 I'm implementing a Dashboard with Apache Wicket.
 In the Dashboard I need to display a diagram with blocks and arrows that
 changes over time.
 
 Can you suggest me a graphic library that allows me to draw inside Apache
 Wicket?
 
 Thanks,
 
 BR
 M

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



Re: [wicket 6] Create/Register Spring Bean in wicket ?

2013-05-11 Thread Marco Springer
Maybe this is too simple but:

Did you define this bean in the applicationContext.xml?:
  bean id=myobj class={impl. class}{possible properties}/bean

And usually when I'm dealing with are objects that aren't wicket components, 
like models or the WebApplication object itself, I have to inject them.
In a WebApplication Object:
getComponentInstantiationListeners().add(new SpringComponentInjector(this));

In a model:
Injector.get().inject(this);

Cheers,
Marco

On Saturday 11 May 2013 11:21:38 smallufo wrote:
 I try to do this in init() :
 
 ctx.getAutowireCapableBeanFactory().configureBean(obj, myobj);
 or
 ctx.getAutowireCapableBeanFactory().applyBeanPostProcessorsAfterInitializati
 on(obj, myobj);
 or
 ctx.getAutowireCapableBeanFactory().applyBeanPostProcessorsBeforeInitializat
 ion(obj, myobj);
 
 But in a WebPage with a @SpringBean(name=myobj) private IMyObj myobj;
 I still get NoSuchBeanDefinitionException error ...
 
 
 
 2013/5/11 smallufo small...@gmail.com
 
  Hi
  Is there any code example to create beans and register to spring ?
  I can get ApplicationContext
  by
  WebApplicationContextUtils.getRequiredWebApplicationContext(getServletCon
  text()); but there is no setter or register or createBean methods
  within...
  
  Or use of factory bean ?
  I searched FactoryBean , got the idea behind it . But I still don't know
  how to do it in wicket ?
  
  Thanks.
  
  
  2013/5/11 Igor Vaynberg igor.vaynb...@gmail.com
  
  see spring's FactoryBean, its an indirect way to create beans.
  
  -igor
  
  On Fri, May 10, 2013 at 12:33 PM, smallufo small...@gmail.com wrote:
   Hi , I wonder if it possible to programmatically create / register a
  
  spring
  
   bean in wicket?
   maybe in Application.init() ...
   
   Most documents about spring are making use of existent beans , and
  
  inject
  
   to WebPage or Panel via @SpringBean , and it indeed works well.
   
   But my interface implementations are depend on wicket-component ,
   such as getting absolute URL of a page or a DynamicImageResource
   
   So these beans should be initialized and register to Spring in init()
   (correct me if I am wrong)
   
   Any way to achieve this ?
   
   Thanks.
   
   (I am using wicket 6.7 )
  
  -
  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: 1.4 - 6.0 question

2013-04-12 Thread Marco Springer
Hello Pierre,

You can also just override/extend the onComponentTag function from the 
Component.:

Component {
  @Override
  protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put(attribute, value)
  }
}

As far as I can see, SimpleAttributeModifier doesn't exist anymore, just use 
the AttributeModifier class or sub-class that if you really need to.

Or attach a custom Behavior to the component which can also override the 
onComponentTag function like so: 
public class FeedbackFieldDecorator extends Behavior {
  @Override
  public void onComponentTag(Component component, ComponentTag tag) {
if (!((FormComponent?)component).isValid()) {
  String cl = tag.getAttribute(class);
  if (cl == null) {
tag.put(class, error);
  } else {
tag.put(class, error  + cl);
  }
}
  }
}

Cheers,
Marco

On Thursday 11 April 2013 21:50:28 Pierre Goupil wrote:
 Good evening,
 
 I have a Wicket 1.4 code that I want to migrate to 6.0. It all works fine
 except for this code in a sub-class of SimpleAttributeModifier:
 
   @Override
   public void onComponentTag(final Component component, final ComponentTag
 tag) {
 System.out.println(ononComponentTag called. component=+component+,
 tag=+tag);
 if (isEnabled(component)) {
   System.out.println(changing attribute, value=+value);
   tag.getAttributes().put(attribute, value);
 }
   }
 
 I don't know what this code is supposed to do, so does anyone know with
 what to replace it? AttributeModifier#onComponentTag() is final in 6.0!
 
 Any help is much appreciated.
 
 Regards,
 
 Pierre

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



Re: Set value in a textfield

2013-04-11 Thread Marco Springer
Construct it with a string?

new TextField(markupId, Model.of(string));
or
setModel(Model.of(string));

Without a model, no clue.
Is there a specific reason why don't want to use a model?

Cheers

On Thursday 11 April 2013 04:57:04 grignette wrote:
 Hi !
 
 Maybe it's an easy question with easy solution... But I don't find the
 solution !
 
 Please, can you tell me how to set the value of the texfield without use
 models. Is it possible ?
 
 Thanks for your help.
 
 
 
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Set-value-in-a-textfield-tp46578
 83.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: a book about Wicket 6.x

2013-04-11 Thread Marco Springer
http://code.google.com/p/wicket-guide/

On Thursday 11 April 2013 10:52:20 Yanal Jij wrote:

Hi all,
 
Any suggestions on books to learn Wicket 6.x , I tried the books on the Wicket 
website they are all about Wicket 1.5 (Wicket in Action and Enjoying Web 
development with Wicket).
 
 
Thank you for any help.
 
Yanal Jij
Software Engineer
 
21515 Ridgetop Circle, Suite 290
Sterling, VA 20166
y...@reverbnetworks.com
www.reverbnetworks.com
 
Come visit Reverb Networks at LTE Latin America 2013

 
 *This electronic mail message and any attached files or documents contain 
information intended for the exclusive use of the party or parties to whom it 
is addressed and may contain information that is confidential, proprietary 
and/or privileged.  If you are not an intended recipient, or the person 
responsible for delivering the e-mail to the intended recipient, you are 
hereby notified that you have received this message in error and that any 
viewing, copying, disclosure, distribution, dissemination, forwarding, 
printing or other use of this information is strictly prohibited and may be 
subject to legal restriction or sanction.  Please notify the sender, by 
electronic mail or telephone, of any unintended recipients and destroy all 
copies of this message and the attachments (if any) without making any copies 
thereof.
 



Re: AjaxLink with image

2013-03-27 Thread Marco Springer
The Markup is missing somehow but I'd say the following HTML should do the 
trick:
a wicket:id=delete
  img src=# wicket:id=deleteImg/
/a

Check the log if it isn't complaining that it can't find the delete.png file..

On Tuesday 26 March 2013 16:39:26 grazia wrote:
 The image in the AjaxLink does not display, anyone could help me figure this
 one out ?
 
private static final ResourceReference DELETE = new
 PackageResourceReference(SabcActionsPanel.class, delete.png);
 
 final AjaxLink deleteLink = new AjaxLink(delete) {
 
 private static final long serialVersionUID = 1L;
 
 public void onClick(AjaxRequestTarget target) {
 target.appendJavaScript(alert('Going to delete!'));
 }
 };
 deleteLink.add(new Image(deleteImg, DELETE));
 deleteLink.setOutputMarkupId(true);
 
 add(deleteLink);
 
 in Html, I have tried:
 
 
 or
 
 wicket:link
 
 /wicket:link
 
 
 
 
 
 
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AjaxLink-with-image-tp4657544.ht
 ml 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

Adding a large amount of MarkupContainers into the ListView or RepeatingView

2013-03-26 Thread Marco Springer
Hi,

Lets say I have about ~100.000 of MarkupContainer objects that I want to put 
into a ListView or RepeatingView.
This works fine functional wise... It's rather slow though.

It boils down to:
MarkupContainer:
1309 private Component put(final Component child)
1310{
1311int index = children_indexOf(child);
1312if (index == -1)
1313{
1314children_add(child);
1315return null;
1316}
1317else
1318{
1319return children_set(index, child);
1320}
1321}

and the call to children_indexOf(child) where it loops over all it's 
existing children and compares the id's until a match is found.
With an increasing amount of children this can get rather slow...

I though off overruling some functionality in the MarkupContainer class since 
I'm sure that for this list of items the children will be unique in their id 
and don't need that lookup, and overruling the put or children_indexOf 
function would give me enough power to skip that performance impacting part.
But most functions have private access, leaving me nothing to control the 
adding of child components to a MarkupContainer.

Does anyone else have experience with adding rather large quantities to 
something like the ListView and/or RepeatingView?
Or is there another way of rendering this large amount of containers?

Thanks in advance.

Kind regards,
Marco

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

2013-03-26 Thread Marco Springer
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: Adding a large amount of MarkupContainers into the ListView or RepeatingView

2013-03-26 Thread Marco Springer
Hi Dan,

Tnx for the suggestion.

In the previous mail I mentioned to present a zoomed out version of the Gantt 
which is a logical view considering the display of several years, the detail 
of showing each day in those years is, well, useless.
It was easy to change this, therefor not needing the sublisting and no 
architecture overhaul :).

Again, I agree on keeping a lid on the amount of rendered components. Which I 
managed to do.

On Tuesday 26 March 2013 10:52:53 Dan Retzlaff wrote:
 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/0a321ea04887a3113e183b46ab20c1c5d702
 2de0#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

-
To unsubscribe, e-mail: users-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 Marco Springer
I've looked at Angular a while back and it certainly looks interesting.

However I don't think it's wise to introduce another technology within the 
current company where I'm migrating a rather large CGI-BIN application to a 
Wicket variant and into several modules.
I'm the main JAVA/Wicket guy now, the others are mainly C++ developers with 
some JAVA knowledge and growing in that knowledge as more and more parts are 
converted into Wicket counterparts.
So they already have to get known with:
Hibernate, parts of Spring, Wicket, Maven and HTML, CSS  JS.

Sooo for now.. I'm sticking with Wicket only.
And with the zoomed out version and restricting the date range, ergo reducing 
the amount of components.., that fixes things.

The future will give me plenty of time make things even fancier. Perhaps even 
the use of Angular.

On Tuesday 26 March 2013 19:55:30 Ernesto Reinaldo Barreiro wrote:
 I mean: This same component could be used as context for AJAX
 interactions.
 
 On Tue, Mar 26, 2013 at 7:42 PM, Ernesto Reinaldo Barreiro 
 
 reier...@gmail.com wrote:
  Why don't you try rolling your own component that at sever side just
  serves JSON and you build up rich functionality at client side. This
  same
  context could be used as context for AJAX interactions. Something like
  
  http://www.antiliasoft.com/wicket-angular-demo/
  
  On Tue, Mar 26, 2013 at 5:23 PM, Marco Springer ma...@glitchbox.nlwrote:
  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
  
  --
  Regards - Ernesto Reinaldo Barreiro

-
To unsubscribe, e-mail: users-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 Marco Springer
Actually, the performance problem was in the first row, well actually the 
header that 
was rendering all days in a week/month/year.

Each data row itself has a lot less items.
Each row has items that are absolutely positioned within the relatively 
positioned row.
Each item can span over multiple days/week/months or even years, depending on 
the 
task duration.

Doing this instead of rendering divs for each day saves a lot of calculation on 
the 
server side and a whole lot less html on the client side.
And this creates other nifty possibilities like making the item divs resizable 
and 
draggable in that row with bound ajax calls to those actions.
For showing a grid I've done some background images that match the zoom level, 
since each day is static in width.

I've thought about lazy loading the rows that where outside of the scrollable 
view, 
since I indeed have a scrollable view.
But that's something for the future.

Rendering the 287 years, e.g. 104k~ ish days, did render eventually and the 
server 
and browser didn't choke, but the div with was about 5M px width wide, so that 
was 
nonsense :P

On Wednesday 27 March 2013 05:25:40 Bernard wrote:
 Hi,
 
 AFAIK the solutions for large numbers of cells in GUI frameworks are:
 
 1) Do not render cells that are not in the scrollable view
 2) Create components only per once row or column and provide cell
 renderers. See javax.swing.table.TableCellRenderer
 
 With these approaches there is basically no limit to the amount of
 data that can be displayed on the screen.
 
 The current architecture seems to be here that the entire view is
 rendered on the server irrespective of how much of it is displayed
 in the client. This rules out 1)
 
 Still the current architecture allows to exploit 2) which would solve
 your performance problem if applicable to your use case. But that is
 theory until someone creates TableCellRenderer for Wicket.
 
 Kind Regards,
 
 Bernard
 
 On Tue, 26 Mar 2013 16:07:17 +0100, you wrote:
 Hi,
 
 Lets say I have about ~100.000 of MarkupContainer objects that I want to
 put into a ListView or RepeatingView.
 This works fine functional wise... It's rather slow though.
 
 It boils down to:
 MarkupContainer:
 1309 private Component put(final Component child)
 1310 {
 1311 int index = children_indexOf(child);
 1312 if (index == -1)
 1313 {
 1314 children_add(child);
 1315 return null;
 1316 }
 1317 else
 1318 {
 1319 return children_set(index, child);
 1320 }
 1321 }
 
 and the call to children_indexOf(child) where it loops over all it's
 existing children and compares the id's until a match is found.
 With an increasing amount of children this can get rather slow...
 
 I though off overruling some functionality in the MarkupContainer class
 since I'm sure that for this list of items the children will be unique in
 their id and don't need that lookup, and overruling the put or
 children_indexOf function would give me enough power to skip that
 performance impacting part. But most functions have private access,
 leaving me nothing to control the adding of child components to a
 MarkupContainer.
 
 Does anyone else have experience with adding rather large quantities to
 something like the ListView and/or RepeatingView?
 Or is there another way of rendering this large amount of containers?
 
 Thanks in advance.
 
 Kind regards,
 Marco
 
 -
 To unsubscribe, e-mail: users-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 Marco Springer

On Tuesday 26 March 2013 13:48:05 Igor Vaynberg wrote:
 On Tue, Mar 26, 2013 at 1:31 PM, Marco Springer ma...@glitchbox.nl wrote:
  Actually, the performance problem was in the first row, well actually the
  header that was rendering all days in a week/month/year.
  
  Each data row itself has a lot less items.
  Each row has items that are absolutely positioned within the relatively
  positioned row. Each item can span over multiple days/week/months or even
  years, depending on the task duration.
  
  Doing this instead of rendering divs for each day saves a lot of
  calculation on the server side and a whole lot less html on the client
  side.
  And this creates other nifty possibilities like making the item divs
  resizable and draggable in that row with bound ajax calls to those
  actions.
  For showing a grid I've done some background images that match the zoom
  level, since each day is static in width.
  
  I've thought about lazy loading the rows that where outside of the
  scrollable view, since I indeed have a scrollable view.
  But that's something for the future.
  
  Rendering the 287 years
 
 pretty sure gantt charts didnt exist 287 years ago... :)
who talks about the past! the future baby! 26 Feb 2013 - 26 Feb 2300 :)

 
 -igor
 
  , e.g. 104k~ ish days, did render eventually and the server
  and browser didn't choke, but the div with was about 5M px width wide, so
  that was nonsense :P
  
  On Wednesday 27 March 2013 05:25:40 Bernard wrote:
  Hi,
  
  AFAIK the solutions for large numbers of cells in GUI frameworks are:
  
  1) Do not render cells that are not in the scrollable view
  2) Create components only per once row or column and provide cell
  renderers. See javax.swing.table.TableCellRenderer
  
  With these approaches there is basically no limit to the amount of
  data that can be displayed on the screen.
  
  The current architecture seems to be here that the entire view is
  rendered on the server irrespective of how much of it is displayed
  in the client. This rules out 1)
  
  Still the current architecture allows to exploit 2) which would solve
  your performance problem if applicable to your use case. But that is
  theory until someone creates TableCellRenderer for Wicket.
  
  Kind Regards,
  
  Bernard
  
  On Tue, 26 Mar 2013 16:07:17 +0100, you wrote:
  Hi,
  
  Lets say I have about ~100.000 of MarkupContainer objects that I want to
  put into a ListView or RepeatingView.
  This works fine functional wise... It's rather slow though.
  
  It boils down to:
  MarkupContainer:
  1309 private Component put(final Component child)
  1310 {
  1311 int index = children_indexOf(child);
  1312 if (index == -1)
  1313 {
  1314 children_add(child);
  1315 return null;
  1316 }
  1317 else
  1318 {
  1319 return children_set(index, child);
  1320 }
  1321 }
  
  and the call to children_indexOf(child) where it loops over all it's
  existing children and compares the id's until a match is found.
  With an increasing amount of children this can get rather slow...
  
  I though off overruling some functionality in the MarkupContainer class
  since I'm sure that for this list of items the children will be unique
  in
  their id and don't need that lookup, and overruling the put or
  children_indexOf function would give me enough power to skip that
  performance impacting part. But most functions have private access,
  leaving me nothing to control the adding of child components to a
  MarkupContainer.
  
  Does anyone else have experience with adding rather large quantities to
  something like the ListView and/or RepeatingView?
  Or is there another way of rendering this large amount of containers?
  
  Thanks in advance.
  
  Kind regards,
  Marco
  
  -
  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



WiQuery jquery UI version upgrade

2013-03-22 Thread Marco Springer
Hi,

I'm using the tooltip functionality from jQuery UI that has been introduced 
since version 1.9.

To make that work I've done:
addResourceReplacement(CoreUIJavaScriptResourceReference.get(), 
PxCoreUIJavaScriptResourceReference.get());

Which just includes the 1.10 version of jQuery and nothing seems to be broken 
so-far, with the WiQuery parts that I'm using.

Is there a specific reason why WiQuery is using version 1.8 of the JQuery UI 
instead of the latest stable 1.10 series?

Thanks in advance.

Cheers,
Marco

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



Re: WiQuery jquery UI version upgrade

2013-03-22 Thread Marco Springer
Ah I feared as much.

Thanks for the info (sorry for not looking it up on the issue tracker).

Cheers.

On Friday 22 March 2013 10:28:52 Ernesto Reinaldo Barreiro wrote:
 Hi,
 
 On Fri, Mar 22, 2013 at 10:23 AM, Marco Springer ma...@glitchbox.nl wrote:
  Hi,
  
  I'm using the tooltip functionality from jQuery UI that has been
  introduced
  since version 1.9.
  
  To make that work I've done:
  addResourceReplacement(CoreUIJavaScriptResourceReference.get(),
  PxCoreUIJavaScriptResourceReference.get());
  
  Which just includes the 1.10 version of jQuery and nothing seems to be
  broken
  so-far, with the WiQuery parts that I'm using.
  
  Is there a specific reason why WiQuery is using version 1.8 of the JQuery
  UI
  instead of the latest stable 1.10 series?
 
 https://github.com/WiQuery/wiquery/issues/15
 
 It seems some of the widgets have changed public API so migrating is not
 just a matter of upgrading versions...
 
  Thanks in advance.
  
  Cheers,
  Marco
  
  -
  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



Wicket+Atmosphere behind Apache proxy problems

2013-02-20 Thread Marco Springer
Hi all,

I have the following scenario:
A Jetty instance is running on port 8080 with URL: 
`http://localhost:8080/appl/test`
The deployed Wicket application is using Atmosphere for push events.
I've configured the Apache server as how it was explained on the following URL:
https://github.com/Atmosphere/atmosphere/wiki/How-to-run-Atmosphere-behind-Apache-WebServer

When I access `http://localhost:8080/appl/test` directly without the proxy, 
it's all working fine.
As soon as I try it through the proxy, e.g. `http://localhost/appl/test`, 
weird stuff starts happening.

Mostly I see that the function, that's annotated with the @Subscribe 
annotation, gets called multiple times, 4 to 12 times isn't uncommon. And it's 
almost always in a power 2.
This doesn't happen without the proxy.
The second browser instance that should receive the push event doesn't respond 
properly either.
I get:
`INFO: Response processed successfully.
INFO: refocus last focused component not needed/allowed`

Does anyone have some more knowledge about configuring Apache's proxy to allow 
for proper websocket/cometd push events through Atmosphere?

A quickstart for the Wicket project: 
http://glitchbox.nl/stack/atmosphere_proxy_problem.zip
My apache config for the proxying:
http://glitchbox.nl/stack/default

Thanks in advance.

Cheers,
Marco

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



Re: Wicket+Atmosphere behind Apache proxy problems

2013-02-20 Thread Marco Springer
Thx for the reply Martin,

Unfortunately I'm stuck with Apache, for the next ~3 years or so, until I've 
rewritten all other applications into a Wicket variant.

Is there an option to somehow force the Atmosphere framework to use the older 
cometd/long-polling methods instead of the WebSocket technology?

On Wednesday 20 February 2013 15:53:14 Martin Grigorov wrote:
 Hi,
 
 Nginx latest release has support for WebSocket. There are many tweets about
 this last few days.
 If switching to Nginx is an option for you - try it.
 
 On Wed, Feb 20, 2013 at 3:44 PM, Marco Springer ma...@glitchbox.nl wrote:
  Hi all,
  
  I have the following scenario:
  A Jetty instance is running on port 8080 with URL:
  `http://localhost:8080/appl/test`
  The deployed Wicket application is using Atmosphere for push events.
  I've configured the Apache server as how it was explained on the following
  URL:
  
  https://github.com/Atmosphere/atmosphere/wiki/How-to-run-Atmosphere-behind
  -Apache-WebServer
  
  When I access `http://localhost:8080/appl/test` directly without the
  proxy,
  it's all working fine.
  As soon as I try it through the proxy, e.g. `http://localhost/appl/test`,
  weird stuff starts happening.
  
  Mostly I see that the function, that's annotated with the @Subscribe
  annotation, gets called multiple times, 4 to 12 times isn't uncommon. And
  it's
  almost always in a power 2.
  This doesn't happen without the proxy.
  The second browser instance that should receive the push event doesn't
  respond
  properly either.
  I get:
  `INFO: Response processed successfully.
  INFO: refocus last focused component not needed/allowed`
  
  Does anyone have some more knowledge about configuring Apache's proxy to
  allow
  for proper websocket/cometd push events through Atmosphere?
  
  A quickstart for the Wicket project:
  http://glitchbox.nl/stack/atmosphere_proxy_problem.zip
  My apache config for the proxying:
  http://glitchbox.nl/stack/default
  
  Thanks in advance.
  
  Cheers,
  Marco
  
  -
  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+Atmosphere behind Apache proxy problems

2013-02-20 Thread Marco Springer
I tinkered around and I did the following:

init-param
  param-nameorg.atmosphere.useWebSocket/param-name
  param-valuefalse/param-value
/init-param

This forces the Atmosphere Framework to use the Jetty7CometSupport class 
instead of the Jetty8WebSocket class.

Initially this looked.. fine.
Except the rendered URL as a result of the push is invalid.
Instead of it going to `/appl/test/`, it refers to `/test/`.

Class `UrlRenderer` from the `org.apache.wicket.request` at line 258 prepends 
a .. segment to the finally rendered url. Which hints me that it tries to go 
one folder up the path... which seems wrong.
The cause of this seems to be that there are 2 baseUrlSegments: appl  
test. Causing this .. to be added. I don't know why this is as it is, the 
Wicket developers must have some reason for this.

All normal url's on the page render fine, except for the one(s) rendered after 
a push event through Jett7CometSupport.
When Jett8WebSocket is used, the ./ is prepended to the URL, which is fine!

So is this a bug in Wicket/Atmosphere or am I doing something wrong?

Again, the quickstart is at 
http://www.glitchbox.nl/stack/atmosphere_proxy_problem.zip
With the exception of the change in the web.xml as stated at the start of this 
mail.


On Wednesday 20 February 2013 15:53:14 Martin Grigorov wrote:
 Hi,
 
 Nginx latest release has support for WebSocket. There are many tweets about
 this last few days.
 If switching to Nginx is an option for you - try it.
 
 On Wed, Feb 20, 2013 at 3:44 PM, Marco Springer ma...@glitchbox.nl wrote:
  Hi all,
  
  I have the following scenario:
  A Jetty instance is running on port 8080 with URL:
  `http://localhost:8080/appl/test`
  The deployed Wicket application is using Atmosphere for push events.
  I've configured the Apache server as how it was explained on the following
  URL:
  
  https://github.com/Atmosphere/atmosphere/wiki/How-to-run-Atmosphere-behind
  -Apache-WebServer
  
  When I access `http://localhost:8080/appl/test` directly without the
  proxy,
  it's all working fine.
  As soon as I try it through the proxy, e.g. `http://localhost/appl/test`,
  weird stuff starts happening.
  
  Mostly I see that the function, that's annotated with the @Subscribe
  annotation, gets called multiple times, 4 to 12 times isn't uncommon. And
  it's
  almost always in a power 2.
  This doesn't happen without the proxy.
  The second browser instance that should receive the push event doesn't
  respond
  properly either.
  I get:
  `INFO: Response processed successfully.
  INFO: refocus last focused component not needed/allowed`
  
  Does anyone have some more knowledge about configuring Apache's proxy to
  allow
  for proper websocket/cometd push events through Atmosphere?
  
  A quickstart for the Wicket project:
  http://glitchbox.nl/stack/atmosphere_proxy_problem.zip
  My apache config for the proxying:
  http://glitchbox.nl/stack/default
  
  Thanks in advance.
  
  Cheers,
  Marco
  
  -
  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: Error during start of wicket application

2012-02-29 Thread Marco Springer
I'm using Intellij myself and with that, in the Project overview I see a
list of dependencies projects are using. With that I can quickly see if I'm
using multiple versions of a certain dependency.

This same type of dependency list is present in Netbeans, only per project.
And with Netbeans you can also generate a dependency graph by right
clicking on your project, and this goes through all dependent projects and
their deps as well.

I have no deep experience with Eclipse, since I somehow dislike Eclipse
with JAVA development, but I think it's available in there somewhere as
well.

I use those dependencies lists as well to find and clean up dependencies.

Cheers,
Marco Springer


Re: WiQuery disabling tabs

2012-01-17 Thread Marco Springer
If anyone cares, I found a solution...

I'm guessing the previous solution isn't working because the statement is
probably output before the page is actually rendered.
Therefore i did the following:

tabs.add(new AbstractBehavior() {
  @Override
  public void renderHead(IHeaderResponse response) {
super.renderHead(response);
StringBuilder js = new StringBuilder();
if (isNewObject) {
  for (int i = 1; i  6; i++) {
js.append(tabs.disable(i).getStatement()).append(;);
  }
}
response.renderOnDomReadyJavascript(js.toString());
  }
});

If anyone thinks this is faulty or has a better solution, I'd like to know!

Kind regards,
Marco

On 16 January 2012 17:20, Marco Springer marcosprin...@gmail.com wrote:

 Hi all,

 *The problem: *
 tabs not disabled on first render.

 *The source:*
 I'm adding the Tabs class from WiQuery 1.2.4 like so:

 tabs = new Tabs(tabs);
 tabs.setOutputMarkupId(true);

 CompoundPropertyModelWafer waferModel = new
 CompoundPropertyModelWafer(getDefaultModel());
 tabs.add(new GeneralInfoPanel(general_info, waferModel));
 tabs.add(new MaterialSpecificationPanel(material_spec, waferModel));
 tabs.add(new LazyTabPanel(layers, waferModel, LayersFragment.class));
 tabs.add(new LazyTabPanel(batches, waferModel, BatchFragment.class));
 tabs.add(new LazyTabPanel(logbook, waferModel, LogbookFragment.class));
 tabs.add(new DocumentsPanel(documents, waferModel));

 *// isNewObject set to true when the Wafer object contained in the
 waferModel is a new Wafer.
 // When a new Wafer is show in this panel, disable the rest of the tabs
 for now:*
 if (isNewObject) {
  for (int i = 1; i  6; i++)
  tabs.disable(i);
 }

 add(tabs);


 *The question:*
 I thought this would be a proper way to disable those tabs, apparently it
 isn't.
 If I call the disable function through ajax afterwards, like
 disable(target, 1), it's fine.

 Anyone an idea how you would disable a single (or multiple) tabs on the
 first initial render?

 Kind regards,
 Marco


Re: WiQuery disabling tabs

2012-01-17 Thread Marco Springer
Ah ofcourse! Tnx.

On 17 January 2012 09:19, Martin Grigorov mgrigo...@apache.org wrote:

 On Tue, Jan 17, 2012 at 9:15 AM, Marco Springer marcosprin...@gmail.com
 wrote:
  If anyone cares, I found a solution...
 
  I'm guessing the previous solution isn't working because the statement is
  probably output before the page is actually rendered.
  Therefore i did the following:
 
  tabs.add(new AbstractBehavior() {
   @Override
   public void renderHead(IHeaderResponse response) {
 super.renderHead(response);
 StringBuilder js = new StringBuilder();
 if (isNewObject) {
   for (int i = 1; i  6; i++) {
 js.append(tabs.disable(i).getStatement()).append(;);
   }
 }
 response.renderOnDomReadyJavascript(js.toString());
 Move this line inside the if. No need to render empty JS.


   }
  });
 
  If anyone thinks this is faulty or has a better solution, I'd like to
 know!
 
  Kind regards,
  Marco
 
  On 16 January 2012 17:20, Marco Springer marcosprin...@gmail.com
 wrote:
 
  Hi all,
 
  *The problem: *
  tabs not disabled on first render.
 
  *The source:*
  I'm adding the Tabs class from WiQuery 1.2.4 like so:
 
  tabs = new Tabs(tabs);
  tabs.setOutputMarkupId(true);
 
  CompoundPropertyModelWafer waferModel = new
  CompoundPropertyModelWafer(getDefaultModel());
  tabs.add(new GeneralInfoPanel(general_info, waferModel));
  tabs.add(new MaterialSpecificationPanel(material_spec, waferModel));
  tabs.add(new LazyTabPanel(layers, waferModel, LayersFragment.class));
  tabs.add(new LazyTabPanel(batches, waferModel, BatchFragment.class));
  tabs.add(new LazyTabPanel(logbook, waferModel,
 LogbookFragment.class));
  tabs.add(new DocumentsPanel(documents, waferModel));
 
  *// isNewObject set to true when the Wafer object contained in the
  waferModel is a new Wafer.
  // When a new Wafer is show in this panel, disable the rest of the tabs
  for now:*
  if (isNewObject) {
   for (int i = 1; i  6; i++)
   tabs.disable(i);
  }
 
  add(tabs);
 
 
  *The question:*
  I thought this would be a proper way to disable those tabs, apparently
 it
  isn't.
  If I call the disable function through ajax afterwards, like
  disable(target, 1), it's fine.
 
  Anyone an idea how you would disable a single (or multiple) tabs on the
  first initial render?
 
  Kind regards,
  Marco



 --
 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: WiQuery disabling tabs

2012-01-17 Thread Marco Springer
Your suggestion:
if (((IModelWafer) getDefaultModel()).getObject().getId() == 0) {
  ArrayItemOptionsIntegerItemOptions options = new
ArrayItemOptionsIntegerItemOptions();
  for (int i = 1; i  6; i++) {
options.add(new IntegerItemOptions(i));
  }

  tabs.setDisabled(options);
}

My code sauce:
if (((IModelWafer) getDefaultModel()).getObject().getId() == 0) {
  tabs.add(new AbstractBehavior() {

@Override
public void renderHead(IHeaderResponse response) {
  super.renderHead(response);
  StringBuilder js = new StringBuilder();

  for (int i = 1; i  6; i++) {
js.append(tabs.disable(i).getStatement()).append(;);
  }

  response.renderOnDomReadyJavascript(js.toString());
}
  });
}

Yup I'm going for your suggestion.

Thanks Hielke.

Regards,
Marco

On 17 January 2012 15:05, Hielke Hoeve hielke.ho...@topicus.nl wrote:

 Yes I (and perhaps we) care. Unfortunately Google has decided that the 
 WiQuery google group should die, leaving us with no mailinglist... 
 Fortunately most of the WiQuery committers are also on this mailinglist.
 Any suggestions you have will be taken into account during our ever lasting 
 upgrade efforts for WiQuery.

 Simply calling tab.disable(i); will not work as this function returns a 
 jQuery statement. If you do not use that nothing changes :S You should use 
 Tabs#setDisabled(ArrayItemOptionsIntegerItemOptions disabled). This will 
 disable all tabs that you specify upon first render. If you want to disable 
 any tab after first render you should use an ajax call and call 
 Tabs#disable(AjaxRequestTarget, int).

 If there is a bug in WiQuery then please report it here: 
 http://code.google.com/p/wiquery/issues/entry

 Hielke Hoeve

 -Original Message-
 From: Marco Springer [mailto:marcosprin...@gmail.com]
 Sent: dinsdag 17 januari 2012 9:16
 To: users@wicket.apache.org
 Subject: Re: WiQuery  disabling tabs

 If anyone cares, I found a solution...

 I'm guessing the previous solution isn't working because the statement is 
 probably output before the page is actually rendered.
 Therefore i did the following:

 tabs.add(new AbstractBehavior() {
  @Override
  public void renderHead(IHeaderResponse response) {
    super.renderHead(response);
    StringBuilder js = new StringBuilder();
    if (isNewObject) {
      for (int i = 1; i  6; i++) {
        js.append(tabs.disable(i).getStatement()).append(;);
      }
    }
    response.renderOnDomReadyJavascript(js.toString());
  }
 });

 If anyone thinks this is faulty or has a better solution, I'd like to know!

 Kind regards,
 Marco

 On 16 January 2012 17:20, Marco Springer marcosprin...@gmail.com wrote:

  Hi all,
 
  *The problem: *
  tabs not disabled on first render.
 
  *The source:*
  I'm adding the Tabs class from WiQuery 1.2.4 like so:
 
  tabs = new Tabs(tabs);
  tabs.setOutputMarkupId(true);
 
  CompoundPropertyModelWafer waferModel = new
  CompoundPropertyModelWafer(getDefaultModel());
  tabs.add(new GeneralInfoPanel(general_info, waferModel));
  tabs.add(new MaterialSpecificationPanel(material_spec, waferModel));
  tabs.add(new LazyTabPanel(layers, waferModel,
  LayersFragment.class)); tabs.add(new LazyTabPanel(batches,
  waferModel, BatchFragment.class)); tabs.add(new
  LazyTabPanel(logbook, waferModel, LogbookFragment.class));
  tabs.add(new DocumentsPanel(documents, waferModel));
 
  *// isNewObject set to true when the Wafer object contained in the
  waferModel is a new Wafer.
  // When a new Wafer is show in this panel, disable the rest of the
  tabs for now:* if (isNewObject) {  for (int i = 1; i  6; i++)
  tabs.disable(i); }
 
  add(tabs);
 
 
  *The question:*
  I thought this would be a proper way to disable those tabs, apparently
  it isn't.
  If I call the disable function through ajax afterwards, like
  disable(target, 1), it's fine.
 
  Anyone an idea how you would disable a single (or multiple) tabs on
  the first initial render?
 
  Kind regards,
  Marco

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



WiQuery disabling tabs

2012-01-16 Thread Marco Springer
Hi all,

*The problem: *
tabs not disabled on first render.

*The source:*
I'm adding the Tabs class from WiQuery 1.2.4 like so:

tabs = new Tabs(tabs);
tabs.setOutputMarkupId(true);

CompoundPropertyModelWafer waferModel = new
CompoundPropertyModelWafer(getDefaultModel());
tabs.add(new GeneralInfoPanel(general_info, waferModel));
tabs.add(new MaterialSpecificationPanel(material_spec, waferModel));
tabs.add(new LazyTabPanel(layers, waferModel, LayersFragment.class));
tabs.add(new LazyTabPanel(batches, waferModel, BatchFragment.class));
tabs.add(new LazyTabPanel(logbook, waferModel, LogbookFragment.class));
tabs.add(new DocumentsPanel(documents, waferModel));

*// isNewObject set to true when the Wafer object contained in the
waferModel is a new Wafer.
// When a new Wafer is show in this panel, disable the rest of the tabs for
now:*
if (isNewObject) {
 for (int i = 1; i  6; i++)
 tabs.disable(i);
}

add(tabs);


*The question:*
I thought this would be a proper way to disable those tabs, apparently it
isn't.
If I call the disable function through ajax afterwards, like
disable(target, 1), it's fine.

Anyone an idea how you would disable a single (or multiple) tabs on the
first initial render?

Kind regards,
Marco


Re: Authentication and sessions - the right way?

2011-10-03 Thread Marco Springer

I sort of use the same thing, storing the user in the Session.

Only I store a LoadableDetachableModel in the Session, representing the  
user.
In my scenario, the LDM is a custom Model and the key identifier is a Long  
number, but that shouldn't be a difference.

And the injection happens in the LDM as well.

This works fine in both development  deployment mode.

And if any data is updated in the database, Hibernate is smart enough to  
detect the changes and serves the latest data from the database. If no  
changes occurred, a cache call is made.



On Mon, 03 Oct 2011 10:19:28 +0200, Zeldor pgronkiew...@gmail.com wrote:

So it's normal that I lose User data when I move from login to main page  
and

I will have to fetch it from db quite often.

When will it happen? I have users browsing around my app, doing most  
often

nothing. Plenty of labels with gets. Will browsing like that trigger
fetching user data from db? Or will that data be served from cache?

Whenever anything changes data will be stored in db and page will reload.
Will it fetch data from db again or serve them from cache?

--
View this message in context:  
http://apache-wicket.1842946.n4.nabble.com/Authentication-and-sessions-the-right-way-tp3866840p3866875.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




--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: Authentication and sessions - the right way?

2011-10-03 Thread Marco Springer

Each browser opens up a new session, that's no actual problem.
Sessions are pretty thread safe (correct me if I'm wrong) when they're  
accessed from request threads (normal Wicket application flow).
If Browser #1 changes something to user data or some other db data, and  
Browser #2 fires a new request, the data is instantly reloaded for that  
Browser #2.
Though a problem would be if both instances submit the same type of data,  
the last request performed is the one that's stored.
Although there are techniques to overcome this problem as well. Something  
like:  
http://docs.jboss.org/hibernate/core/3.5/reference/en/html/transactions.html#transactions-optimistic-manual


Some sample code (don't mind the fake names and I simplified the code to  
just show the necessary):

public class CustomSessionT extends ModelObject extends WebSession {
  private GenericDetachableModelT credentialLDM; // T as the user can be  
of 2 object types in our situation

  public static CustomSession get() {
return (CustomSession) Session.get();
  }

  public void setUser(GenericDetachableModelT credentialLDM) {
this.credentialLDM = credentialLDM;
  }

  public synchronized GenericDetachableModelT getUser() {
return credentialLDM;
  }
}

And in the code where I need the user object I just make a call to:  
CustomSession.get().getUser().getObject();
This will always retrieve the latest user instance in the database and is  
valid during a complete Request.
And just as Martin said, put a memcache in between and the database  
requests are minimized, if not already loaded from the Hibernate cache.


The LDM would be like:
public class GenericDetachableModelT extends ModelObject extends  
LoadableDetachableModelT {


  @SpringBean(name = service)
  private Service service;

  public GenericDetachableModel(T entity) {
this.entityId = entity.getId();

if (entity instanceof HibernateProxy) {
  this.entityClass =
  (Class) ((HibernateProxy)  
entity).getHibernateLazyInitializer().getImplementation().getClass();

} else {
  this.entityClass = (Class) entity.getClass();
}

InjectorHolder.getInjector().inject(this);
  }

  @Override
  protected T load() {
return service.getObject(entityClass, entityId);
  }
}

I do have some more session functionality to mingle with the user object,  
but they are not important in this matter.



On Mon, 03 Oct 2011 10:41:15 +0200, Zeldor pgronkiew...@gmail.com wrote:


Marco:

And it works without problems? There is no issue with user trying to log
from 2 browser on same time, trying to cheat the system? I am just  
wondering

if there is any risk of that.
How does your code look then in session and how do you fetch your data?

Martin:

I was trying to save on costs, where on AppEngine you are billed for  
every

DB query, while memcache is pretty much free. Is it really hard to keep
session data in sync? Only that user can modify his data.

--
View this message in context:  
http://apache-wicket.1842946.n4.nabble.com/Authentication-and-sessions-the-right-way-tp3866840p3866906.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




--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: Apache Wicket Cookbook Published!

2011-04-12 Thread Marco Springer
Just a general question about packthub...

I've ordered the printed version on the 26th of March, from the
Netherlands, but I haven't received it yet.

Did someone else also order the printed version? If so, did you
receive it yet or should I be worried now ;-)

Cheers,

Marco

On 2 April 2011 03:24, shetc sh...@bellsouth.net wrote:
 Yippee! My book has arrived.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Apache-Wicket-Cookbook-Published-tp3406012p3421473.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: Highlight current/clicked AjaxLink

2011-03-28 Thread Marco Springer
Hi Mansour

For reloading different pages I'm using BookmarkablePageLink
(non-ajax), that have the option for setAutoEnable(true)'.
When this option is set for each BookmarkablePageLink and one
BookmarkablePageLink is clicked on the website, the generated HTML for
that link is changed.
For example:
My current page is Home and the other available page link is the Gallery.

spanemHome/em/span
a href=galleryGallery/a

After clicking on the Gallery button:
a href=homeHome/a
spanemGallery/em/span

I think this does the job perfectly, in my case... Perhaps you can
apply it for your case as well.

For a more detailed description:
http://wicketstuff.org/wicket14/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.BookmarkablePageLinkPage

G'luck

Marco.

On 28 March 2011 07:48, Mansour Al Akeel mansour.alak...@gmail.com wrote:
 Josh,
 Yes each link is reloading a different page, and the list of the links
 is not rebuilt. Only the contents part of the page.
 What would your css alternative solution be ? How can I get the clicked
 link disabled and assing it a class, excluding the rest of the links,
 without breaking the ajax functionality for the AjaxLink ?

 On Mon Mar 28,2011 07:51 am, Josh Kamau wrote:
 hi.

 Have you tried something like

  myLink.add(new AttributeAppender(...));

 or

 myLink.add(new AttributeModifier(...))

 this methods can add/modify a css class in a markup element.

 Please check the javadocs for method details if this is what you want.

 However, if i were in your situation, i would use css only to archieve this
 , that is , if each link reloads a different page.


 Josh.

 -
 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