How to load-balance on AWS with standalone Tomcats

2015-03-09 Thread Daniel Del Castillo
Hi list,

One of the modules of our application is completely written in Wicket 1.4.17. 
This application runs on a single standalone Tomcat installation.

We now need to move this to AWS servers and ensure the service is 24/7 
available. We are looking to have multiple Tomcat instances (not a cluster) 
which are load-balanced with ELB.

My question is: what do I we need to do in order to achieve this? I now we'll 
have to write a IPageStore in order to serialise the page map into a shared 
database. Any suggestion on how to do this? Will we have to write a 
ISessionStore as well?

I've found a solution for clustering (see link below) which I'm now about to 
test but I've thought that it'd be useful to try get some advice from this list.

http://letsgetdugg.com/2010/02/07/clustering-wicket-for-fun-and-profit/

Many thanks for your help.

Regards,
Daniel
DDC
--
This transmission is confidential and intended solely for the person or 
organization to whom it is addressed. It may contain privileged 
and confidential information. If you are not the intended recipient, you should 
not copy, distribute or take any action in reliance on it.

If you believe you received this transmission in error, please notify the 
sender as soon as possible.

This e-mail has been scanned for known viruses by Mimecast for IMD. 
---


Re: How to load-balance on AWS with standalone Tomcats

2015-03-09 Thread Martin Grigorov
Hi,

I think it would be much simpler if you use Tomcat clustering support.
Wicket 1.4.x is a bit old but as far as I remember the support for it in
Wicket has been introduced with 1.4.1 so it should work fine in 1.4.17.

But if Tomcat clustering in not an option for you for some reason then:
- make sure you use session affinity (aka sticky sessions)
- create your own IPageStore to keep the serialized view of the pages in
shared DB (as you already figured out)
- no need of custom ISessionStore. You need custom one only in case you
want to put your Wicket Session instances in something else than HTTP
Session

I guess you are not interested in upgrading to Wicket 6.x but I'd recommend
you to upgrade at least to 1.4.22. There were some security fixes in the
last few releases from 1.4.x series.


Martin Grigorov
Funemployed! Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Mar 9, 2015 at 6:09 PM, Daniel Del Castillo dani...@optimad.com
wrote:

 Hi list,

 One of the modules of our application is completely written in Wicket
 1.4.17. This application runs on a single standalone Tomcat installation.

 We now need to move this to AWS servers and ensure the service is 24/7
 available. We are looking to have multiple Tomcat instances (not a cluster)
 which are load-balanced with ELB.

 My question is: what do I we need to do in order to achieve this? I now
 we'll have to write a IPageStore in order to serialise the page map into a
 shared database. Any suggestion on how to do this? Will we have to write a
 ISessionStore as well?

 I've found a solution for clustering (see link below) which I'm now about
 to test but I've thought that it'd be useful to try get some advice from
 this list.

 http://letsgetdugg.com/2010/02/07/clustering-wicket-for-fun-and-profit/

 Many thanks for your help.

 Regards,
 Daniel
 DDC

 --
 This transmission is confidential and intended solely for the person or
 organization to whom it is addressed. It may contain privileged
 and confidential information. If you are not the intended recipient, you
 should not copy, distribute or take any action in reliance on it.

 If you believe you received this transmission in error, please notify the
 sender as soon as possible.

 This e-mail has been scanned for known viruses by Mimecast for IMD.

 ---



Re: Will renderHead method be invoked when a component is rendered via wicket events?

