wiquery vs wicket-jquery-ui
Hi wickers I was searching for a wicket + query-ui libraries and I found * wiquery -> https://github.com/WiQuery/wiquery * wicket-jquery-ui -> https://github.com/sebfz1/wicket-jquery-ui Trying to not make controversy, have anyone used any ? Have anyone tested both and chose one ? Why ? I found wiquery more mature and matched with last wicket libraries; but wicket-jquery-ui more active recently. What do you think ? > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket modal
Hi wickers ! I'm using a ModalWindow to show a simple phrase where a form is sent to the server. I used ModalWindow wModal = new ModalWindow("ventanaModal"); wModal.setAutoSize(true); wModal.setResizable(false); But when I show the wModal (with wModal.show(target); ), the inner panel gets a 200px heigth, hardcoded into style. Width is ok. Is this ok ? How can I get a autoheigth ? I tried with fixed size, in order to get a it , I must do: wModal.setInitialHeight(30); wModal.setHeightUnit("px"); wModal.setInitialWidth(200); wModal.setWidthUnit("px"); wModal.setUseInitialHeight(true); wModal.setAutoSize(false); wModal.setAutoSize(false); Isn't this a little complicated ? But I really don't like fixed sizes into HTML... Thanks > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Error with Hidden Field and its enum value
Thanks Andrea !! Yes, I could store the value on the Panel which holds the form - but then I couldn't use it as stateless. Or in WebSession, but it's not adequate... Also. I could use a String and make the conversion hardcoded.. But I searched the converters, and I tried this (maybe a little complicated) and it worked allright ! public class MyWebApplication extends WebApplication { @Override protected IConverterLocator newConverterLocator() { ConverterLocator locator = (ConverterLocator) super.newConverterLocator(); locator.set(MyEnum.class, new MyEnumConverter()); return locator; } } public class MyEnumConverter implements IConverter { @Override public MyEnumconvertToObject(String s, Locale locale) { try { return MyEnum.valueOf(s); } catch (Exception e) { log_error("MyEnum.valueOf(s) " + s, e); return null; } } @Override public String convertToString(MyEnum myEnum, Locale locale) { return myEnum.name(); } } > > > Oscar Besga Arcauz < < < -Andrea Del Bene escribió: - Para: users@wicket.apache.org De: Andrea Del Bene Fecha: 01/03/2013 17:55 Asunto: Re: Error with Hidden Field and its enum value The error occurs because Wicket convert your enum to a string when the form is rendered, then it tries to do the opposite converting the string to your enum. And here we have the problem. Wicket doesn't fin a valid converter (see JAvaDoc of FormComponent.convertInput) to obtain your enum from its string value. But the real question is: do you really need to have such hidden field in your form? Why can't you simply get rid of it? > Hi wickers !! > > I've a problem with a form and a hidden field. > The form has a CompoundPropertyModel of a data class. This class has an enum > propertiy, which I want to store into a HiddenField and later retrieve (with > the whole data class and the rest of the data). > > When the panel is rendered, the hidden field gets the correct value - the > enum name() (or toString()? ) value. > But when I retrieve the form, with the AjaxSubmitLink, I get this error in > the feedback messagges > > DEBUG - FeedbackMessages - Adding feedback message > '[FeedbackMessage message = "The value of 'myType' is not a valid MyType.", > reporter = myType, level = ERROR]' > > > Any ideas ? > > Thanks a lot > > > > > > > Oscar Besga Arcauz < < < > > > EXAMPLE CODE > > > //Enumerated > public enum MyType { myTypeOne, myTypeTwo, andSoOn } > > // Data class > public class MyData implements Serializable { > MyType myType; > } > > //Panel with form > public class MyPanel extends Panel { > > public MyPanel(String id) { > super(id); > MyData data = new MyData(); > data.myType = MyType.myTypeTwo; > Form form = new Form("form",new > CompoundPropertyModel(data)); > form.add(new HiddenField("myType"); //data > AjaxSubmitLink submit = new AjaxSubmitLink("Submit"){ > > @Override > protected void onError(AjaxRequestTarget target, Form form) { > //ALWAYS GETS ME AN ERROR !!! > super.onError(target,form); > } > > @Override > protected void onSubmit(AjaxRequestTarget target, Form form) { > super.onSubmit(target, form); > } > }; > } > > } > > > > > > Oscar Besga Arcauz < < < > - > 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
Error with Hidden Field and its enum value
Hi wickers !! I've a problem with a form and a hidden field. The form has a CompoundPropertyModel of a data class. This class has an enum propertiy, which I want to store into a HiddenField and later retrieve (with the whole data class and the rest of the data). When the panel is rendered, the hidden field gets the correct value - the enum name() (or toString()? ) value. But when I retrieve the form, with the AjaxSubmitLink, I get this error in the feedback messagges DEBUG - FeedbackMessages - Adding feedback message '[FeedbackMessage message = "The value of 'myType' is not a valid MyType.", reporter = myType, level = ERROR]' Any ideas ? Thanks a lot > > > Oscar Besga Arcauz < < < EXAMPLE CODE //Enumerated public enum MyType { myTypeOne, myTypeTwo, andSoOn } // Data class public class MyData implements Serializable { MyType myType; } //Panel with form public class MyPanel extends Panel { public MyPanel(String id) { super(id); MyData data = new MyData(); data.myType = MyType.myTypeTwo; Form form = new Form("form",new CompoundPropertyModel(data)); form.add(new HiddenField("myType"); //data AjaxSubmitLink submit = new AjaxSubmitLink("Submit"){ @Override protected void onError(AjaxRequestTarget target, Form form) { //ALWAYS GETS ME AN ERROR !!! super.onError(target,form); } @Override protected void onSubmit(AjaxRequestTarget target, Form form) { super.onSubmit(target, form); } }; } } > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicket6-ajax-anchorbrowserhistory
Hi wickers ! First, I'd like to thank all the people that have helped me from this forum: Second, I've created a github repo to place a pair of classes that I'm using in my projects. https://github.com/obaisdefe/wicket6-ajax-anchorbrowserhistory This code is based on the work of vmontane, at https://github.com/vmontane/wicket-ajax-bookmarks ( Also, special thanks to vmontane ) There are two classes: - A link that changes the hash of the url, the AnchorAjaxLink (really it has no ajax action) - A behaviour to capture, via ajax, the changes made to the hash of the url, HistoryAjaxBehaviour They are based on jQuery and they are working in my code, so feel free to use them The examples can be found in this repo https://github.com/obaisdefe/wicket6-ajax-anchorbrowserhistory-example Any suggestion or enhacement is wellcome !! Thanks !!! > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Request scoped variables, in ajaxrequesttarget
Yes, this works ok ! > why do you need to fire a custom event? I've four main panels in my app, in order to communicate each other withour listeners >Can't you just use AJAX event triggered by ART? ART ? Maybe ApplicationRuntime Ok, that's what I want to use, the AJAX event, but I want to have shared data in the request within the components Thanks !!! > / EXAMPLE OF DATA / > public class MyEventData { > > static MetaDataKey METAKEY_MYEVENTDATA = new > MetaDataKey(){}; > > String s = ""; > > public MyEventData(){} > > public MyEventData(String s) { > this.s = s; > } > > > > > public void setIntoRequest(RequestCycle rc){ > rc.setMetaData(METAKEY_MYEVENTDATA,this); > } > > public static MyEventData getFromRequest(RequestCycle rc){ > return rc.getMetaData(METAKEY_MYEVENTDATA); > } > > } > > > Oscar Besga Arcauz < < < -Bas Gooren escribió: - Para: users@wicket.apache.org De: Bas Gooren Fecha: 13/02/2013 15:35 Asunto: Re: Request scoped variables, in ajaxrequesttarget Well, it's a lot simpler than that. Simply call rc.setMetaData( METAKEY_MYEVENTDATA, this ); Wicket handles the actual storage details (like storing your data in a MetaDataEntry array etc). Nothing you need to think about :-) Met vriendelijke groet, Kind regards, Bas Gooren Op 13-2-2013 15:31, schreef Oscar Besga Arcauz: > Ok, it's a little complicated to create the metadata > > If I'm rigth, the process is - for example when click on an AjaxLink into the > page > > 1- Execute the method onClick of the AjaxLink > 2- Send an event to all the components of the page (the page itself included, > on first place, but not other pages ?), > - The source of the event is the page itself > - The type of broadcast is BREADTH > - The payload is the AjaxRequestTarget (from the onclick method call) > > / EXAMPLE OF DATA / > public class MyEventData { > > static MetaDataKey METAKEY_MYEVENTDATA = new > MetaDataKey(){}; > > String s = ""; > > public MyEventData(){} > > public MyEventData(String s) { > this.s = s; > } > > > > public MetaDataKey getWicketMetadataData(){ > // A little complicated > MetaDataKey key = new MetaDataKey(){}; > MetaDataEntry metaDataEntry = new > MetaDataEntry(key,this); > MetaDataEntry[] arrayMetaDataEntry = new > MetaDataEntry[]{metaDataEntry}; > key.set(arrayMetaDataEntry,this); > return key; > } > > public void setIntoRequest(RequestCycle rc){ > rc.setMetaData(getWicketMetadataData(),this); > } > > public static MyEventData getFromRequest(RequestCycle rc){ > return rc.getMetaData(METAKEY_MYEVENTDATA); > } > > } > > > > > > Oscar Besga Arcauz < < < > > -Ernesto Reinaldo Barreiro escribió: - > Para: users@wicket.apache.org > De: Ernesto Reinaldo Barreiro > Fecha: 13/02/2013 13:00 > Asunto: Re: Request scoped variables, in ajaxrequesttarget > > Hi Oscar, > > On Wed, Feb 13, 2013 at 12:54 PM, Oscar Besga Arcauz wrote: > >> Hi wickers ! >> >> I was wondering If there's any method to have request-scoped variables ( >> as HttpServletRequest.get/setAttributes ) >> Specially with AjaxRequestTarget, in AJAX calls. >> >> > Maybe RequestCycle#setMetaData might be useful for that. > > > Regards - Ernesto Reinaldo Barreiro > Antilia Soft > http://antiliasoft.com/ <http://antiliasoft.com/antilia> > > - > 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: Request scoped variables, in ajaxrequesttarget
Ok, it's a little complicated to create the metadata If I'm rigth, the process is - for example when click on an AjaxLink into the page 1- Execute the method onClick of the AjaxLink 2- Send an event to all the components of the page (the page itself included, on first place, but not other pages ?), - The source of the event is the page itself - The type of broadcast is BREADTH - The payload is the AjaxRequestTarget (from the onclick method call) / EXAMPLE OF DATA / public class MyEventData { static MetaDataKey METAKEY_MYEVENTDATA = new MetaDataKey(){}; String s = ""; public MyEventData(){} public MyEventData(String s) { this.s = s; } public MetaDataKey getWicketMetadataData(){ // A little complicated MetaDataKey key = new MetaDataKey(){}; MetaDataEntry metaDataEntry = new MetaDataEntry(key,this); MetaDataEntry[] arrayMetaDataEntry = new MetaDataEntry[]{metaDataEntry}; key.set(arrayMetaDataEntry,this); return key; } public void setIntoRequest(RequestCycle rc){ rc.setMetaData(getWicketMetadataData(),this); } public static MyEventData getFromRequest(RequestCycle rc){ return rc.getMetaData(METAKEY_MYEVENTDATA); } } > > > Oscar Besga Arcauz < < < -Ernesto Reinaldo Barreiro escribió: - Para: users@wicket.apache.org De: Ernesto Reinaldo Barreiro Fecha: 13/02/2013 13:00 Asunto: Re: Request scoped variables, in ajaxrequesttarget Hi Oscar, On Wed, Feb 13, 2013 at 12:54 PM, Oscar Besga Arcauz wrote: > Hi wickers ! > > I was wondering If there's any method to have request-scoped variables ( > as HttpServletRequest.get/setAttributes ) > Specially with AjaxRequestTarget, in AJAX calls. > > Maybe RequestCycle#setMetaData might be useful for that. Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com/ <http://antiliasoft.com/antilia> - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Request scoped variables, in ajaxrequesttarget
Hi wickers ! I was wondering If there's any method to have request-scoped variables ( as HttpServletRequest.get/setAttributes ) Specially with AjaxRequestTarget, in AJAX calls. I'm using my own events within ajax calls. I know that an ajax call fires an event into every component of a application; and I'd like to use this event and avoid sending a second custom event. Because of that, I want to attach some data to the request - to the AjaxRequestTarget maybe. For I've read in the forum, the way to do it could be a transient variable into the page which is nullyfied on the onDetach method. But I find it not very elegant Any ideas ? Thanks > > > Oscar Besga Arcauz < < < PS. I'm supposing that a ajax event called over one page of one user (session) is not propaged over other pages and other users (sessions) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Insidious error
Hi Wickers I've deployed my wicket webapp in production, now it's online. Thanks for all your help ! But.. There's an error, that is thrown intermittent, from time to time. It doesn't appear to affect the main behaviour of the website I've trying to reach source and debug and fix it, but it has been impossible to me. If anyone has a hint or knows what is happening, it will be truly appreciated Thanks !! ERROR WebIsdefe:276 - ERROR ! >> Method onRequest of interface org.apache.wicket.behavior.IBehaviorListener targeted at es.isdefe.webisdefe.webapp.panels.inicio.Inicio$InicioJsBehaviour@2b0c59fc on component [Inicio [Component id = contenido]] threw an exception org.apache.wicket.WicketRuntimeException: Method onRequest of interface org.apache.wicket.behavior.IBehaviorListener targeted at es.isdefe.webisdefe.webapp.panels.inicio.Inicio$InicioJsBehaviour@2b0c59fc on component [Inicio [Component id = contenido]] threw an exception at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:274) at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1e275ff3 at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258) ... 26 more 18:12:26,156 ERROR DefaultExceptionMapper:123 - Unexpected error occurred org.apache.wicket.WicketRuntimeException: Method onRequest of interface org.apache.wicket.behavior.IBehaviorListener targeted at es.isdefe.webisdefe.webapp.panels.inicio.Inicio$InicioJsBehaviour@2b0c59fc on component [Inicio [Component id = contenido]] threw an exception at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:274) at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:247) at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:226) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:830) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) [...] Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1e275ff3 at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258) ... 26 more > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Do not cache pages, nor in application, nor in browser
I've made a class, extending the DefaultPageManagerProvider to avoid Wicket page store (in order recreate every page at every request from users) I'm testing it, and found no problems - for now. Take a look; I'm thinking about sending it to JIRA as an improvement /** * User: obesga * Date: 16-jan-2013 * Page manager that does not store any page, nor any bit */ public class VoidPageManagerProvider extends DefaultPageManagerProvider { // Common properties private IPageManagerContext iPageManagerContext; private IPageManager iPageManager; private IDataStore iDataStore; private IPageStore iPageStore; /** * Basic construftor * @param application Actual application */ public VoidPageManagerProvider(Application application) { super(application); iPageManagerContext = new DefaultPageManagerContext(); iDataStore = new VoidIDataStore(); iPageStore = new VoidIPageStore(); iPageManager = new VoidPageStoreManager(application.getName(),iPageStore,iPageManagerContext); } @Override public IPageManager get(IPageManagerContext pageManagerContext) { return iPageManager; } @Override protected IPageStore newPageStore(IDataStore dataStore) { return iPageStore; } @Override protected IDataStore newDataStore() { return iDataStore; } /** * A data store that doesn't store a byte */ private class VoidIDataStore implements IDataStore { public byte[] getData(String s, int i) { return null; } public void removeData(String s, int i) { } public void removeData(String s) { } public void storeData(String s, int i, byte[] bytes) { } public void destroy() { } public boolean isReplicated() { return true; } public boolean canBeAsynchronous() { return true; } } /** * A page store that doesn't store a page */ private class VoidIPageStore implements IPageStore { public void destroy() { } public IManageablePage getPage(String s, int i) { return null; } public void removePage(String s, int i) { } public void storePage(String s, IManageablePage iManageablePage) { } public void unbind(String s) { } public Serializable prepareForSerialization(String s, Object o) { return null; } public Object restoreAfterSerialization(Serializable serializable) { return null; } public IManageablePage convertToPage(Object o) { return null; } } /** * The basic store manager, extended to not support versioning */ private class VoidPageStoreManager extends PageStoreManager implements IPageManager { public VoidPageStoreManager(String applicationName, IPageStore pageStore, IPageManagerContext context) { super(applicationName, pageStore, context); } @Override public boolean supportsVersioning() { return false; } } } > > > Oscar Besga Arcauz < < < -Martin Grigorov escribió: - Para: users@wicket.apache.org De: Martin Grigorov Fecha: 16/01/2013 09:00 Asunto: Re: Do not cache pages, nor in application, nor in browser Hi, On Tue, Jan 15, 2013 at 7:59 PM, Oscar Besga Arcauz wrote: > > > I use these code in order to avoid web page cache, in browser and in > wicket application; > also I want to avoid disk caching and serialization > > I'm using Wicket6 > > > ¿ Do you see this code correct ? ¿ Is there any easier way to accomplish > this ? > > /** > * App > */ > public class MyApplication extends WebApplication { > @Override > public void init() { > super.init(); > setPageManagerProvider(new MyPageManagerProvider(this)); > } > > /** > * shall not save > */ > private class MyPageManagerProvider extends DefaultPageManagerProvider > { > > private MyPageManagerProvider(Application application) { > super(application); > } > > > @Override > protected IDataStore newDataStore() { > // guardamos tod o en memoria > return new HttpSessionDataStore(new > DefaultPageManagerContext(), new PageNumberEvictionStrategy(0)); > You can use getStoreSettings#setMaxSizePerSession(Bytes.bytes(1)) with the default DiskDataStore too. But your approach is better because this way you don't do IO operations. > } > > } > > } > > > > /
Do not cache pages, nor in application, nor in browser
I use these code in order to avoid web page cache, in browser and in wicket application; also I want to avoid disk caching and serialization I'm using Wicket6 ¿ Do you see this code correct ? ¿ Is there any easier way to accomplish this ? /** * App */ public class MyApplication extends WebApplication { @Override public void init() { super.init(); setPageManagerProvider(new MyPageManagerProvider(this)); } /** * shall not save */ private class MyPageManagerProvider extends DefaultPageManagerProvider { private MyPageManagerProvider(Application application) { super(application); } @Override protected IDataStore newDataStore() { // guardamos tod o en memoria return new HttpSessionDataStore(new DefaultPageManagerContext(), new PageNumberEvictionStrategy(0)); } } } /**/ /** * Web Page */ public class MyPage extends WebPage { @Override protected void setHeaders(WebResponse response) { super.setHeaders(response); response.setHeader("X-Frame-Options","deny"); // Avoid IFRFAMES response.setHeader("Cache-Control", "no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0"); response.setHeader("Expires","0"); response.setHeader("Pragma", "no-cache"); response.disableCaching(); } } > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
[FYI] X-Frame-Options deny Header
Hi Wickers In my Wicket app, I had another filter, prior to wicket app, that used to add headers to every request to the webapp. One of this headers was X-Frame-Options with value deny, which prevents pages and elements to be used into an ; its recommended for security reasons (XSS and CSRF ) In some forms, however, it blocked updates and inner-reloads (specially when a file upload was involved); it has been a little knigthmare to find what was going on. So I removed this header, setting it only in wicket pages I hope you find it useful. > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: After/before creation or serialization
Hi Martin Yes, I've tried @SpringBean but I don't like it because I noticed a (not very big) performace loss when using it; because the dynamicly-created serializable proxy. Or at least that seems to me. IMHO, the proxy is an overwhelming solution, I prefer a combination of transients and 'if (dao==null) dao = ( ((MyApplicattion)getApplication()).getDao());' Simply if this can be done in another way. Thanks > > > Oscar Besga Arcauz < < < -Martin Grigorov escribió: - Para: users@wicket.apache.org De: Martin Grigorov Fecha: 25/11/2012 15:57 Asunto: Re: After/before creation or serialization Hi, onInitialize is called just once for any Component. As its javadoc says it is called some time before the first call of #onConfigure. #onDetach() is called before passing the Page to serialization but it can be called at any time and several times per request cycle, so it is not good idea to do your task there too. The solution you are looking for is wicket-ioc module. It is the base for @SpringBean and @Inject support in Wicket. It injects serializable proxy instead of your real DAO/Service/... So it is very cheap for serialization and doesn't require your real dao/service to be Serializable itself. On Sun, Nov 25, 2012 at 2:22 PM, Oscar Besga Arcauz wrote: > Thanks > > Yes, I can use both methos onInitialize + onRead and onDetach + onSave > > Perhaps I should ask if onInitialize and onDetach are used when component > is serialized /deserialized on wicket 6 > > My plan is to do avoid this > > MyPanel(String id){ > super(id) > ((MyApplicattion)getApplication()).getDao().getData(); > } > > and turn into this > > > MyPanel(String id){ > super(id) > } > > private transient Dao dao; > > void onCreateOrRead(){ > dao = ((MyApplicattion)getApplication()).getDao(); > } > > > void onCreateOrRead(){ > dao = null; // Not necessary > } > > > > > > Oscar Besga Arcauz < < < > > -Cedric Gatay escribió: - > Para: users@wicket.apache.org > De: Cedric Gatay > Fecha: 25/11/2012 13:36 > Asunto: Re: After/before creation or serialization > > Hi, > I don't know if there is a special Wicket thing, but you can use the > standard Java way like this : > private void writeObject(ObjectOutputStream out) throws IOException { > //provide your own logic > } > > private void readObject(ObjectInputStream in) throws IOException, > ClassNotFoundException { > //provide your own logic > } > > Regards, > > __ > Cedric Gatay > http://www.bloggure.info | http://cedric.gatay.fr | > @Cedric_Gatay<http://twitter.com/Cedric_Gatay> > > > > On Sun, Nov 25, 2012 at 1:28 PM, Oscar Besga Arcauz >wrote: > > > > > > > Hi wickers ! > > > > Is there a method on Wicket components that is called before > > creation/load(f.e. from disk, deserialization) and another method called > > before destroy/save(to disk, serialization) > > > > Would it be methods onInitialize() and onDetach() of > > org.apache.wicket.Component ? > > > > Thanks ! > > > > > > > > > Oscar Besga Arcauz < < < > > - > > 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 > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/> - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: After/before creation or serialization
Thanks Yes, I can use both methos onInitialize + onRead and onDetach + onSave Perhaps I should ask if onInitialize and onDetach are used when component is serialized /deserialized on wicket 6 My plan is to do avoid this MyPanel(String id){ super(id) ((MyApplicattion)getApplication()).getDao().getData(); } and turn into this MyPanel(String id){ super(id) } private transient Dao dao; void onCreateOrRead(){ dao = ((MyApplicattion)getApplication()).getDao(); } void onCreateOrRead(){ dao = null; // Not necessary } > > > Oscar Besga Arcauz < < < -Cedric Gatay escribió: - Para: users@wicket.apache.org De: Cedric Gatay Fecha: 25/11/2012 13:36 Asunto: Re: After/before creation or serialization Hi, I don't know if there is a special Wicket thing, but you can use the standard Java way like this : private void writeObject(ObjectOutputStream out) throws IOException { //provide your own logic } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { //provide your own logic } Regards, __ Cedric Gatay http://www.bloggure.info | http://cedric.gatay.fr | @Cedric_Gatay<http://twitter.com/Cedric_Gatay> On Sun, Nov 25, 2012 at 1:28 PM, Oscar Besga Arcauz wrote: > > > Hi wickers ! > > Is there a method on Wicket components that is called before > creation/load(f.e. from disk, deserialization) and another method called > before destroy/save(to disk, serialization) > > Would it be methods onInitialize() and onDetach() of > org.apache.wicket.Component ? > > Thanks ! > > > > > > Oscar Besga Arcauz < < < > - > 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
After/before creation or serialization
Hi wickers ! Is there a method on Wicket components that is called before creation/load(f.e. from disk, deserialization) and another method called before destroy/save(to disk, serialization) Would it be methods onInitialize() and onDetach() of org.apache.wicket.Component ? Thanks ! > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Deploy on production: optimization tip & tricks
Thank you ! Some of these improvements are already implemented on my site. I've been looking forward to implement wicket-specific optimizations (althought I'm discovering that wicket alone it's default optimized on deployment mode ) And as you already said, perfomance is an art where no silver bullets are common; but a search for balance and tradeoffs. For example, I've said that using (1) code will . Well, for one side it will dinamically minify the resulting html code downloaded by browser. But these settings will make page processing slower. So it's up to you to choose the rigth approach. (1) getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); getMarkupSettings().setStripWicketTags(true); > > > Oscar Besga Arcauz < < < -"Serban.Balamaci" escribió: - Para: users@wicket.apache.org De: "Serban.Balamaci" Fecha: 15/11/2012 22:45 Asunto: Re: Deploy on production: optimization tip & tricks Hi Oscar, Probably nobody responded because this is not a simple topic but with many implications and turns. There are many optimizations that can be done not necessarily related to wicket. I'd recomend http://stevesouders.com/ blog, http://www.bookofspeed.com/ , http://www.guypo.com/ But ok I'll play along and add my 2 cents: 1. Setting Caching headers on the web response is for certain something that you'd want to do. Set a long expire date for JS and CSS file like months even 1year. But you'd also want the users to receive the latest css and JS files you make with a new release. So it's good to mix up the resource name with some kind of version token(I use the app version nr in the css/js files name something like https://portal.isdefe.es/2.14/css/site.css"; />). Also most important optimizations that give the user the impression of speed are related to loading the JS files. While JS files are being downloaded the PAGE RENDERING is STOPPED. So it's a good idea to put them at the page's bottom and using the css and html to render the page in an usable(nice looking) state and then, while the user is reading and figuring out the content, the JS "enhancements" like sliding menus etc are loading in the "background". Otherwise keeping the JS at the top results in the so called "WhitePageOfDeath" in which the user sees a blank page while the header JS files are being downloaded. You can achieve the same thing as putting the JS at the page bottom but while keeping the JS files at the head with the "defer" attribute easily like . That means the rendering will not be blocked but the JS will execute on DomReady event. 2. Minification and merging JS files into one: A. Most today's browsers are limited to making at most 6 parallel requests to a certain domain. So you don't want to have more js files merged into a single one so you don't wait for another wave of free connections. There is also the RoundTripTime overhead associated with making a new call to the server. B. The the bigger a text file is, the better it's compression ratio will be. So you'd get some benefit from merging all the js files into one and the gzip compression will be greater and also the minification gain. I recommend the *wro4j* project as it has lots of minification plugins. Unfortunately Wicket's component nature where every component can contribute it's own separate JS file makes it harder to have a single big minified JS file for all the page. 3. Using CDNs have the benefit of lower latency and also introducing another domain and thus increasing those 6 max nr of connections. Using some famous CDN like you did for JQuery also increases the probability of user already having Jquery in the cache from another site that he visited before(that's why I'm a fan of not also including the JQuery library in a minified package of all your site's JS files). Using asynchronous loading for 3rd party scripts like g+, facebook, ga are mandatory also these days. 4. Caching before the web server layer - using a caching proxy like Varnish or Apache/Nginx with a caching module to save maybe DB generated image resources maybe can be a good idea also. The topic is far far from being exhausted so I think that's the reason why nobody is playing along with responding. Personally I'm curios if an enhancement of providing "Transfer-Encoding: chunked" and keeping the JS resources in the head with the "defer" attribute(so the browser quickly receives the header and can begin the download of JS files) while a slow DB prevents us from returning the full html. But I'm afraid it might be a mess with not really huge gains in performance and wicket by it's component nature means we don't know the required js resources in the pag
Re: Deploy on production: optimization tip & tricks
(I respond myself, which is not a good policy ) I've been playing with wicket api, and now I'm doing this public final static String GOOGLE_URL = "//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"; @Override public void init() { super.init(); /* ... */ if (getConfigurationType() == RuntimeConfigurationType.DEPLOYMENT){ getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); getMarkupSettings().setStripWicketTags(true); //Use Google CDN getJavaScriptLibrarySettings().setJQueryReference( new UrlResourceReference(Url.parse(GOOGLE_URL));); } } > > > Oscar Besga Arcauz < < < -Oscar Besga Arcauz/ISNOTES@ISNOTES escribió: ----- Para: users@wicket.apache.org De: Oscar Besga Arcauz/ISNOTES@ISNOTES Fecha: 11/11/2012 19:45 Asunto: Deploy on production: optimization tip & tricks Hi wickers ! Thanks to your previous help, I'm about to launch a website based on wikcet. I'm making some final optimizations, some general-web-server related; as seen in http://developer.yahoo.com/performance/rules.html or cookie-free elements http://serverfault.com/questions/234891/how-to-configure-cookieless-virtual-host-in-apache2 . Other are tomcat related, like gzip compression ( http://techxplorer.com/2010/09/17/enabling-gzip-compression-in-tomcat/ and http://viralpatel.net/blogs/enable-gzip-compression-in-tomcat/ ) or general clues ( http://www.mulesoft.com/tomcat-jsp ) For wicket I've found this slideshare http://www.slideshare.net/dashorst/keep-your-wicket-application-in-production and to use this (bellow) because scripts in this way in various components are 'crunched' into one script on page renderization: response.render(OnDomReadyHeaderItem.forScript("foobar")); // Also can use OnLoadHeaderItem Do you havew any other optimization tip & tricks (aplication config, etc.) ? I'm thinking to write a wiki page summarizing responses, a 'Deployment' section ... > > > Oscar Besga Arcauz < < < - 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
Deploy on production: optimization tip & tricks
Hi wickers ! Thanks to your previous help, I'm about to launch a website based on wikcet. I'm making some final optimizations, some general-web-server related; as seen in http://developer.yahoo.com/performance/rules.html or cookie-free elements http://serverfault.com/questions/234891/how-to-configure-cookieless-virtual-host-in-apache2 . Other are tomcat related, like gzip compression ( http://techxplorer.com/2010/09/17/enabling-gzip-compression-in-tomcat/ and http://viralpatel.net/blogs/enable-gzip-compression-in-tomcat/ ) or general clues ( http://www.mulesoft.com/tomcat-jsp ) For wicket I've found this slideshare http://www.slideshare.net/dashorst/keep-your-wicket-application-in-production and to use this (bellow) because scripts in this way in various components are 'crunched' into one script on page renderization: response.render(OnDomReadyHeaderItem.forScript("foobar")); // Also can use OnLoadHeaderItem Do you havew any other optimization tip & tricks (aplication config, etc.) ? I'm thinking to write a wiki page summarizing responses, a 'Deployment' section ... > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket page HTML extractor
I've created a page that responds with the buffer [MyAppPageBuffer] http://pastebin.com/d3UzajiU Reviews and comments are wellcomed ! > > > Oscar Besga Arcauz < < < -Oscar Besga Arcauz/ISNOTES@ISNOTES escribió: - Para: users@wicket.apache.org De: Oscar Besga Arcauz/ISNOTES@ISNOTES Fecha: 08/10/2012 15:06 Asunto: Re: Wicket page HTML extractor Yes, I've used code from mail example, as I said. The mail example does not fit into my needs because the rendering thread must be independent, out-of-request. ( for example into a Timer/TimerTask) I've been looking into Wicket tester classes (http://wicket.apache.org/apidocs/1.5/org/apache/wicket/util/tester/BaseWicketTester.html) and I've made changes to code. Luckily, I've succeed and I got a functional request-independent page renderer, which only dependes on webapp and it's easy to use: MyAppPageBuffer.java http://pastebin.com/XJMV8N7d If you want to see and review it, comments are welcome > > > Oscar Besga Arcauz < < < Pd. with a little side effect, but I'll talk about it on another mail -Martin Grigorov escribió: - Para: users@wicket.apache.org De: Martin Grigorov Fecha: 08/10/2012 10:00 Asunto: Re: Wicket page HTML extractor Hi, Why don't use the source of MailTemplate example (http://www.wicket-library.com/wicket-examples/mailtemplate) ? Your code seems to be much more complex. On Fri, Oct 5, 2012 at 8:02 PM, Oscar Besga Arcauz wrote: > Hi wickers ! > > I want to generate the HTML from a wicket WebPage and store into a String; > out of a request - for example in a timer thread. > I'm thinking in making a buffer (inter request) for my webapplication for > some pages, for this I want to extract HTML-generated content from wicket > pages. > > > > Here in danwalmsley blog -> > http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ <- > and mail template (page-generated) example -> > http://www.wicket-library.com/wicket-examples/mailtemplate/?0 <- > I've seen some code to build the extractor. > > I've walked some steps, and I think I'm on the rigth direction, but it > doesn't work. > > This is the code I've done so far, if anyone knows I'll be graceful for > commenting > > > class WebPageExtractor > > protected String renderPageToString(WebApplication webApp) { > > String urlForMockRequest = "myPage"; // I've also tried > localhost/myPage and others > String filterPrefix = ""; // Doesn't know what to put here, really. > Wicket filter is to * > > //get the servlet context > ServletContext context = webApp.getServletContext(); > > //fake a request/response cycle > MockHttpSession servletSession = new MockHttpSession(context); > servletSession.setTemporary(true); > > MockHttpServletRequest mockServletRequest = new > MockHttpServletRequest(isdefeWebApp, servletSession, context); > mockServletRequest.setURL("/" + urlForMockRequest); > // also tried this > mockServletRequest.setURL(mockServletRequest.getContextPath() + > mockServletRequest.getServletPath() + "/"); > MockHttpServletResponse mockServletResponse = new > MockHttpServletResponse(mockServletRequest); > > //initialize request and response > mockServletRequest.initialize(); > mockServletResponse.initialize(); > > // Generate wicket web request and so on.. > Url url = new Url(Arrays.asList(urlForMockRequest), new > ArrayList()); > > ServletWebRequest webRequest = new > ServletWebRequest(mockServletRequest, filterPrefix, url); > ServletWebResponse webResponse = new ServletWebResponse(webRequest, > mockServletResponse); > BufferedWebResponse bufferedWebResponse = new > BufferedWebResponse(webResponse); > > RequestCycle requestCycle = webApp.createRequestCycle(webRequest, > bufferedWebResponse); > BookmarkablePageRequestHandler bookmarkablePageRequestHandler = new > BookmarkablePageRequestHandler(new PageProvider(MyPage.class, new > PageParameters())); > bookmarkablePageRequestHandler.respond(requestCycle); > // Also tried > //requestCycle.setResponsePage(MyPage.class,new PageParameters()); > requestCycle.processRequestAndDetach(); > requestCycle.getResponse().close(); > CharSequence cs = bufferedWebResponse.getText(); //NULL!!! > if (cs != null) { > return cs.toString(); > } else { > // CS is always null :( > re
Re: Wicket page HTML extractor
Yes, I've used code from mail example, as I said. The mail example does not fit into my needs because the rendering thread must be independent, out-of-request. ( for example into a Timer/TimerTask) I've been looking into Wicket tester classes (http://wicket.apache.org/apidocs/1.5/org/apache/wicket/util/tester/BaseWicketTester.html) and I've made changes to code. Luckily, I've succeed and I got a functional request-independent page renderer, which only dependes on webapp and it's easy to use: MyAppPageBuffer.java http://pastebin.com/XJMV8N7d If you want to see and review it, comments are welcome > > > Oscar Besga Arcauz < < < Pd. with a little side effect, but I'll talk about it on another mail -Martin Grigorov escribió: - Para: users@wicket.apache.org De: Martin Grigorov Fecha: 08/10/2012 10:00 Asunto: Re: Wicket page HTML extractor Hi, Why don't use the source of MailTemplate example (http://www.wicket-library.com/wicket-examples/mailtemplate) ? Your code seems to be much more complex. On Fri, Oct 5, 2012 at 8:02 PM, Oscar Besga Arcauz wrote: > Hi wickers ! > > I want to generate the HTML from a wicket WebPage and store into a String; > out of a request - for example in a timer thread. > I'm thinking in making a buffer (inter request) for my webapplication for > some pages, for this I want to extract HTML-generated content from wicket > pages. > > > > Here in danwalmsley blog -> > http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ <- > and mail template (page-generated) example -> > http://www.wicket-library.com/wicket-examples/mailtemplate/?0 <- > I've seen some code to build the extractor. > > I've walked some steps, and I think I'm on the rigth direction, but it > doesn't work. > > This is the code I've done so far, if anyone knows I'll be graceful for > commenting > > > class WebPageExtractor > > protected String renderPageToString(WebApplication webApp) { > > String urlForMockRequest = "myPage"; // I've also tried > localhost/myPage and others > String filterPrefix = ""; // Doesn't know what to put here, really. > Wicket filter is to * > > //get the servlet context > ServletContext context = webApp.getServletContext(); > > //fake a request/response cycle > MockHttpSession servletSession = new MockHttpSession(context); > servletSession.setTemporary(true); > > MockHttpServletRequest mockServletRequest = new > MockHttpServletRequest(isdefeWebApp, servletSession, context); > mockServletRequest.setURL("/" + urlForMockRequest); > // also tried this > mockServletRequest.setURL(mockServletRequest.getContextPath() + > mockServletRequest.getServletPath() + "/"); > MockHttpServletResponse mockServletResponse = new > MockHttpServletResponse(mockServletRequest); > > //initialize request and response > mockServletRequest.initialize(); > mockServletResponse.initialize(); > > // Generate wicket web request and so on.. > Url url = new Url(Arrays.asList(urlForMockRequest), new > ArrayList()); > > ServletWebRequest webRequest = new > ServletWebRequest(mockServletRequest, filterPrefix, url); > ServletWebResponse webResponse = new ServletWebResponse(webRequest, > mockServletResponse); > BufferedWebResponse bufferedWebResponse = new > BufferedWebResponse(webResponse); > > RequestCycle requestCycle = webApp.createRequestCycle(webRequest, > bufferedWebResponse); > BookmarkablePageRequestHandler bookmarkablePageRequestHandler = new > BookmarkablePageRequestHandler(new PageProvider(MyPage.class, new > PageParameters())); > bookmarkablePageRequestHandler.respond(requestCycle); > // Also tried > //requestCycle.setResponsePage(MyPage.class,new PageParameters()); > requestCycle.processRequestAndDetach(); > requestCycle.getResponse().close(); > CharSequence cs = bufferedWebResponse.getText(); //NULL!!! > if (cs != null) { > return cs.toString(); > } else { > // CS is always null :( > return null; > } > } > > > Thanks for your help and excuse my poor english > > > > > > > Oscar Besga Arcauz < < < > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > --
Wicket page HTML extractor
Hi wickers ! I want to generate the HTML from a wicket WebPage and store into a String; out of a request - for example in a timer thread. I'm thinking in making a buffer (inter request) for my webapplication for some pages, for this I want to extract HTML-generated content from wicket pages. Here in danwalmsley blog -> http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ <- and mail template (page-generated) example -> http://www.wicket-library.com/wicket-examples/mailtemplate/?0 <- I've seen some code to build the extractor. I've walked some steps, and I think I'm on the rigth direction, but it doesn't work. This is the code I've done so far, if anyone knows I'll be graceful for commenting class WebPageExtractor protected String renderPageToString(WebApplication webApp) { String urlForMockRequest = "myPage"; // I've also tried localhost/myPage and others String filterPrefix = ""; // Doesn't know what to put here, really. Wicket filter is to * //get the servlet context ServletContext context = webApp.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest mockServletRequest = new MockHttpServletRequest(isdefeWebApp, servletSession, context); mockServletRequest.setURL("/" + urlForMockRequest); // also tried this mockServletRequest.setURL(mockServletRequest.getContextPath() + mockServletRequest.getServletPath() + "/"); MockHttpServletResponse mockServletResponse = new MockHttpServletResponse(mockServletRequest); //initialize request and response mockServletRequest.initialize(); mockServletResponse.initialize(); // Generate wicket web request and so on.. Url url = new Url(Arrays.asList(urlForMockRequest), new ArrayList()); ServletWebRequest webRequest = new ServletWebRequest(mockServletRequest, filterPrefix, url); ServletWebResponse webResponse = new ServletWebResponse(webRequest, mockServletResponse); BufferedWebResponse bufferedWebResponse = new BufferedWebResponse(webResponse); RequestCycle requestCycle = webApp.createRequestCycle(webRequest, bufferedWebResponse); BookmarkablePageRequestHandler bookmarkablePageRequestHandler = new BookmarkablePageRequestHandler(new PageProvider(MyPage.class, new PageParameters())); bookmarkablePageRequestHandler.respond(requestCycle); // Also tried //requestCycle.setResponsePage(MyPage.class,new PageParameters()); requestCycle.processRequestAndDetach(); requestCycle.getResponse().close(); CharSequence cs = bufferedWebResponse.getText(); //NULL!!! if (cs != null) { return cs.toString(); } else { // CS is always null :( return null; } } Thanks for your help and excuse my poor english > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Re: IFormValidator with ajax
Ok, it works fine Thaks ! > > > Oscar Besga Arcauz < < < -Sven Meier escribió: - Para: users@wicket.apache.org De: Sven Meier Fecha: 05/10/2012 15:01 Asunto: Re: IFormValidator with ajax > May I use the raw inputs instead of models ? You can use the converted input. Sven Oscar Besga Arcauz schrieb: > Hi Wickers ! > >I'm using Wicket.6.0.x and I'm using an IFormValidator as a subclass o a form, >attached to it by an FormValidatorAdapter. >The form uses a AjaxSubmitLink to send data back. > >When it comes to validate method, the model objects of the form and the >components are null; althougth later into the AjaxSubmitLink .onSubmit the >data is correctly attached to the models. > >¿ Is that supposed to be fine ? ¿ May I use the raw inputs instead of models ? > > > > > Oscar Besga Arcauz < < < >- >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
IFormValidator with ajax
Hi Wickers ! I'm using Wicket.6.0.x and I'm using an IFormValidator as a subclass o a form, attached to it by an FormValidatorAdapter. The form uses a AjaxSubmitLink to send data back. When it comes to validate method, the model objects of the form and the components are null; althougth later into the AjaxSubmitLink .onSubmit the data is correctly attached to the models. ¿ Is that supposed to be fine ? ¿ May I use the raw inputs instead of models ? > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket rendering jquery late
Ok, thanks I've done this. althougth the name is horrible public abstract class JavaScriptJQueryDependantResourceReference extends JavaScriptResourceReference { public JavaScriptJQueryDependantResourceReference(Class scope, String name, Locale locale, String style, String variation) { super(scope, name, locale, style, variation); } public JavaScriptJQueryDependantResourceReference(Class scope, String name) { super(scope, name); } @Override public Iterable getDependencies() { List dependencies = new ArrayList(); Iterable iterable = super.getDependencies(); if (iterable != null) for(HeaderItem headerItem : iterable) dependencies.add(headerItem); dependencies.add(JavaScriptReferenceHeaderItem.forReference(JQueryResourceReference.get())); return dependencies; } } > > > Oscar Besga Arcauz < < < -Martin Grigorov escribió: - Para: users@wicket.apache.org De: Martin Grigorov Fecha: 26/09/2012 13:49 Asunto: Re: Wicket rendering jquery late Hi, Wicket 6 introduces dependencies between resources - http://wicketinaction.com/2012/07/wicket-6-resource-management/ So you can modify your JavaScriptResourceReferences to be org.apache.wicket.resource.JQueryPluginResourceReference instead. This way Wicket will be able to calculate the graph. Wicket 6.0.0 comes with JQuery 1.7.2 but you can upgrade it to 1.8 if you wish with org.apache.wicket.settings.IJavaScriptLibrarySettings#setJQueryReference I've tried Wicket's JavaScript unit tests with 1.8.0 when it was released and all was OK. https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax#WicketAjax-HowtocheckwhethermycustomversionofthebackingJavaScriptlibrary%28jQuery%29doesn%27tbreakWicketinternalssomehow%3F On Wed, Sep 26, 2012 at 2:40 PM, Oscar Besga Arcauz wrote: > Hi wickers ! > > I've a problem with wicket and jquery resource rendering. > > My webpage has many panels wich uses jquery, and they have javascript > attached to it. > This panel-dependant javascript uses jquery, so I render jquery with a > resourcerefernce in the webpage. > (The page doesn't use ajax because I want to mantain page stateless and > bookmarkable.) > > The problem is that the javascript attached to panel is rendered first into > the page, and the jquery reference is the last. > so, when the page fully renders, i've some 'ReferenceError: $ is not defined' > errors in webrowser console. > > ¿ Has anyone experienced similar problems ? > > > Other little question: wicket6 uses jquery 1.7.2; has anyone tried with 1.8.x > ? > > Thanks in advance > > > > > > Oscar Besga Arcauz < < < > > > PS. > > Example code (little long) ---> > > public class MyPage extends WebPage { > > > public MyPage (PageParameters parameters) { > super(parameters); > add(new MyPageJsBehaviour()); > add(new MyPanel("mypanel")); > } > > > private class MyPageJsBehaviour extends Behavior { > > @Override > public void renderHead(Component component, IHeaderResponse > response) { > > response.render(JavaScriptHeaderItem.forReference(JQueryResourceReference.get(),"jquery")); > super.renderHead(component,response); > } > } > > } > > > public class MyPanel extends Panel { > > > public MyPanel(String id,String lang) { > super(id); > add(new MyPanelJsBehaviour()); > } > > private class MyPanelJsBehaviour extends Behavior { > > @Override > public void renderHead(Component component, IHeaderResponse > response) { > super.renderHead(component,response); > response.render(JavaScriptHeaderItem.forReference(new > JavaScriptResourceReference(MyPanel .class, "MyPanel.js"),"mypaneljs")); > /** > //MyPanel.js > $(function () { // <-- here arises the error, as $ is not > defined because MyPanel.js is loaded before jquery !!! > $('mypanel').dosomething(); > }); > **/ > } > } > > } > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket rendering jquery late
Hi wickers ! I've a problem with wicket and jquery resource rendering. My webpage has many panels wich uses jquery, and they have javascript attached to it. This panel-dependant javascript uses jquery, so I render jquery with a resourcerefernce in the webpage. (The page doesn't use ajax because I want to mantain page stateless and bookmarkable.) The problem is that the javascript attached to panel is rendered first into the page, and the jquery reference is the last. so, when the page fully renders, i've some 'ReferenceError: $ is not defined' errors in webrowser console. ¿ Has anyone experienced similar problems ? Other little question: wicket6 uses jquery 1.7.2; has anyone tried with 1.8.x ? Thanks in advance > > > Oscar Besga Arcauz < < < PS. Example code (little long) ---> public class MyPage extends WebPage { public MyPage (PageParameters parameters) { super(parameters); add(new MyPageJsBehaviour()); add(new MyPanel("mypanel")); } private class MyPageJsBehaviour extends Behavior { @Override public void renderHead(Component component, IHeaderResponse response) { response.render(JavaScriptHeaderItem.forReference(JQueryResourceReference.get(),"jquery")); super.renderHead(component,response); } } } public class MyPanel extends Panel { public MyPanel(String id,String lang) { super(id); add(new MyPanelJsBehaviour()); } private class MyPanelJsBehaviour extends Behavior { @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component,response); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(MyPanel .class, "MyPanel.js"),"mypaneljs")); /** //MyPanel.js $(function () { // <-- here arises the error, as $ is not defined because MyPanel.js is loaded before jquery !!! $('mypanel').dosomething(); }); **/ } } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Avoid panel's extra div
Perfect !!! Thanks !!! > > > Oscar Besga Arcauz < < < -Sebastien escribió: - Para: users@wicket.apache.org De: Sebastien Fecha: 23/09/2012 16:55 Asunto: Re: Avoid panel's extra div oops: setRenderBodyOnly(true); On Sun, Sep 23, 2012 at 4:53 PM, Sebastien wrote: > Hi Oscar, > > If I understand, the problem is that the div of the parent page is > rendered, right? > If so, you can decide to not render the parent component's tag by using > myPanel.getRenderBodyOnly(true); > > Hope this helps, > Sebastien. > > > On Sun, Sep 23, 2012 at 4:17 PM, Oscar Besga Arcauz wrote: > >> Hi wickers >> >> I am using a lot of panels in my wicket webapp, with the usual >> >> add(new MyPanel("myPanel")); >> >> >> >> But I was thinking if there is a wicket tag that can avoid using the >> extra panel, like >> >> >> >> I've tried with wicket:panel, wicket:container, wicket:enclosure with no >> luck... >> >> I'm wrong or there's a way.. ? >> >> Thanks !! >> >> > > > Oscar Besga Arcauz < < < >> - >> 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
Avoid panel's extra div
Hi wickers I am using a lot of panels in my wicket webapp, with the usual add(new MyPanel("myPanel")); But I was thinking if there is a wicket tag that can avoid using the extra panel, like I've tried with wicket:panel, wicket:container, wicket:enclosure with no luck... I'm wrong or there's a way.. ? Thanks !! > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: New sessions by each petition
Ok, i've used sessionbind and works as expected ! Also, I've checked that session is auto-binded when you use statefull components - my web tries to stay stateless most time, so this was the cause I saw so many 'new session' logs Thanks !! > > > Oscar Besga Arcauz < < < -Martin Grigorov escribió: - Para: users@wicket.apache.org De: Martin Grigorov Fecha: 20/09/2012 13:49 Asunto: Re: New sessions by each petition Hi, This is just a temporary session which is discarded at the end of the request. Until Session#bind() is called it is considered temporary and no HttpSession is being created. On Thu, Sep 20, 2012 at 2:43 PM, Oscar Besga Arcauz wrote: > > Hi wickers !!! > > > I'm battling with my application, and now I've noted something weird > > I've a custom WebSession class, in which I've coded a (horrible) log to check > the creation of the new session: > > public class WebMySession extends WebSession { > > private static final Logger LOGGER = > LoggerFactory.getLogger(WebMySession .class); > > public WebMySession(Request request) { > super(request); > LOGGER.debug("NEW SESSION!"); > } > } > > > Into my webapp class I do > > public class WebMyApplication extends WebApplication { > > [...] > > @Override > public Session newSession(Request request, Response response) { > return new WebMySession(request); > } > > [...] > > } > > > But when I enter the first time into the app, I see this logged: > > > > 12:12:26,133 DEBUG ServletWebRequest:197 - Calculating context relative path > from: context path '', filterPrefix '', uri '/imagees/myxyz.jpg' > 12:12:26,133 DEBUG WebMySession :24 - NEW SESSION! > 12:12:26,133 DEBUG RequestCycle:215 - No suitable handler found for URL > /imagees/myxyz.jpg, falling back to container to process this request > > 12:12:26,143 DEBUG ServletWebRequest:197 - Calculating context relative > path from: context path '', filterPrefix '', uri '/imagees/myxyz2.jpg' > 12:12:26,143 DEBUG WebMySession :24 - NEW SESSION! > 12:12:26,143 DEBUG RequestCycle:215 - No suitable handler found for URL > /imagees/myxyz2.jpg, falling back to container to process this request > > 12:12:26,163 DEBUG ServletWebRequest:197 - Calculating context relative path > from: context path '', filterPrefix '', uri > '/dynimg/id/1340795758750/name/mynewimage.jpg' > 12:12:26,163 DEBUG WebIsdefeSession:24 - NEW SESSION! > > > > For every image, javascript and css that is into the /${webapp} and must be > served directly from disk; and also from images created from a > DynamicResource > > ¿ Is this ok or I've done something wrong ? ¿ Why there are so many sessions > created ? > > I've tried with different browsers and the result is the same... > > Thanks in advance ! > > > > > Oscar Besga Arcauz < < < > > > PS: Hope this email is not duplicated, I send one without subject and it > doesn't appear to be on list > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
New sessions by each petition
Hi wickers !!! I'm battling with my application, and now I've noted something weird I've a custom WebSession class, in which I've coded a (horrible) log to check the creation of the new session: public class WebMySession extends WebSession { private static final Logger LOGGER = LoggerFactory.getLogger(WebMySession .class); public WebMySession(Request request) { super(request); LOGGER.debug("NEW SESSION!"); } } Into my webapp class I do public class WebMyApplication extends WebApplication { [...] @Override public Session newSession(Request request, Response response) { return new WebMySession(request); } [...] } But when I enter the first time into the app, I see this logged: 12:12:26,133 DEBUG ServletWebRequest:197 - Calculating context relative path from: context path '', filterPrefix '', uri '/imagees/myxyz.jpg' 12:12:26,133 DEBUG WebMySession :24 - NEW SESSION! 12:12:26,133 DEBUG RequestCycle:215 - No suitable handler found for URL /imagees/myxyz.jpg, falling back to container to process this request 12:12:26,143 DEBUG ServletWebRequest:197 - Calculating context relative path from: context path '', filterPrefix '', uri '/imagees/myxyz2.jpg' 12:12:26,143 DEBUG WebMySession :24 - NEW SESSION! 12:12:26,143 DEBUG RequestCycle:215 - No suitable handler found for URL /imagees/myxyz2.jpg, falling back to container to process this request 12:12:26,163 DEBUG ServletWebRequest:197 - Calculating context relative path from: context path '', filterPrefix '', uri '/dynimg/id/1340795758750/name/mynewimage.jpg' 12:12:26,163 DEBUG WebIsdefeSession:24 - NEW SESSION! For every image, javascript and css that is into the /${webapp} and must be served directly from disk; and also from images created from a DynamicResource ¿ Is this ok or I've done something wrong ? ¿ Why there are so many sessions created ? I've tried with different browsers and the result is the same... Thanks in advance ! > > > Oscar Besga Arcauz < < < PS: Hope this email is not duplicated, I send one without subject and it doesn't appear to be on list - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Stateless ajax in wicket 6
Hi wickers I know thats an old xxx in wicket lands, but I wonder if anyone has done something so far... Or simply make an ajax call to a bookmarable stateless page manually from web page Thanks > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Application instance from outside Wicket Application
Maybe if you do a foward from webservice to wicket page... >From other side, you can see Wicket Session classes and data into the normal >HttpSession (thougth it needs a little navigation) or you can hook data in normal HttpSession into wicket classes. My2cents: I would refactor helpers outside wicket > > > Oscar Besga Arcauz < < < -Martin Grigorov escribió: - Para: users@wicket.apache.org De: Martin Grigorov Fecha: 18/09/2012 21:42 Asunto: Re: Wicket Application instance from outside Wicket Application See org.apache.wicket.protocol.http.servlet.WicketSessionFilter On Tue, Sep 18, 2012 at 9:31 PM, Ernesto Reinaldo Barreiro wrote: > Can't the wicket filter be put in from of axis (servlet/filter) so that you > have a session and application attached to the thread? > > On Tue, Sep 18, 2012 at 6:05 PM, Martin Makundi < > martin.maku...@koodaripalvelut.com> wrote: > >> Hi! >> >> We have Axis web services running in the same Jetty as Wicket. >> >> Our Axis web services happen to call some wicket helper methods, which >> assume there is a session and application on thread. For localization, >> etc. >> >> How can our Wreb Service best get hold of the wicket application at >> runtime? >> >> >> ** >> Martin >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > > -- > Regards - Ernesto Reinaldo Barreiro > Antilia Soft > http://antiliasoft.com -- 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Mounting pages
Hi wickers ! I'm using wicket 6, if anyone can help with a problem with mapping pages and web resources I've been reading about it, but I can't find a way to make a web work as I want + http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/ + http://wicketinaction.com/2011/07/wicket-1-5-request-mapper/ + https://cwiki.apache.org/confluence/display/WICKET/Request+mapping I want to have two pages, Page1.class and Page2.class, Page1.class will collect every petition, except '/mynews' that will be answered by Page2.class and images and other resources (javascript, flash and videos, etc. ) In my WebApplication class, in the init() method, I've tried: public void init() { mount(new MountedMapper("/${parameter1}/#{parameter2}",Page1.class)); mount(new MountedMapper("/${parameter1}",Page1.class)); mount(new MountedMapper("/myNews", Page2.class)); } But always answers Page1.class I've tried the opposite: to mount Page2.class first, and other combinations; the result is the same. ¿ anyone knows why ? Also, sometimes the url {Page1.class}/var1/var2 is redirected to {Page1.class}?parameter1=var1¶meter2=var2 this is a thing I hate specially Thank for your help > > > Oscar Besga Arcauz < < < - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org