Re: Wicket Ajax direction and roadmap regarding push-like updates
Hi, On Thu, Feb 2, 2012 at 8:21 PM, pkc pkci...@gmail.com wrote: Thanks for the reply. The direction I'm wondering about is kind of like chained ajax requests and responses. At the API level you would update some controls in the onClick(), then tell wicket to return the updated ajax targets by calling some API method that would block until the web browser sent the next request saying it got the response and is ready to continue. So Wicket would make it a synchronous method for the developer but behind the scenes, it would be sending ajax responses and telling the web page to immediately make another request to continue the wicket server-side method. The first release could make some assumptions like the socket would just block until the code is finished for each section of code that takes a while. Then it could be refined as browsers and java servers better support push technology. Couldn't this be added to the core API and provide an interface for different implementations? I'm no expert but this is on my wish list. I'm afraid this is not possible with current version of HTTP protocol. Sevrlet containers use a Thread for each request/response, so you cannot block the user code (as you said to make it synchronous for the user) and in the same time to write back in the web response, close the connection and start a new connection, ... Even with Servlet 3.0 this is not possible. There you can suspend request/response, do some heavy calculation and when ready resume the request/response and write the result. As I suggested: take a look at wicketstuff-push. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Ajax-direction-and-roadmap-regarding-push-like-updates-tp4351890p4352332.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Unnecessary 302 redirects in Wicket 1.5
import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.IMarkupCacheKeyProvider; import org.apache.wicket.markup.IMarkupResourceStreamProvider; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.StringResourceStream; public class AppLogin extends WebPage implements IMarkupCacheKeyProvider, IMarkupResourceStreamProvider { public AppLogin(PageParameters params) { setStatelessHint(true); startAsyncProcss(params); } private void startAsyncProcss(PageParameters params) { // start asynchronous process with POSTed param } @Override public String getCacheKey(MarkupContainer components, Class? aClass) { return null; } @Override public IResourceStream getMarkupResourceStream(MarkupContainer components, Class? aClass) { return new StringResourceStream(?xml version=\1.0\?ok /); } @Override protected void configureResponse(WebResponse response) { super.configureResponse(response); response.setContentType(text/xml); } } Thanks. http://apache-wicket.1842946.n4.nabble.com/file/n4354074/p-r-g.png -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354074.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: Unnecessary 302 redirects in Wicket 1.5
There is no code related to redirections below. On Fri, Feb 3, 2012 at 11:06 AM, TH Lim ssh...@gmail.com wrote: import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.IMarkupCacheKeyProvider; import org.apache.wicket.markup.IMarkupResourceStreamProvider; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.StringResourceStream; public class AppLogin extends WebPage implements IMarkupCacheKeyProvider, IMarkupResourceStreamProvider { public AppLogin(PageParameters params) { setStatelessHint(true); startAsyncProcss(params); } private void startAsyncProcss(PageParameters params) { // start asynchronous process with POSTed param } @Override public String getCacheKey(MarkupContainer components, Class? aClass) { return null; } @Override public IResourceStream getMarkupResourceStream(MarkupContainer components, Class? aClass) { return new StringResourceStream(?xml version=\1.0\?ok /); } @Override protected void configureResponse(WebResponse response) { super.configureResponse(response); response.setContentType(text/xml); } } Thanks. http://apache-wicket.1842946.n4.nabble.com/file/n4354074/p-r-g.png -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354074.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Unnecessary 302 redirects in Wicket 1.5
The original constructor was public class AppLogin extends WebPage implements IMarkupCacheKeyProvider, IMarkupResourceStreamProvider { public AppLogin(PageParameters params) { setStatelessHint(true); startAsyncProcss(params); * throw new RestartResponseException(new PageProvider(getClass(), params), RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT); *} The additional code, in bold, caused stackoverflow exception. This page would be invoked by JavaScript call. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354166.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: Unnecessary 302 redirects in Wicket 1.5
On Fri, Feb 3, 2012 at 12:05 PM, TH Lim ssh...@gmail.com wrote: The original constructor was public class AppLogin extends WebPage implements IMarkupCacheKeyProvider, IMarkupResourceStreamProvider { public AppLogin(PageParameters params) { setStatelessHint(true); startAsyncProcss(params); * throw new RestartResponseException(new PageProvider(getClass(), params), RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT); This is wrong as you already found. You need to use this code to come to this page. I.e. from the previous page instead of using setResponsePage(AppLogin.class) use the exception. * } The additional code, in bold, caused stackoverflow exception. This page would be invoked by JavaScript call. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354166.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Unnecessary 302 redirects in Wicket 1.5
I tried and observed the PRG behavior as before. Even if it had worked, for every page I need to an additional transfer page. I don't think this is a good solution. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354302.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: Unnecessary 302 redirects in Wicket 1.5
Thanks for your help so far. It would be great if you could pass me some hints to allow me to do some research on my own. Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354785.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: Unnecessary 302 redirects in Wicket 1.5
Please start over with your problem. What do you want to achieve? What did you try? What problems did you face ? And I'm not sure what is PRG. On Fri, Feb 3, 2012 at 4:47 PM, TH Lim ssh...@gmail.com wrote: Thanks for your help so far. It would be great if you could pass me some hints to allow me to do some research on my own. Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354785.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Unnecessary 302 redirects in Wicket 1.5
What I want is a very simple end point to service a POST request originated from my JS using AJAX. What I was expecting was to do a POST and returned an acknowledgement as response. What happened was, after the POST request, the browser received a HTTP 302 to redirect the browser to GET the final response. I can see these states using the browser debugging tool. How do I set this page to do what I was expecting? thanks P-R-G, http://en.wikipedia.org/wiki/Post/Redirect/Get Post/Redirect/Get -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354872.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
Wicket ResourceFinder implementation for resources modified at runtime
I am using wicket 1.5.2. I have implemented a custom IResourceFinder that locates my wicket template [HTML] files from say /assets folder. This custom resource finder is registered with the application during application init [getResourceSettings().setResourceFinder(new myCustomResFinder())]. Now I have a situation where the assets are going to get versioned at runtime, which means my lookup path should be something like /assets/1 or /assets/2. I am just looking for a way if someone had a similar situation earlier. There are a couple of ways I think this can be achieved. 1. Listen to the assert version change event in wicket WebApplication and create a new instance of my custom resource finder with the new path, and set it again in ResourceSettings. I think this may be against any assumption that wicket makes that once WebApplication is initialized, the ResourceFinder is not going to change. Does wicket assumes that? Or can I go ahead and change the ResourceFinder anytime I want? 2. My custom resource finder decorates around WebApplicationPath and adds the path to the decorated WebApplicationPath instance - I have to decorate this as I determine the path within this resource finder component. Now I can listen to the asset version change event in my resource finder but I won't be able to overwrite the existing path in the WebApplicationPath. WebApplicationPath maintains a private final list of paths. If I need to do this way, I will end up duplicating the WebApplicationPath code in my custom resource finder, which I am not really comfortable in doing. Has any one tried this? Any suggestion? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ResourceFinder-implementation-for-resources-modified-at-runtime-tp4354878p4354878.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: Unnecessary 302 redirects in Wicket 1.5
For this you don't need Wicket Page at all. Just use a normal Servlet, fire a POST request to its URL and return whatever response you need. On Fri, Feb 3, 2012 at 5:19 PM, TH Lim ssh...@gmail.com wrote: What I want is a very simple end point to service a POST request originated from my JS using AJAX. What I was expecting was to do a POST and returned an acknowledgement as response. What happened was, after the POST request, the browser received a HTTP 302 to redirect the browser to GET the final response. I can see these states using the browser debugging tool. How do I set this page to do what I was expecting? thanks P-R-G, http://en.wikipedia.org/wiki/Post/Redirect/Get Post/Redirect/Get -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4354872.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
ResourceReference for resource in webapp dir
Hi, I have the following code in my base page: public void renderHead(IHeaderResponse response) { // scripts/jquery-1.7.1.min.js is in webapp dir response.renderJavaScriptReference(scripts/jquery-1.7.1.min.js); } How can I transform this direct URL to a ResourceReference? PackageResourceReference is not a good fit because I don't want to store the .js in a Java package since it is used by non-wicket pages. With ContextRelativeResource, Wicket reads the actual resource and sends the result instead of simply pointing to a URL. AbstractResource with its newResourceResponse() abstract method requires to return the actual ResourceResponse which won't allow for a simple URL. So from what I gather, I would have to fallback to implementing an IResource's respond(Attributes attributes) method. I looked at the implementation in AbstractResource but I'm confused about what to do with headers since I only want a URL. So, does this functionality already exist? If not, do you have a few pointers to steer me in the right direction? Thanks, Bertrand - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Unnecessary 302 redirects in Wicket 1.5
I could use a servlet. I thought I could easily setup a Wicket page to do something similar. Since I have @SpringBean ready to load services and DAOs. I was almost there. Just that I couldn't get the NEVER_REDIRECT directive work on a per page basis instead of global. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4355044.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
StalePageException with CryptoMapper
I'm getting a org.apache.wicket.request.mapper.StalePageException when using the CryptoMapper and clicking on a menu item. My menu items are a wrapper for the yui library that I created. The way that I'm creating the ajax callback is via a behavior. Below is my behavior. It works when I don't use the CryptoMapper. Any help is appreciated. Thanks. public class YuiMenuBarItemSelectionBehavior extends AbstractDefaultAjaxBehavior { private YuiMenuBarItem menuItem; public YuiMenuBarItemSelectionBehavior(YuiMenuBarItem menuItem) { this.menuItem = menuItem; } @Override protected void onBind() { super.onBind(); menuItem.setUrl(javascript: + generateCallbackScript(wicketAjaxGet(' + getCallbackUrl() + ').toString()); } @Override protected void respond(AjaxRequestTarget target) { menuItem.onMenuItemClicked(target); } }
Set Wicket User Session to Servlet's HttpSession
Hi, Is servlet HttpSession same as Wicket Session? If not, because I prefer HttpSession, how do I make wicket make use of HttpSession (server session)? Thanks -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde
Communication (in-vm) between webapps
Hi All, Maybe a fellow wicketeer can help me with this: We deploy one of our apps in two components: a frontend and an admin. We recently implemented a StringResourceLoader which fetches translations from a database. So far so good. Now we face the following problem: the frontend uses this StringResourceLoader, but the actual translations are managed through the admin. Currently both apps are deployed on the same vm (and in the same tomcat instance), but this might change in the future. We need a mechanism to tell the frontend to flush the localizer (and StringResourceLoader) cache when the user clicks a button in the admin. After some investigation we've found a number of solutions, ranging from easy to complex: - cross context = true, share a boolean through the ServletContext and poll for it to change - have the frontend expose an MBean (JMX) which the admin can control - use a message bus for communication (e.g. rabbitmq) - cluster communication, such as jgroups or hazelcast Can anyone comment on this? I'd prefer to keep things simple at this stage (e.g. setting up an external message bus for this seems overkill), but having something which works as we scale out would be preferable. Sebastian
DateTextField maxlength idea
I have a simple data entry form with a date/time field. My end users (web newbies) have found another interesting way to confound the most clear and straightforward instruction I can devise regarding it's (obvious?) use. I watched an end user type an entire time into the hour component without tabbing over to the minute. So, I'd like to suggest a minor change to extensions.yui.calendar.DateTimeField.html to add the maxlength=2 to the current size=2 on the hour/min input controls. I think it might be a simple way to give earlier feedback (I've found it unwise to rely on instructions like Please enter dates and times like this... ). I know I could accomplish this for my own instances, perhaps with a copy of this modified html in a spot higher in the classpath, or maybe an attribute modifier someplace..., but then I thought what is the downside of making it the default? Sure, it would impact a lot of code, but unless some locale I don't know of has 3 digit minutes, I don't think in a negative way --- I was suprised to find no other similar past discussion; perhaps there is some obvious reason this isn't a good idea? I can't be the first one to think of this, can I? Cheers, Jim In case all that's not clear, here's what I mean in code: MyPage.html span wicket:id=eventOnMM/DD/ [picker] HH MM [amPM]/span MyPage.java add(new DateTimeField(eventOn)); DateTimeField.html in wicket-datetime-1.5-RC5.1.jar wicket:panel xmlns:wicket=http://wicket.apache.org; span style=white-space: nowrap; input type=text wicket:id=date size=12 / input type=text wicket:id=hours size=2 *maxlength=2* / span wicket:id=hoursSeparator#160;:/span input type=text wicket:id=minutes size=2 *maxlength=2* / select wicket:id=amOrPmChoice/select /span /wicket:panel
Re: Set Wicket User Session to Servlet's HttpSession
Hello, It's not really clear what you mean and maybe you need to tell us what you want to do. A Wicket session stores it's attributes into an implementation of the ISessionStore interface, but the default the store is HttpSessionStore, so the HttpSession. On the other hand, the wicket session can exist in a temporary state for the duration of the request and not have a HttpSession created. See bind(...) method in HttpSessionStore and you can see the Wicket session object being stored in a httpsession attribute when the Wicket session needs to be persistent. setAttribute(request, Session.SESSION_ATTRIBUTE_NAME, newSession); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Set-Wicket-User-Session-to-Servlet-s-HttpSession-tp4355593p4355644.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: Communication (in-vm) between webapps
My first thought would be ehcache all the stuff in front end with a reasonable expiration period (hours maybe), and then expose a very simple JMX interface to manually reset the cache without bouncing the entire app. No need to send much data over JMX other than just a simple 'refresh all caches' command. Pretty simple, but gives you a lot of options. Good luck On Fri, Feb 3, 2012 at 2:51 PM, Bas Gooren b...@iswd.nl wrote: Hi All, Maybe a fellow wicketeer can help me with this: We deploy one of our apps in two components: a frontend and an admin. We recently implemented a StringResourceLoader which fetches translations from a database. So far so good. Now we face the following problem: the frontend uses this StringResourceLoader, but the actual translations are managed through the admin. Currently both apps are deployed on the same vm (and in the same tomcat instance), but this might change in the future. We need a mechanism to tell the frontend to flush the localizer (and StringResourceLoader) cache when the user clicks a button in the admin. After some investigation we've found a number of solutions, ranging from easy to complex: - cross context = true, share a boolean through the ServletContext and poll for it to change - have the frontend expose an MBean (JMX) which the admin can control - use a message bus for communication (e.g. rabbitmq) - cluster communication, such as jgroups or hazelcast Can anyone comment on this? I'd prefer to keep things simple at this stage (e.g. setting up an external message bus for this seems overkill), but having something which works as we scale out would be preferable. Sebastian
Re: Unnecessary 302 redirects in Wicket 1.5
Hi Lim, What about using an AbstractResource instead for serving the xml. You can do something like: @Override protected ResourceResponse newResourceResponse(Attributes attributes) { final ResourceResponse response = new ResourceResponse(); PageParameters requestParams = attributes.getParameters(); response.setLastModified(Time.now()); response.disableCaching(); response.setContentType(text/xml); response.setTextEncoding(UTF-8); response.setWriteCallback(new WriteCallback() { @Override public void writeData(final Attributes attributes) { attributes.getResponse().write(xml..); } }); response.setContentDisposition(ContentDisposition.INLINE); return response. } And you have all the benefits wicket like @SpringBean available, access to wicket session, etc. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unnecessary-302-redirects-in-Wicket-1-5-tp3921623p4355660.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: Communication (in-vm) between webapps
Some REST interface to be called through Httpclient from the admin application I'd say it's the simplest approach. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Communication-in-vm-between-webapps-tp4355616p4355667.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
Property Model Issue
Hi guys, I'm having an issue with property models. I have a DataView running over a number of Post objects. The Post object has a property named product with appropriate getter/setter. new DataViewPost(posts, provider) { protected void populateItem(final ItemPost item) { item.setModel(CompoundPropertyModel.of(item.getModel())); item.add(new ProductPanel(product)); } } The issue is within ProductPanel. It has a number of labels, each only specifying a name (no model). In my initModel() I am creating a CompoundPropertyModel around super.initModel(). I was expecting it to pull these properties from the model object of my ProductPanel. public class ProductPanel extends GenericPanelProduct { public ProductPanel(final String id) { add(new Label(name)); add(new Label(condition)); } protected IModel? initModel() { return CompoundPropertyModel.of(super.initModel()); } } But I get this error: org.apache.wicket.WicketRuntimeException: No get method defined for class: class com.cellcycleusa.domain.Post expression: name. Seems that it's trying to access the Post object from the DataView to pull the property from, not the model object of the ProductPanel itself. Now the really funny part is that if I just add this to ProductPanel, everything works fine: protected void onBeforeRender() { getModel(); super.onBeforeRender(); } Or if I specify the model objects for the labels within ProductPanel like this: new Label(name, new ComponentPropertyModelString(name)) That works as well. What am I doing wrong? -- Sam Barrow Squidix IT Services - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Property Model Issue
Hi Sam, I think your use of Item#setModel() and Component#initModel() are unconventional. Try: populateItem(ItemPost item) { item.add(new ProductPanel(product, item.getModel()); } ProductPanel(String id, IModelProduct model) { super(id, CompoundPropertyModel.of(model)); add(new Label(name)); add(new Label(condition)); } On Fri, Feb 3, 2012 at 12:51 PM, Sam Barrow s...@sambarrow.com wrote: Hi guys, I'm having an issue with property models. I have a DataView running over a number of Post objects. The Post object has a property named product with appropriate getter/setter. new DataViewPost(posts, provider) { protected void populateItem(final ItemPost item) { item.setModel(CompoundPropertyModel.of(item.getModel())); item.add(new ProductPanel(product)); } } The issue is within ProductPanel. It has a number of labels, each only specifying a name (no model). In my initModel() I am creating a CompoundPropertyModel around super.initModel(). I was expecting it to pull these properties from the model object of my ProductPanel. public class ProductPanel extends GenericPanelProduct { public ProductPanel(final String id) { add(new Label(name)); add(new Label(condition)); } protected IModel? initModel() { return CompoundPropertyModel.of(super.initModel()); } } But I get this error: org.apache.wicket.WicketRuntimeException: No get method defined for class: class com.cellcycleusa.domain.Post expression: name. Seems that it's trying to access the Post object from the DataView to pull the property from, not the model object of the ProductPanel itself. Now the really funny part is that if I just add this to ProductPanel, everything works fine: protected void onBeforeRender() { getModel(); super.onBeforeRender(); } Or if I specify the model objects for the labels within ProductPanel like this: new Label(name, new ComponentPropertyModelString(name)) That works as well. What am I doing wrong? -- Sam Barrow Squidix IT Services - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Property Model Issue
I seem to have confused your data model. How do you get from Post to Product? On Fri, Feb 3, 2012 at 1:57 PM, Dan Retzlaff dretzl...@gmail.com wrote: Hi Sam, I think your use of Item#setModel() and Component#initModel() are unconventional. Try: populateItem(ItemPost item) { item.add(new ProductPanel(product, item.getModel()); } ProductPanel(String id, IModelProduct model) { super(id, CompoundPropertyModel.of(model)); add(new Label(name)); add(new Label(condition)); } On Fri, Feb 3, 2012 at 12:51 PM, Sam Barrow s...@sambarrow.com wrote: Hi guys, I'm having an issue with property models. I have a DataView running over a number of Post objects. The Post object has a property named product with appropriate getter/setter. new DataViewPost(posts, provider) { protected void populateItem(final ItemPost item) { item.setModel(CompoundPropertyModel.of(item.getModel())); item.add(new ProductPanel(product)); } } The issue is within ProductPanel. It has a number of labels, each only specifying a name (no model). In my initModel() I am creating a CompoundPropertyModel around super.initModel(). I was expecting it to pull these properties from the model object of my ProductPanel. public class ProductPanel extends GenericPanelProduct { public ProductPanel(final String id) { add(new Label(name)); add(new Label(condition)); } protected IModel? initModel() { return CompoundPropertyModel.of(super.initModel()); } } But I get this error: org.apache.wicket.WicketRuntimeException: No get method defined for class: class com.cellcycleusa.domain.Post expression: name. Seems that it's trying to access the Post object from the DataView to pull the property from, not the model object of the ProductPanel itself. Now the really funny part is that if I just add this to ProductPanel, everything works fine: protected void onBeforeRender() { getModel(); super.onBeforeRender(); } Or if I specify the model objects for the labels within ProductPanel like this: new Label(name, new ComponentPropertyModelString(name)) That works as well. What am I doing wrong? -- Sam Barrow Squidix IT Services - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Property Model Issue
On Fri, 2012-02-03 at 13:57 -0800, Dan Retzlaff wrote: Hi Sam, I think your use of Item#setModel() and Component#initModel() are unconventional. Try: Hi Dan, Yes I never really liked my item.setModel() technique, just didn't seem right to me but I've seen it in more than one tutorial so I figured it was the way it was done. I actually moved the compounding part over the newItem method in dataview just now though, seems cleaner. populateItem(ItemPost item) { item.add(new ProductPanel(product, item.getModel()); } ProductPanel(String id, IModelProduct model) { super(id, CompoundPropertyModel.of(model)); add(new Label(name)); add(new Label(condition)); } I'm sure this would work, just wondering if there's a better way to do this? Is it good practice to manipulate the model in the constructor like that? Doesn't seem right to me as the model may need to change (maybe via ajax?). I try to never mess with my models like that outside of the rendering phase. I've been toying with wicket occasionally for over a year now, but never gone this far with it so I'm still learning how it all works. I would if at all possible like to retain the ability to create a new ProductPanel without specifying the model in the constructor. This seems to be the way things are usually done in Wicket so I figured there must be a better way. Product is a property of post so I'd be specifying it in two different places, and again if I wanted to add any more composited components under ProductPanel. I've corrected your code to reflect this (I just got your next message). populateItem(ItemPost item) { item.add(new ProductPanel(product, new PropertyModelProduct(item.getModel(), product)); } I was using the compoundpropertymodel to avoid specifying the product property manually as is done above, but that part is working for me with no issues, it's just inside ProductPanel that I'm having problems. It's not that I'm really that lazy, just an issue of best practice for me. On Fri, Feb 3, 2012 at 12:51 PM, Sam Barrow s...@sambarrow.com wrote: Hi guys, I'm having an issue with property models. I have a DataView running over a number of Post objects. The Post object has a property named product with appropriate getter/setter. new DataViewPost(posts, provider) { protected void populateItem(final ItemPost item) { item.setModel(CompoundPropertyModel.of(item.getModel())); item.add(new ProductPanel(product)); } } The issue is within ProductPanel. It has a number of labels, each only specifying a name (no model). In my initModel() I am creating a CompoundPropertyModel around super.initModel(). I was expecting it to pull these properties from the model object of my ProductPanel. public class ProductPanel extends GenericPanelProduct { public ProductPanel(final String id) { add(new Label(name)); add(new Label(condition)); } protected IModel? initModel() { return CompoundPropertyModel.of(super.initModel()); } } But I get this error: org.apache.wicket.WicketRuntimeException: No get method defined for class: class com.cellcycleusa.domain.Post expression: name. Seems that it's trying to access the Post object from the DataView to pull the property from, not the model object of the ProductPanel itself. Now the really funny part is that if I just add this to ProductPanel, everything works fine: protected void onBeforeRender() { getModel(); super.onBeforeRender(); } Or if I specify the model objects for the labels within ProductPanel like this: new Label(name, new ComponentPropertyModelString(name)) That works as well. What am I doing wrong? -- Sam Barrow Squidix IT Services - 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
calling shell script from Wicket java program
i am developing a web application using apache wickets. I need to call a shell script residing on my local disk from java code. this is the section of code under concern : ProcessBuilder builder = new ProcessBuilder(sh,/media/drive_/MtechDocuments/ProgramingNOTES/RunShellfromJAVA/test.sh); builder.redirectErrorStream(true); final Process process = builder.start(); } process.waitFor(); -- This is piece of code successfully runs fine and execute a shell when this code is a part of java prgram residing anywhere on my laal disk. However, when i make a jar file of a progeam , put in webapps folder , and start the web application , it reports permission denied error on test.sh script. I then modify the line as : ProcessBuilder builder = new ProcessBuilder(sudo, -A, sh,/media/drive_/MtechDocuments/ProgramingNOTES/RunShellfromJAVA/test.sh); and set the SUDO_ASKPASS env variable to script returning my sudo password , then it reports the following error : sudo: 3 incorrect password attempts and script calling is failed. Again this works correctly when i run the program outside the web development environment , it is able to read my sudo password correctly at run time with -A option. Why is it failing when running the same program from web application ? please help !! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/calling-shell-script-from-Wicket-java-program-tp4353583p4353583.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket-Source: Click-through from browser back to Java source
Wow this is really handy, thanks Jenny. Looking forward to the Chrome port! I just whipped up a plugin for Intellij. It might not be publicly available until they have a chance to review it, but here's the link: http://plugins.intellij.net/plugin/?ideaid=6846 You can https://github.com/armhold/wicket-source-intellij/tree/master/artifacts install the jar manually if you don't feel like waiting for it to show up in the public repo. In the mean time source is on github: https://github.com/armhold/wicket-source-intellij. Minas: I've never done an Intellij plugin before so this is probably not the most idiomatic code, but feel free to copy the relevant bits into wicketforge if you find it useful. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Source-Click-through-from-browser-back-to-Java-source-tp4346532p4356257.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket-Source: Click-through from browser back to Java source
Yay, another platform! Thank you for porting it. Jenny On Fri, Feb 3, 2012 at 6:39 PM, armhold armh...@gmail.com wrote: Wow this is really handy, thanks Jenny. Looking forward to the Chrome port! I just whipped up a plugin for Intellij. It might not be publicly available until they have a chance to review it, but here's the link: http://plugins.intellij.net/plugin/?ideaid=6846 You can https://github.com/armhold/wicket-source-intellij/tree/master/artifacts install the jar manually if you don't feel like waiting for it to show up in the public repo. In the mean time source is on github: https://github.com/armhold/wicket-source-intellij. Minas: I've never done an Intellij plugin before so this is probably not the most idiomatic code, but feel free to copy the relevant bits into wicketforge if you find it useful. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Source-Click-through-from-browser-back-to-Java-source-tp4346532p4356257.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