2015-03-09 Thread MadasamySankarapandian
On Mon, Mar 9, 2015 at 3:03 PM, Martin Grigorov mgrigo...@apache.org
wrote:

 Hi,

 If a component is rendered then its #renderHead() should be called!

 On Mon, Mar 9, 2015 at 4:08 AM, MadasamySankarapandian 
 madas...@mcruncher.com wrote:

   I am using bootstrap-timepicker.js in a single page application
 .
  Time picker is added in a panel which is then embedded in the page. When
  the entire page is reloaded, the timepicker is working fine. However,
 when
  the respective panel is displayed via Wicket events, the time picker is
 not
  rendered. I am using Component#onEvent(Ievent) method to display the
 panel.
  The javascript resource reference for timepicker is added in renderHead
  method. I would like to know if a panel is reloaded during onEvent call,
  will rendeHead method be invoked or not?
 
 
  Here are few code snippets to help you all understand what I am trying?
 
  public class BasePage
  {
 
  public void renderHead(IHeaderResponse response)
 

 Call super.renderHead(response) too.

 Is this a method in the page or in SelectionPanel ?!

   This method is in BasePage.


  {
response.render(JavaScriHeaderItem.forReference(new
  JavaScriptResourceReference(bootstrap-timepicker.js)));
response.render(JavaScriHeaderItem.forReference(new
  JavaScriptResourceReference(common.js)));
  }
 
  //event is received to display panel
   public void onEvent(IEvent ievent)
   {
  super.onEvent(ievent)
  if(event.getPayLoad() instance of Notification)
  {
  Notification notification = (Notification) event.getPayload();
PageParameters parameters = notification.getPageParameters()
Panel selectedPanel = getSelectedPanel(parameters,
  notification.getPanelClass);
BasePage.this.selectedPanel.replaceWith(selectedPanel);
 

 There is no Ajax here, so the whole page is re-rendered and #renderHead()
 should be called for all visible components.

   Sorry here ajax is involved. In the sample code i forgot to
add.
   selectedPanel.setOutputMarkupId(true);
   notification.getTarget().add(selectedPanel);


}
}
  }
 
 
  --
  Thanks and regards
   Madasamy
 




-- 
Thanks and regards
 Madasamy


Re: Will renderHead method be invoked when a component is rendered via wicket events?

2015-03-09 Thread Martin Grigorov
Hi,

If a component is rendered then its #renderHead() should be called!

On Mon, Mar 9, 2015 at 4:08 AM, MadasamySankarapandian 
madas...@mcruncher.com wrote:

  I am using bootstrap-timepicker.js in a single page application .
 Time picker is added in a panel which is then embedded in the page. When
 the entire page is reloaded, the timepicker is working fine. However, when
 the respective panel is displayed via Wicket events, the time picker is not
 rendered. I am using Component#onEvent(Ievent) method to display the panel.
 The javascript resource reference for timepicker is added in renderHead
 method. I would like to know if a panel is reloaded during onEvent call,
 will rendeHead method be invoked or not?


 Here are few code snippets to help you all understand what I am trying?

 public class BasePage
 {

 public void renderHead(IHeaderResponse response)


Call super.renderHead(response) too.

Is this a method in the page or in SelectionPanel ?!


 {
   response.render(JavaScriHeaderItem.forReference(new
 JavaScriptResourceReference(bootstrap-timepicker.js)));
   response.render(JavaScriHeaderItem.forReference(new
 JavaScriptResourceReference(common.js)));
 }

 //event is received to display panel
  public void onEvent(IEvent ievent)
  {
 super.onEvent(ievent)
 if(event.getPayLoad() instance of Notification)
 {
 Notification notification = (Notification) event.getPayload();
   PageParameters parameters = notification.getPageParameters()
   Panel selectedPanel = getSelectedPanel(parameters,
 notification.getPanelClass);
   BasePage.this.selectedPanel.replaceWith(selectedPanel);


There is no Ajax here, so the whole page is re-rendered and #renderHead()
should be called for all visible components.


   }
   }
 }


 --
 Thanks and regards
  Madasamy



Re: Accordion folding unfolding smoothly

2015-03-09 Thread avchavan
any workaround possible?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Accordion-folding-unfolding-smoothly-tp4669851p4669891.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: adding component Dynamically

2015-03-09 Thread avchavan
I've checked browser console and the onclick call never gets triggered when i
click on the more link. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adding-component-Dynamically-tp4669838p4669892.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: DataTable generics vs. IColumn generics

