Re: Multiple apps on single server
On Saturday 08 May 2010 23:37:59 Ján Raska wrote: > Hello, > > I'm thinking about making small business by selling/renting e-shop and CMS > applications written in Wicket. Now I'm trying to figure out, how many such > applications can be hosted on a single server (let's assume 2x Dual Core > Xeon 2.66 GHz, 4GB RAM). Except wicket, I'll use Spring and Hibernate or > EclipseLink, libs in total shouldn't have more then 20-30MB, an average > application can be assumed to have maximum of 200 active users at one time. > > Is there any way to figure it out? I'm basically trying to minimize a > running cost per application and I love Java and Wicket too much to go back > and do PHP stuff, though I guess it's impossible to beat PHP in terms of > running cost. Can anybody help with this? Java is much better in terms of resources than PHP, at least this my experience. It is not only much faster in my opinion, it has better tools to do profiling. I really did both on a high traffic website (600 accesses per second at peak time) and we solved almost any problem we had with java/tomcat/hibernate/postgresql vs apache/php/postgresql. In my experience, hardware is never an issue, at least not in the beginning. Most bottlenecks i have seen are software related. beginning at the database level with proper indexing and configuring the database, configuring the connection pool, using a cache, profiling your app will offer valuable insights. And not to be forgotten: take a look at the client with Yslow Firefox plugin. A great tool. And take thread dumps of you virtual machine at peak time to see what is really happening. So don't guess, measure! kind regards Janning > Thanks > > Jan > - > 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
DropDownBox should render as a label if only one choice is available
Hi, I want a DropDownBox which renders as a Label if only one Choice is available. I wrote a LabelDropDownPanel which you can see here http://pastie.org/768613 (is it ok to use pastie here?) My problem is, that the list of choices sometimes depends on another form Component. if i change this form component the choices of my dropdownlist should change too. It works fine with a normal dropdownChoice, beacuse the ChoiceModel and the other FormComponent share a common ModelObject. if i use my LabelDropDownPanel is does not work. The method isVisible() in my LabelDropDownPanel is called BEFORE the new input values from the other FormComponent are pushed into my model. So this method attaches the choices with the old value. I wonder why "isVisible" is called before pushing the values from form submission. I don't know how to solve my problem, but i am quite new to wicket, so please help me. kind regards Janning - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Detecting an external change to the ModelObject of a Form
your "master" knows about your "detail" panel. so why don't you call detail.modelChanged(); and in your DetailPanel: onModelChanged() { form.modelChanged(); // or whatever is needed... form.clearInput(); super.onModelChanged() } Your form is still managed by your detail panel only. kind regards Janning On Tuesday 05 January 2010 11:03:59 Stijn Maller wrote: > Thanks Martin, > > You're right, a Model that calls ModelObjectChangedListener is basically > what I am looking for, but I don't think it exists. I'll write one myself, > but I just wanted to check first to make sure I wasn't reinventing the > wheel or missing something obvious. > > Kind regards, > Stijn > > > 2010/1/4 Martin Makundi > > > Hi! > > > > clearinput is right. don't know if there is a IModel that has change > > listener, but sure you can make your own that detects when the master > > changes. You need to repaint the components anyways > > > (target.addComponents), so why not clear input at the same time? > > > > ** > > Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: looking for example wicket and hibernate
Hi we have been starting with our hibernate/spring/wicket app a few weeks ago and its quite easy. We do it with maven2 like this: i show you some snippets, please ask me if you have any further questions: in your pom.xml: = 1.4.5 ... org.apache.wicket wicket ${wicket.version} org.apache.wicket wicket-extensions ${wicket.version} org.apache.wicket wicket-spring ${wicket.version} org.springframework spring web.xml = http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4"> wicket wicket.wicket org.apache.wicket.protocol.http.WicketFilter applicationClassName org.yourapp.MyApplication wicket.wicket /* you can start the spring context directly in your web.xml, but I wanted to start my SpringApplication manually in my Application class: in your MyApplication.java = public class MyApplication extends WebApplication @Override protected void init ( ) { WebApplicationContext ctx = start_your_spring_context_here addComponentInstantiationListener(new SpringComponentInjector(this, ctx, true)); } @Override public RequestCycle newRequestCycle ( Request request, Response response ) { return new HibernateRequestCycle(this, (WebRequest) request, (WebResponse) response); } our session per RequestCycle Implemenatation: = public class HibernateRequestCycle extends WebRequestCycle { SessionFactory sessionFactory; public HibernateRequestCycle ( JlotApplication application, WebRequest request, Response response ) { super(application, request, response); this.sessionFactory = (SessionFactory) application.getApplicationContext().getBean("sessionFactory"); } @Override protected void onBeginRequest ( ) { if (!TransactionSynchronizationManager.hasResource(sessionFactory)) { Session session = SessionFactoryUtils.getSession(sessionFactory, true); TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session)); } super.onBeginRequest(); } @Override protected void onEndRequest ( ) { SessionHolder sessionHolder = (SessionHolder) TransactionSynchronizationManager.unbindResource(sessionFactory); SessionFactoryUtils.closeSession(sessionHolder.getSession()); super.onEndRequest(); } } wherever you need a Spring bean you can inject it like this: @SpringBean Repository repository; public MyClass() { InjectorHolder.getInjector().inject(this); } if you have a wicket component you do not need this line: InjectorHolder.getInjector().inject(this); then read about detachable Models! Its quite important to understand it if you use hibernate. we use an entityModel like this one: http://wicketinaction.com/2008/09/building-a-smart-entitymodel/ if you like i can send you more source code, but i got it working just by reading "wicket in action", which is am excellent book. our software will be open source soon, so i can send you the complete source code if you like. kind regards Janning On Thursday 24 December 2009 06:42:57 Johan den Boer wrote: > Hi > > I am looking for a real working example on wicket and hibernate. I have > read the books 'Wcket in Action', 'Pro Wicket' and other books but none of > them give a real working example. Can somebody point me to a real working > example or can sent to me. > > The most problem i have with the configuration in web.xml and using the > spring integration. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Domain Object Serialization
thanks to both of you. On Wednesday 16 December 2009 16:20:12 Igor Vaynberg wrote: > only wicket pages get serialized at the end of each request, not the > entire http session. the session is serialized by the servlet > container during session passivation or replication. > > -igor > > On Tue, Dec 15, 2009 at 11:57 PM, Janning Vygen wrote: > > Hi all, > > > > i am using wicket for a few days. It is great! My first question: > > > > I tried some simple authorizations like described in WIA. > > > > this is part of my custom Session: > > > > public class AuthenticatedWebSession extends WebSession > > { > >private Useruser; > >public void setUser ( User user ) > >{ > >bind(); > >this.user = user; > >} > > } > > > > User is a persistableEntity managed by Hibernate. User is NOT > > Serializable. But if i run it, i do not get any SerializableExceptions. > > But the session gets serialized at the end of the requestcycle? So user > > must get serialized too? > > > > Why does it work without an SerializationException? > > > > kind regards > > Janning > > > > > > > > - > > 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 -- http://www.kicktipp.de/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Domain Object Serialization
Hi all, i am using wicket for a few days. It is great! My first question: I tried some simple authorizations like described in WIA. this is part of my custom Session: public class AuthenticatedWebSession extends WebSession { private Useruser; public void setUser ( User user ) { bind(); this.user = user; } } User is a persistableEntity managed by Hibernate. User is NOT Serializable. But if i run it, i do not get any SerializableExceptions. But the session gets serialized at the end of the requestcycle? So user must get serialized too? Why does it work without an SerializationException? kind regards Janning - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Single App, Multiple Domains
On Wednesday 16 December 2009 02:06:28 Matthias Howell wrote: > One of my requirements is to support the same app in a single instance > responding to multiple domain names. > > E.g. www.domain1.com/webapp gets to the app and the app is in English - > English text, English images. www.domain2.com/webapp is on the same > machine but is in French - all the text and images are in French. I am wicket user since last friday, so handle with care: from http://cwiki.apache.org/WICKET/lifecycle-of-a-wicket-application.html "1. Wicket asks the Application class to create a Session for the servlet request. If no session exists for the incoming request, a Session object is created using the application's session factory." So you can just override the Application.newSession method, LIKE this public Session newSession ( Request request, Response response ) { Session session = new YourSession(request); session.setLocale(Locale.ENGLISH); String serverName = ((WebRequest) request).getHttpServletRequest().getServerName(); if (serverName.equals("www.domain2.com")) { session.setLocale(Locale.FRENCH); } return session; } Might be better to put this code into Session Constructor. kind regards Janning - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org