2015-03-09 Thread Patrick Davids

Hi Sven,
I did already implement it this way... and its working.

But my team members asked (more the client developers point of view), 
why the column-class itself is not a generic of Location, like this.


public class LocationColumn extends PropertyColumnLocation {
...
}

At the current implementation they need to do
cols.add(new LocationColumLocation(...));
instead of just
cols.add(new LocationColum(...));

Thats why I forwarded the question here, because I studied a bit the 
Column-Hierarchie code and also wondered about this strength coupling 
between T of ICellPopulator and T of rowModel and T of DataTable.



I suppose my team members see the PropertyColumn more like the usage of 
a PropertModel.
The generic of a PropertyModel is the type, which is returned by the 
expression.
The generic of a PropertyColumn is the DataTables generic / rowModel 
generic, not what its expression retrieves/returns/displays.


I think thats it...

As more as I think about this issue, maybe this could be a nice feature 
of PropertyColums.
Not to have a too strength coupling of what the column displays in the 
cell and what the data table shows.


kind regards
Patrick

Am 05.03.2015 um 18:43 schrieb Sven Meier:

Hi Patrick,

you can let your column implementation be generic:

  public class LocationColumnT extends PropertyColumnT {

  public LocationColumn(String expressionToLocation){
  super(Model.of(Location), expressionToLocation);
  }

  @Override
  public void populateItem(ItemICellPopulatorT cellItem,
String componentId, IModelT rowModel) {
  cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
  }
  }

What do you need more?

Regards
Sven


Am 05.03.2015 um 15:34 schrieb Patrick Davids:

Hi Sven,
thanx for feedback.

Ok, how to implement the LocationColumn more reusable?
I dont want to be bound to a Datatable of Persons.

I'd like to have a Column which works with a Locations, independently
from which model-object the expression fetches the Location.

Is there any way to do that?

best regards
Patrick

Am 05.03.2015 um 15:19 schrieb Sven Meier:

Hi,

generic T is identical for the DataTable, and it's IColumns: it's the
type of the row models.

A column is responsible to provide a cell component for a row: For
DataTable only the input (e.g. Person) is interesting, the output
(Location) doesn't matter.

Your LocationColumn should extend PropertyColumnPerson:

 public class LocationColumn extends PropertyColumnPerson{

 public LocationColumn(String expressionToLocation){
 super(Model.of(Location), expressionToLocation);
 }

 @Override
 public void populateItem(ItemICellPopulatorPerson cellItem,
String componentId, IModelPerson rowModel) {
 cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
 }
 }

Have fun
Sven

Am 05.03.2015 um 12:26 schrieb Patrick Davids:

Hi all,
whats the meaning of generic T on DataTables vs T of IColumn and T of
ICellPopulator?

As I understand its the type of object shown by the table rows.

Reading the javadoc of AbstractColumn it says T (if I understand
correct), its the type of object shown by the cell itself.

But DataTable and its internal list of columns are bound together.
T of both must be the same...

I tried to implement something like this, and here I get problems.


ListIColumnPerson, Void cols = new ArrayList();
cols.add(new PropertyColumnPerson, Void(Model.of(Name), name));
(compiler error)
cols.add(new LocationColumn(location));
(compiler error)

new DataTablePerson, Void(id, cols, new
ListDataProviderPerson(), 50);


public class LocationColumn extends PropertyColumnLocation{

public LocationColumn(String expressionToLocation){
super(Model.of(Location), expressionToLocation);
}

  @Override
public void populateItem(ItemICellPopulatorLocation cellItem,
String componentId, IModelLocation rowModel) {
cellItem.add(new Label(componentId, new
LocationFormatModel(rowModel, Model.of(Session.get().getLocale();
}
}

Also the Generic of ICellPopulator is bound to T of column.

I always thought it could be possible to implement sub-class columns
to allow special renderings of table-cells.

But how can I achieve this, if also ICellPopulator is bound to T of
the rowModel?

kind regards
Patrick

-
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