Re: Server cannot find /app url after migration to 1.3 filter
2007/10/2, Gwyn Evans [EMAIL PROTECTED]: Are you sure you deployed your web-app to the ROOT context? It's not just at http://localhost/myApp/app/ is it? One thing I like about Jetty is that it's normally clear to see what's mounted where, as the default '/' servlet will list them when running 'mvn jetty:run' /Gwyn I think yes , the following is my resin's config about my host : host id='foo.bar.com' error-log id='log/error.log' / jsp precompile='true' static-encoding='true' recompile-on-error='true'/ servlet-mapping url-pattern='*.jsp' servlet-name=' com.caucho.jsp.JspServlet'/ web-app id='/' app-dir='/home/foobar/www' session-config session-max4096/session-max session-timeout30/session-timeout enable-cookiestrue/enable-cookies enable-url-rewritingtrue/enable-url-rewriting /session-config /web-app /host I deploy my app to / as described ...
Re: Server cannot find /app url after migration to 1.3 filter
Hi , I think it seems resin's problem (2.1.7). After a lot of combinations , I still cannot make the wicket filter work. The error (URL not found) is reported by apache , not by resin . which means the filter request is not passed to resin. After I assign port ( http://foo.bar.com:8080/app ) , everything works fine now. But other servlets are not required to assign port , it means http://foo.bar.com/servlet/OtherServlets works very well. ( servlets are mapped to /servlet/* URL pattern ) Therefore , it maybe resin's problem I think. To avoid exposing port 8080 , maybe I have to set a reverse-proxy in apache's config. ...
Re: Server cannot find /app url after migration to 1.3 filter
Yes , I use Apache as a front end. If any configuration goes wrong , servlets' requests will not be processed by resin, either. But http://foo.bar.com/servlet/other.servlet just works fine. (No port assign) It means resin (2.1.7) seems doesn't intercept filter's requests. I've also reported this issue to resin's maillist. 2007/10/2, David Bernard [EMAIL PROTECTED]: If I understand right you use Apache as a front end ? If it work when you access to resin via a direct call ( http://foo.bar.com:8080/app) then I don't think it a problem with resin but with your apache front-end configuration. What do you map from apache to resin (1)/app, (2)/app* or (3)/app/* ? In my experience you need to map (1 and 3) or 2. You don't need to map 1 and 3 only if you have a rewrite rule /app = /app/. Yes , I tried but in vain.
Re: Server cannot find /app url after migration to 1.3 filter
2007/10/3, David Bernard [EMAIL PROTECTED]: Sorry I need the mapping, could you send /usr/local/resin/conf/resin.conf. This is my partial resin.conf , thanks in advanced. http port='8080'/ ... srun host='127.0.0.1' port='6802'/ ... host id='foo.bar.com' error-log id='log/error.log' / jsp precompile='true' static-encoding='true' recompile-on-error='true'/ servlet-mapping url-pattern='*.jsp' servlet-name=' com.caucho.jsp.JspServlet'/ web-app id='/' app-dir='/home/foobar/www' session-config session-max4096/session-max session-timeout30/session-timeout enable-cookiestrue/enable-cookies enable-url-rewritingtrue/enable-url-rewriting /session-config /web-app access-log id='/home/foobar/log/servlet/access_log' rollover-period2W/rollover-period /access-log /host
Re: Server cannot find /app url after migration to 1.3 filter
2007/10/2, David Bernard [EMAIL PROTECTED]: It depends of how you map/forward from apache to resin. What is your apache configuration? If it works when you access resin directly, what is done when you access throught port 8080, then it's not a resin problem. Hi , this is my (partial) httpd.conf NameVirtualHost *:80 VirtualHost *:80 ServerName foo.bar.com DocumentRoot /home/foobar/www ErrorLog/home/foobar/log/error_log CustomLog /home/foobar/log/access_log combined Directory / # DAV on AllowOverride # AuthConfig order deny,allow Options Indexes FollowSymLinks ExecCGI /Directory /VirtualHost # # mod_caucho Resin Configuration # LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so CauchoConfigFile /usr/local/resin/conf/resin.conf
Re: Server cannot find /app url after migration to 1.3 filter
2007/10/3, David Bernard [EMAIL PROTECTED]: Sorry No idea :-( abstract of your problem : http://foo.bar.com/app KO http://foo.bar.com/app/ ?? This fails too. http://foo.bar.com:8080/app OK http://127.0.0.1:6802/app ?? port 6802 is resin's srun server , not http-connectable http://foo.bar.com/servlet/TotoServet OK servlet/TotoServlet is part of the same webapp your filter mapping ? is it right ? No , servlets are mapped by servlet-mapping (web.xml) , not by filter-mapping : servlet-mapping url-pattern=/servlet/* servlet-name=invoker / Have you try: * to set port to 80 instead of 8080 Port 80 is listened by apache httpd. I need apache httpd to serve large amount of static contents. * to create an empty dir app under your webapp, I know that Websphere failed if a filter is not apply on a file or servlet. This fails too. If I create a app directory under /home/foobar/www/ , and put index.html in /home/foobar/www/app/index.html , When types http://foo.bar.com/app , it will show the content of index.html , meaning that this URL is not intercepted by resin's filter. However , If I create a /home/foobar/www/servlet directory , and put index.html in it. When types http://foo.bar.com/servlet , resin will intercept and throws this exception : javax.servlet.ServletException: Class `index.html' was not found in classpath. Classes normally belong in /WEB-INF/classes.
Re: Server cannot find /app url after migration to 1.3 filter
2007/10/3, David Bernard [EMAIL PROTECTED]: Have you try: * to set port to 80 instead of 8080 Port 80 is listened by apache httpd. I need apache httpd to serve large amount of static contents. Yes, and resin.conf isn't run as part of Apache? Apache (port 80) - srun(6802) Resin is a module of apache httpd , through this module : /usr/lib/httpd/modules/mod_caucho.so Through this module , resin will try to intercept matched URL and redirect to resin. Sorry , no other idea, except may be create an dummyServlet mapped to /app in web.xml. Have you the same problem with resin 3.x ? That's OK , I can set up a reverse-proxy to solve this problem , won't expose port 8080 ... As to resin 3.x , I have a lot of webapps , and I am afraid there will be some incompatibilities. This will be a big task I'll try it in the future , not sure..
Re: Server cannot find /app url after migration to 1.3 filter
Hi , I had a strong suspicion that WicketFilter (from 1.3 b3) not compatible with Resin ( I tried 2.1.17 and latest 3.0.24 ) I can install a very simple filter , just doing this : public void doFilter (...) System.out.println(before doFilter); chain.doFilter(req, res); System.out.println(after doFilter); And mount this test filter to /* , it works. That means it can intercept http://foo.bar.com/servlet/foo.bar.test.TestServlet; , and print the messages. But WicketFilter just cannot work correctly with Resin_with_apache. I have to manually assign to port 8080 to make the filter work. Anybody successfully install WicketFilter with Resin_with_Apache (mod_caucho.so) ? (not standalone resin) 2007/10/3, smallufo [EMAIL PROTECTED]: 2007/10/3, David Bernard [EMAIL PROTECTED]: Have you try: * to set port to 80 instead of 8080 Port 80 is listened by apache httpd. I need apache httpd to serve large amount of static contents. Yes, and resin.conf isn't run as part of Apache? Apache (port 80) - srun(6802) Resin is a module of apache httpd , through this module : /usr/lib/httpd/modules/mod_caucho.so Through this module , resin will try to intercept matched URL and redirect to resin. Sorry , no other idea, except may be create an dummyServlet mapped to /app in web.xml. Have you the same problem with resin 3.x ? That's OK , I can set up a reverse-proxy to solve this problem , won't expose port 8080 ... As to resin 3.x , I have a lot of webapps , and I am afraid there will be some incompatibilities. This will be a big task I'll try it in the future , not sure..
Re: Server cannot find /app url after migration to 1.3 filter
2007/10/13, smallufo [EMAIL PROTECTED]: Hi , I had a strong suspicion that WicketFilter (from 1.3 b3) not compatible with Resin ( I tried 2.1.17 and latest 3.0.24 ) I just grabbed the latest 1.3 b4 , the problem remains. I also found that the following filter-mapping works : filter filter-name=test filter-class=foo.bar.TestFilter/ filter-mapping filter-name=test url-pattern=/* / while the following doesn't work : filter filter-name=wicket filter-class= org.apache.wicket.protocol.http.WicketFilter init-param applicationClassName=foo.bar.MyApplication/ init-param configuration=DEVELOPMENT/ /filter filter-mapping filter-name=wicket url-pattern=/app/*/ When I try to connect to foo.bar.com:8080/app , it throws : java.lang.IllegalArgumentException: Error initializing WicketFilter - you have no filter-mapping element with a url-pattern that uses filter: wicket It seems that WicketFilter cannot parse @filter-name and @url-pattern of filter-mapping tag. (But it can correctly parse @filter-name , @filter-class of filter tag.) I have to change it to : filter-mapping filter-namewicket/filter-name url-pattern/app/*/url-pattern /filter-mapping But 1.3b4 's filter still cannot intercept /app at port 80.
WebPage for serving binary image data
Hi I hope I can use wicket to serve image data. I know I can extend org.apache.wicket.markup.html.image.Image and provide a DynamicImageResource but the generated image link is http://localhost/app/?wicket:interface=:0:customImage::IResourceListener:: The image data is stored in the session and not bookmarkable, which is not what I want. I then created an ImagePage extends WebPage and override onBeforeRender() , and coding below : HttpServletResponse response = ((WebResponse) getWebRequestCycle().getResponse()).getHttpServletResponse(); try { response.setContentType(image/png); OutputStream responseOutputStream = response.getOutputStream(); responseOutputStream.write(myImageBytes); responseOutputStream.flush(); responseOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } It works !!! And I can bookmark the image. But there are warning output : 2008-12-26 02:20:42,919 ERROR wicket.RequestCycle - org.apache.wicket.Component has not been properly rendered. Something in the hierarchy of foo.bar.ImagePage has not called super.onBeforeRender() in the override of onBeforeRender() method java.lang.IllegalStateException: org.apache.wicket.Component has not been properly rendered. Something in the hierarchy of foo.bar.ImagePage has not called super.onBeforeRender() in the override of onBeforeRender() method at org.apache.wicket.Component.internalBeforeRender(Component.java:1006) at org.apache.wicket.Component.beforeRender(Component.java:1034) at org.apache.wicket.Component.prepareForRender(Component.java:2160) Is this the standard way of outputing binary data ? If not , what is the better way (wicket 1.3.5) ? thanks.
Re: WebPage for serving binary image data
Well , What I need is parsing URL and generating a corresponding image from BufferedImage , not a bookmarkable link to internal file resource... for example : http://localhost/app/myImage/text/Hello/width/500 This will generate a 500x500 png , containing a Hello String.
Re: WebPage for serving binary image data
Hi , thank you for replying. 2008/12/26 Jeremy Thomerson jer...@wickettraining.com Then, you can include it in your page: JAVA: add(new Image(img, new ResourceReference( WicketApplication.IMAGE_KEY))); HTML: img wicket:id=img / http://localhost:8080/foo http://localhost:8080/foo?text=fffwidth=200 My question is ... is /foo a bookmarkable mounted WebPage ? If it is , where did you set the ContentType to image/png ? I cannot find such code ... If it is not a WebPage , how should I accomplish this by a WebPage ? I don't need the dynamic-generated image to be included in the WebPage's img tag. BR -- smallufo
Re: WebPage for serving binary image data
Thank you, it works ! Though I am not sure why ThreadLocal is needed here ... Anyway , the solution is much pretty than WebPage. BR -- 2008/12/27 Jeremy Thomerson jer...@wickettraining.com It's not a WebPage because you're not serving a page - it is a mounted resource. Why do you want to force it to be a page? It's a bookmarkable resource - which is what you're serving. The type is set by DynamicImageResource - look in getResourceStream or getResourceState. On Fri, Dec 26, 2008 at 1:51 PM, smallufo small...@gmail.com wrote: Hi , thank you for replying. 2008/12/26 Jeremy Thomerson jer...@wickettraining.com Then, you can include it in your page: JAVA: add(new Image(img, new ResourceReference( WicketApplication.IMAGE_KEY))); HTML: img wicket:id=img / http://localhost:8080/foo http://localhost:8080/foo?text=fffwidth=200 My question is ... is /foo a bookmarkable mounted WebPage ? If it is , where did you set the ContentType to image/png ? I cannot find such code ... If it is not a WebPage , how should I accomplish this by a WebPage ? I don't need the dynamic-generated image to be included in the WebPage's img tag. BR -- smallufo -- Jeremy Thomerson http://www.wickettraining.com
Re: onmouseover image
I am seeking a solution and found this mail. This is a very useful implementation. I strongly suggest future wicket to include this Component. Thank you , Jeremy -- smallufo 2008/10/8 Jeremy Thomerson jer...@wickettraining.com This doesn't preload the images, but it is a simple way to do a Mouseover. You could easily add a header contributor within the constructor of this class that outputs some javascript to preload the images. public class MouseoverImage extends Image { private static final long serialVersionUID = 1L; private final ResourceReference mImage; private final ResourceReference mMouseoverImage; public MouseoverImage(String id, ResourceReference image, ResourceReference mouseoverImage) { super(id, image); mImage = image; mMouseoverImage = mouseoverImage; add(new AttributeModifier(onmouseover, null, true, new LoadableDetachableModelString() { private static final long serialVersionUID = 1L; @Override protected String load() { return this.src=' + urlFor(mMouseoverImage) + ';; } })); add(new AttributeModifier(onmouseout, null, true, new LoadableDetachableModelString() { private static final long serialVersionUID = 1L; @Override protected String load() { return this.src=' + urlFor(mImage) + ';; } })); } }
Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException
But if I implement this Window-like panel by extending Border I have no way to notify the collapse/expand events to the containing content . In my previous implementation , the AbstractPullDownPanel defines two methods invisible()/visible() for successor to override , if they want to handle the collapse / expand events. But if I implement it in Border , and place the expand / collapse link to the top of the Border . Because the border is added to the panel , I find no way to notify the expand/collapse events to its containing panel. I don't know how to gracefully solve this problem just like the AbstractPullDownPanel ... (define two methods for successor to override) Does anybody know how to accomplish it ? Thank you. 2009/2/1 Igor Vaynberg (JIRA) j...@apache.org [ https://issues.apache.org/jira/browse/WICKET-1712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel] Igor Vaynberg resolved WICKET-1712. --- Resolution: Won't Fix Assignee: Igor Vaynberg this usecase is not supported - you are abusing istransparentresolver - it is not meant to toggle visibility of nested components because it does not really nest them. i would suggest using a border instead because it is meant for usecases just like this Inheritance inside a Container throws WicketRuntimeException Key: WICKET-1712 URL: https://issues.apache.org/jira/browse/WICKET-1712 Project: Wicket Issue Type: Bug Components: wicket Affects Versions: 1.3.3, 1.3.4 Environment: Linux , resin-3.0.24 , Wicket 1.3.3 Reporter: smallufo Assignee: Igor Vaynberg Attachments: AbstractPullDownPanel.html, AbstractPullDownPanel.java, RadioGroupPanel.html, RadioGroupPanel.java, TestPage.html, TestPage.java, TestSession.java This is related to WICKET-1095 , associating discussions can be found here : http://www.nabble.com/Inheritance-inside-a-Container-ts16514647.html To summarize : I want to make a Widget , AbstractPullDownPanel , that I can collapse / expand it. Any panel extends AbstractPullDownPanel will have a title bar , with ajax-enabled collapse / expand link in the upper right of the panel. When the panel is collapsed , it will leave a title bar there. The state of the panel (open / closed) is stored in WebSession Now , I have a RadioGroupPanel extends AbstractPullDownPanel . If it only contains an empty RadioGroup : RadioGroup selectDeselectGroup = new RadioGroup(selectDeselectGroup); Everything works fine , no matter the panel is collapsed or expanded , page reloading is ok But if I add Radio(s) inside the RadioGroup , only when the panel is expanded , page-reloading is ok. If the panel is collapsed , page reloading will throw WicketRuntimeException : WicketMessage: The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered). 1. [MarkupContainer [Component id = selectDeselectGroup, page = destiny.wicket.test.TestPage, path = 1:radioGroupPanel:selectDeselectGroup.RadioGroup, isVisible = true, isVersioned = false]] 2. [MarkupContainer [Component id = selectAll, page = destiny.wicket.test.TestPage, path = 1:radioGroupPanel:selectDeselectGroup:selectAll.Radio, isVisible = true, isVersioned = false]] 3. [MarkupContainer [Component id = deselectAll, page = destiny.wicket.test.TestPage, path = 1:radioGroupPanel:selectDeselectGroup:deselectAll.Radio, isVisible = true, isVersioned = false]] Root cause: org.apache.wicket.WicketRuntimeException: The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered). 1. [MarkupContainer [Component id = selectDeselectGroup, page = destiny.wicket.test.TestPage, path = 1:radioGroupPanel:selectDeselectGroup.RadioGroup, isVisible = true, isVersioned = false]] 2. [MarkupContainer [Component id = selectAll, page = destiny.wicket.test.TestPage, path = 1:radioGroupPanel:selectDeselectGroup:selectAll.Radio, isVisible = true, isVersioned = false]] 3. [MarkupContainer [Component id = deselectAll, page = destiny.wicket.test.TestPage, path = 1:radioGroupPanel:selectDeselectGroup:deselectAll.Radio, isVisible = true, isVersioned = false]] at org.apache.wicket.Page.checkRendering(Page.java:1116) at org.apache.wicket.Page.renderPage(Page.java:914) at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:231) at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104) at org.apache.wicket.RequestCycle.processEventsAndRespond
Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException
2009/2/4 Igor Vaynberg igor.vaynb...@gmail.com PulldownBorder border = new PulldownBorder(border , Test Title , true); border.setTransparentResolver(true); add(border); ^ that is all wrong you should create a border and to it add a panel that will be expanded/collapsed. so the panel that is the content should be inside the border. Hi But MyPanel's HTML is like this : wicket:panel span wicket:id=border style=width:136px; // blah /span /wicket:panel According to the hierarchy , I have to new a PulldownBorder and add it to MyPanel , isn't it ? As to the onClick() , I change to Timo Rantalaiho's suggestion : ExpandCollapseListener listener = (ExpandCollapseListener) findParent(ExpandCollapseListener.class); if (listener != null) listener.setExpanded(expanded); And it worked !!!
Re: [jira] Resolved: (WICKET-1712) Inheritance inside a Container throws WicketRuntimeException
Thank you for such a practical IVisitor tutorial. But I have another problem : When traversalling the nodes , it cannot find any Component that implements ExpandCollapseListener. But the Panel that wrapped by the Border indeed implements ExpandCollapseListener Can you check where goes wrong ? Here is the code : public class PulldownBorder extends Border { private final WebMarkupContainer content; private boolean expanded; public PulldownBorder(String id , String title , boolean defaultShown) { super(id); Label titleLabel = new Label(title , title ); expanded = defaultShown; content = new WebMarkupContainer(content); content.setOutputMarkupPlaceholderTag(true); content.setVisible(defaultShown); add(content); content.add(getBodyContainer()); final Label collapseExpandText = new Label(collapseExpandText); collapseExpandText.setOutputMarkupPlaceholderTag(true); if (content.isVisible()) collapseExpandText.setModel(new StringResourceModel(collapse , this , null)); else collapseExpandText.setModel(new StringResourceModel(expand , this , null)); Link collapseExpandLink = new AjaxFallbackLink(collapseExpandLink) { @Override public void onClick(AjaxRequestTarget target) { expanded=!expanded; target.addComponent(content.setVisible(expanded)); PulldownBorder.this.visitChildren(new IVisitor() { @Override public Object component(Component c) { if (c instanceof ExpandCollapseListener) { System.out.println(c + is ExpandCollapseListener ); ((ExpandCollapseListener)c).setExpanded(expanded); return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; } else { System.out.println(c + is NOT ExpandCollapseListener ); return CONTINUE_TRAVERSAL; } } }); if (!expanded) target.addComponent(collapseExpandText.setModel(new StringResourceModel(expand , this , null))); else target.addComponent(collapseExpandText.setModel(new StringResourceModel(collapse , this , null))); } }; add(collapseExpandLink); collapseExpandLink.add(collapseExpandText); collapseExpandLink.add(titleLabel); } } Here is the Panel that wrapped by PulldownBorder : public class MyPanel extends Panel implements ExpandCollapseListener { public MyPanel(String id) { super(id); PulldownBorder border = new PulldownBorder(border , Test Title , true); border.setTransparentResolver(true); add(border); // blah } @Override public void setExpanded(boolean value) { // blah... } } Here is the output (click collapse, and folding the content) : [MarkupContainer [Component id = content]] is NOT ExpandCollapseListener [MarkupContainer [Component id = _body]] is NOT ExpandCollapseListener [MarkupContainer [Component id = collapseExpandLink]] is NOT ExpandCollapseListener [Component id = collapseExpandText] is NOT ExpandCollapseListener [Component id = title] is NOT ExpandCollapseListener Why it cannot find any component implementing ExpandCollapseListener ? Where goes wrong ? Thanks a lot -- smallufo 2009/2/4 Igor Vaynberg igor.vaynb...@gmail.com add(new link(collapseOrExpand) { onclick() { expanded=!expanded; updateState(expanded); Border.this.visitChildren(new IVisitor() { public int onComponent(Component c) { if (c instanceof ExpandCollapseListener) { ((ExpandCollapseListener)c).onEvent(expanded); return CONTINUE_BUT_DO_NOT_GO_ANY_DEEPER; } else { return CONTINUE; } } }); } -igor
Border fails to render if its contents are not visible by default (WICKET-1789 ?)
I don't know if the problem has any relation to WICKET-1789 https://issues.apache.org/jira/browse/WICKET-1789 But I have a very similar situation : My problem traces back to WICKET-1712 https://issues.apache.org/jira/browse/WICKET-1712 I want to create a component which can Expand and Collapse its content , just like a window. I originally inheritd Panel to implement it , but Igor Vaynberg told me that is wrong , the correct way is to use a Border. But several days passed by , I still cannot finish the component , I am stuck to the situation very much like WICKET-1789 : That the border fails to render if its contents are not visible by default. According to WICKET-1789 , it says 1.3.5 has fixed the problem , but I still have this problem. The attachment is my quickstart code , which draws two panels in one page , one panel is default expand , another is default collapsed. The default_expanded panel can successfully collapse and expand again and again. But the default_collapsed panel just has no response I tried every way I can think , but still find no solution. Can somebody help me check the code , telling me where goes wrong . Thanks a lot. -- smallufo quickstart.tar.gz Description: GNU Zip compressed data - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Border fails to render if its contents are not visible by default (WICKET-1789 ?)
igor: Thank you very much , it works ! BR -- smallufo 2009/2/5 Igor Vaynberg igor.vaynb...@gmail.com remove border.settransparentresolver(true); instead of add(listViewContainer.add(listView)); do border.add(listViewContainer.add(listView)); now your component hierarchy is proper, things are actually inside the border - which is how the border is meant to be used. your main problem was this line: listViewContainer.setVisible(defaultExpanded) ^ you never reset this to visible when the border is expanded, simply removing this line will work since you are now using the border there is a problem with component use check when it comes to doing this sort of visibility https://issues.apache.org/jira/browse/WICKET-2079 so simply disable it in your application.init() getDebugSettings().setComponentUseCheck(false); and now you have a working collapsible border. -igor
Re: In memoriam: Maurice Marrink
This is a big loss for wicket community. Maurice also helped me a lot . It's sad to hear this ... I am from Taiwan , English is not my native language , I cannot express how I appreciated his kindness. I'll remember him. Thank you , Maurice.
[1.3.5] Wicket POST leaks backend server with apache's mod_rewrite
I have a front apache server (httpd-2.0.52-41.ent.centos4) , with a backend db/servlet server (internal IP). I want to use apache's mod_rewrite to redirect the jsp/servlet/wicket requests to the backend server. So I add these lines in httpd.conf : IfModule mod_rewrite.c RewriteEngine On RewriteLogLevel 0 RewriteRule ^/app(.*) http://192.168.1.2:8080/app$1 [P] RewriteRule ^/jsp(.*) http://192.168.1.2:8080/webtools$1 [P] RewriteRule ^/servlet(.*) http://192.168.1.2:8080/servlet$1 [P] /IfModule /app rewrite wicket requests , /jsp rewrites JSP requests , and /servlet rewrites servlet requests The backend server is 192.168.1.2 , which runs Resin 3.2.1 , listens port 8080. With this setting , JSPs and servlets both works correctly. All GET/POST requests work like a charm , users don't know their JSP/servlet requests are redirected internally. BUT , things not work with wicket's requests (from url '/app' ) In wicket , GET request works OK , the URL is correct . but every POST request are redirected to http://192.168.1.2:8080/app/xx , which is not connectable from internet. How to solve it ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [1.3.5] Wicket POST leaks backend server with apache's mod_rewrite
Thank you I switched to use ProxyPass and ProxyPassReverse , achieving what I want : ProxyPass /app http://192.168.1.2:8080/app ProxyPassReverse /app http://192.168.1.2:8080/app - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamically insert/remove WizardSteps based on user input ?
Hi all : It seems the WizardSteps are added into WizardModel in the constructor time. I wonder if it is possible to dynamically insert/remove WizardSteps based on user input ? (wicket-1.3.6) Thanks a lot.
wicket 1.4 : Link with no model
Hi I am migrating my wicket 1.3 project to 1.4. One problem is this : Link personPageLink = new Link(personPageLink) { @Override public void onClick() { setResponsePage(PersonPage.class); } }; add(personPageLink); Because Link is generized , eclipse reports : - Link is a raw type. References to generic type LinkT should be parameterized but , this link doesn't bind any model , it is just a redirection. How do I parameterized this link ?
[1.4] override getObject() return type not the same with original model ?
Hi all I've already converted most of my code from 1.3 to 1.4 , except this situation : Label intToStringLabel = new Label(intToString , new PropertyModel(this , integer) { @Override public Object getObject() { int value = ((Integer) super.getObject()).intValue(); switch(value) { case 1: return one; case 2: return two; case 3: return three; } return ; } }); add(intToStringLabel); In the code , I want to output Integer of 1,2,3 to one , two and three In the code , PropertyModel is not parameterized , so I change to : new PropertyModelInteger(this , integer) and eclipse warns getObject() 's return type should be Integer But what I want to return is String , not Integer . This doesn't work. OK , then , I change my code to new PropertyModelString(this , integer) and eclipse warns ((Integer) super.getObject()).intValue(); Cannot cast from String to Integer. I don't know what else can I do , How to parameterize this situation ?
Re: [1.4] override getObject() return type not the same with original model ?
2009/11/18 Jeremy Thomerson jer...@wickettraining.com Well, you can't make a subclass a different parameterized type than it's parent. It won't work. You should be using an Integer model for this and using a converter rather than a nested model to make it a string. That's what converters are for. Hi , Do you mean AbstractConverter ? Is there any code snippet that demonstrates how to implement a Converter and hook it into a page ? Thanks a lot.
Re: [1.4] override getObject() return type not the same with original model ?
2009/11/19 Jeremy Thomerson jer...@wickettraining.com http://cwiki.apache.org/WICKET/using-custom-converters.html Thanks a lot , this solves my problem... But , there is a more complicated situation : Old code : (works in 1.3) ListView poem = new ListView(poem , new PropertyModel(model , poem) { @Override public Object getObject() { ListString result = new ArrayListString(); String poemString = (String) super.getObject(); StringTokenizer st = new StringTokenizer(poemString); while(st.hasMoreTokens()) result.add(st.nextToken()); return result; } }) { @Override protected void populateItem(ListItem listItem) { listItem.add(new Label(poemLine , listItem.getDefaultModelObjectAsString())); } }; add(poem); In the above code , it get poem ( a String ) from a PropertyModel , and convert it to ListString , and then render each String in the populateItem() method. I look into IConverter and AbstractConverter , both need to convert Object to String , not what I need ( ListString ) How should I solve this problem ?
[1.4.3] RequestUtils.toAbsolutePath() skips the last value
The code is following : WebApplication : mountBookmarkablePage(/TestPage , TestPage.class); TestPage.html : url = span wicket:id=url/span TestPage.java : final String url = RequestUtils.toAbsolutePath(); add(new Label(url , Model.of(url))); If I open http://foobar:8080/quickstart/app/TestPage it shows http://foobar:8080/quickstart/app/TestPage , correct if I open http://foobar:8080/quickstart/app/TestPage/a/b/ it shows : http://foobar:8080/quickstart/app/TestPage/a/b/ , correct BUT , if I open http://foobar:8080/quickstart/app/TestPage/a/b it shows : http://foobar:8080/quickstart/app/TestPage/a , WRONG
Re: [1.4.3] RequestUtils.toAbsolutePath() skips the last value
Hi , I opened WICKET-2586 https://issues.apache.org/jira/browse/WICKET-2586 https://issues.apache.org/jira/browse/WICKET-2586But it is reported invalid ... This is intended ... but I still don't know why ... 2009/11/30 Erik van Oosten e.vanoos...@grons.nl Hello Smallufo, Please open an issue on the Wicket jira so that the development team can track this bug. Regards, Erik. smallufo wrote: The code is following : WebApplication : mountBookmarkablePage(/TestPage , TestPage.class); TestPage.html : url = span wicket:id=url/span TestPage.java : final String url = RequestUtils.toAbsolutePath(); add(new Label(url , Model.of(url))); If I open http://foobar:8080/quickstart/app/TestPage it shows http://foobar:8080/quickstart/app/TestPage , correct if I open http://foobar:8080/quickstart/app/TestPage/a/b/ it shows : http://foobar:8080/quickstart/app/TestPage/a/b/ , correct BUT , if I open http://foobar:8080/quickstart/app/TestPage/a/b it shows : http://foobar:8080/quickstart/app/TestPage/a , WRONG -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to tackle Ajax Flooding
Wow , thanks for this great tip ... But I have problem applying to Gmap2 : I hope when user clicks the map , the map won't be able to receive any requests until the onClick() finishes... But it seems this doesn't work... Is there anything I missed ? gmap2.add(new ClickListener() { @Override protected void onClick(AjaxRequestTarget target, GLatLng latLng, GOverlay overlay) { // high computation ... } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { return new IAjaxCallDecorator() { @Override public CharSequence decorateScript(CharSequence script) { return this.enabled=false;+script; } @Override public CharSequence decorateOnSuccessScript(CharSequence script) { return script+;this.enabled=true;; } @Override public CharSequence decorateOnFailureScript(CharSequence script) { return script+;this.enabled=true;; } }; } }); 2009/8/31 Igor Vaynberg igor.vaynb...@gmail.com add(new ajaxbutton(button) { getajaxcalldecorator() { return new iajaxcalldecorator() { decoratescript(script) { return this.enabled=false;+script; } decorateonfailurescript(script) { return script+;this.enabled=true;;} decorateonsuccessscript(script) { return script+;this.enabled=true;;} } } } doesnt look like a lot of javascript to me. further you can factor it out into a separate class and reuse it all over the place. -igor On Mon, Aug 31, 2009 at 5:40 AM, Tom Wollerttom.woll...@googlemail.com wrote: The only idea I can come up with is to keep state of my model on client side, but that would require alot of javascript :/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How to replace Strings in JavaScript ?
Hello , I am using wicket 1.4.3 I wonder how to replace Strings in JavaScript ? such as : form input type=button value=Connect with Facebook onclick=window.open('http://www.facebook.com/login.php? api_key=278f76da30a86d0b5a2526a25c310166display=popupextern=1fbconnect=1req_perms=publish_streamreturn_session=1v=1.0 next=http%3A%2F%2Fwww.example.com %2Fconnect%2Fsuccess.htmlfb_connect=1 cancel_url=http%3A%2F%2Fwww.example.com%2Fconnect%2Fcancel.html', '_blank', 'top=442,width=480,height=460,resizable=yes', true) / /form Is it possible to replace api_key , next , and cancel_url in this script ? Thanks a lot .
Re: How to replace Strings in JavaScript ?
Hi , Thanks But where is class TextTemplateContributor ? I cannot grep that class ... I could only find wicket/util/template/TextTemplate ... 2009/12/17 Igor Vaynberg igor.vaynb...@gmail.com you can use something like TextTemplateContibutor -igor On Wed, Dec 16, 2009 at 11:21 AM, smallufo small...@gmail.com wrote: Hello , I am using wicket 1.4.3 I wonder how to replace Strings in JavaScript ? such as : form input type=button value=Connect with Facebook onclick=window.open('http://www.facebook.com/login.php? api_key=278f76da30a86d0b5a2526a25c310166display=popupextern=1fbconnect=1req_perms=publish_streamreturn_session=1v=1.0 next=http%3A%2F%2Fwww.example.com %2Fconnect%2Fsuccess.htmlfb_connect=1 cancel_url=http%3A%2F%2Fwww.example.com%2Fconnect%2Fcancel.html', '_blank', 'top=442,width=480,height=460,resizable=yes', true) / /form Is it possible to replace api_key , next , and cancel_url in this script ? Thanks a lot . - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Inject object to Wicket session by Servlet Filter , but : you can only locate or create sessions in the context of a request cycle
Hi all : I'm trying to inject something to the Wicket Session by a Generic Servlet Filter : public class UserFilter implements Filter { private UserDao UserDao; @Override public void init(FilterConfig config) throws ServletException { WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext()); UserDao = (UserDao) wac.getBean(userDao); } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { System.out.println(getClass().getName() + : UserDao = + UserDao); // ... blah... // do something , get user from cookie , authenticate cookie , and set it to Session // ... blah... MySession s = MySession.get(); // error occurs ! chain.doFilter(req, res); } It seems I cannot get Wicket's session outside wicket's request cycle. I searched and found WicketSessionFilter , but it seems it is for Retrieving objects from wicket's session , not for Filter to inject something to wicket's session... How to solve this problem ?
How to create Wicket's session and inject to Wicket's life cycle using Servlet Filter ?
2010/1/9 smallufo small...@gmail.com Hi all : I'm trying to inject something to the Wicket Session by a Generic Servlet Filter : public class UserFilter implements Filter { private UserDao UserDao; @Override public void init(FilterConfig config) throws ServletException { WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext()); UserDao = (UserDao) wac.getBean(userDao); } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { System.out.println(getClass().getName() + : UserDao = + UserDao); // ... blah... // do something , get user from cookie , authenticate cookie , and set it to Session // ... blah... MySession s = MySession.get(); // error occurs ! chain.doFilter(req, res); } It seems I cannot get Wicket's session outside wicket's request cycle. I searched and found WicketSessionFilter , but it seems it is for Retrieving objects from wicket's session , not for Filter to inject something to wicket's session... I've almost solve this problem by looking into org.apache.wicket.protocol.http.servlet.WicketSessionFilter , and implements my Filter : public class UserFilter implements Filter { private String sessionKey; private UserDao userDao; @Override public void init(FilterConfig config) throws ServletException { WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext()); userDao = (UserDao) wac.getBean(userDao); } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpServletRequest = ((HttpServletRequest)req); // create a httpSession if there is no session HttpSession httpSession = httpServletRequest.getSession(true); WebApplication application = (WebApplication)Application.get(MyApp); if (application != null) { sessionKey = application.getSessionAttributePrefix(null, MyApp) + Session.SESSION_ATTRIBUTE_NAME; //MySession extends WebSession MySession mySession = (MySession)httpSession.getAttribute(sessionKey); if (mySession != null) mySession.setUser(getUserFromCookies(httpServletRequest)); else { //No mySession , need to create a MySession and inject to httpSession MySession newSession = new MySession(application , ); // - How to get Request ? newSession.setUser(getUserFromCookies(httpServletRequest)); httpSession.setAttribute(sessionKey, newSession); } } chain.doFilter(req, res); } } The problem is : when there is no Wicket's session , how do I create a Wicket's session outside wicket's request cycle ? WebSession needs a org.apache.wicket.Request to construct , how do I get this Request in the filter ? Thanks a lot.
Re: How to create Wicket's session and inject to Wicket's life cycle using Servlet Filter ?
2010/1/10 Igor Vaynberg igor.vaynb...@gmail.com why not simply put whatever it is into the httpsession, and then write a getter in wicket's session that retrieves it from there? seems simpler. -igor Thank you . But how to get HttpSession inside Wicket's Session ? thanks ...
Re: How to create Wicket's session and inject to Wicket's life cycle using Servlet Filter ?
Thank you , I've found the answer : httpSession = ((ServletWebRequest)request).getHttpServletRequest().getSession(); This is a better way ... thanks a lot. 2010/1/10 smallufo small...@gmail.com 2010/1/10 Igor Vaynberg igor.vaynb...@gmail.com why not simply put whatever it is into the httpsession, and then write a getter in wicket's session that retrieves it from there? seems simpler. -igor Thank you . But how to get HttpSession inside Wicket's Session ? thanks ...
Any servlet filter- like WebRequest interceptor or filter ?
Hi : I wonder if wicket has any servletFilter-like WebRequest interceptor or filter ? That the interceptor can intercept WebRequest or HttpSession and pre-processing , and maybe redirect to some specified WebPage ... Thanks a lot.
Re: Any servlet filter- like WebRequest interceptor or filter ?
For example : A Wicket application may have many WebPages or Wizards which are inter-connected ... The interceptor(or filter , whatever called) can monitor the user's cookie , when some situation matches , he will be redirected to a specified page, after filling some forms , he will be redirect back to the original target page or wizard step... Is it possible in wicket ? 2010/1/11 smallufo small...@gmail.com Hi : I wonder if wicket has any servletFilter-like WebRequest interceptor or filter ? That the interceptor can intercept WebRequest or HttpSession and pre-processing , and maybe redirect to some specified WebPage ... Thanks a lot.
Re: Any servlet filter- like WebRequest interceptor or filter ?
Hi Do you mean override newRequestCycle() in WebApplication , and in the returning WebRequestCycle, override onBeginRequest() ? If so , how do I inject spring beans into Application ? The SpringComponentInjector is injected into Application in init() , but Spring beans is not available in this class. 2010/1/12 Igor Vaynberg igor.vaynb...@gmail.com requestcycle.onbeginrequest -igor On Mon, Jan 11, 2010 at 2:40 AM, smallufo small...@gmail.com wrote: For example : A Wicket application may have many WebPages or Wizards which are inter-connected ... The interceptor(or filter , whatever called) can monitor the user's cookie , when some situation matches , he will be redirected to a specified page, after filling some forms , he will be redirect back to the original target page or wizard step... Is it possible in wicket ? 2010/1/11 smallufo small...@gmail.com Hi : I wonder if wicket has any servletFilter-like WebRequest interceptor or filter ? That the interceptor can intercept WebRequest or HttpSession and pre-processing , and maybe redirect to some specified WebPage ... Thanks a lot. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any servlet filter- like WebRequest interceptor or filter ?
Wow , thanks replying so soon. I am just trying : public RequestCycle newRequestCycle(Request request, Response response) { ServletWebRequest servletWebRequest = (ServletWebRequest) request; HttpServletRequest hreq = servletWebRequest.getHttpServletRequest(); ServletContext context = hreq.getSession().getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(context); final UserDao userDao = (UserDao) wac.getBean(userDao); It works too , but it is much ugly... 2010/1/12 Stijn Maller stijn.mal...@gmail.com InjectorHolder.getInjector().inject(this);
Cannot get default invisible TextField's ModelObject ?
I have a form , which contains a radio button. When user clicks the radio button , a default-invisible textfield is set visible. But I cannot get the textfield's Model Object , it is null What's the problem ? Did I miss anything ?
Re: Cannot get default invisible TextField's ModelObject ?
To make it more clear : When the radio button is clicked , by implement AjaxEventBehavior(onClick) , a default-invisible WebMarkupContainer is set visible , The WebMarkupContainer contains other TextFields , which I cannot get their values at all I've stuck with this problems for half day , searching but found no anwser ... I need help Wicket 1.4.5 2010/1/21 smallufo small...@gmail.com I have a form , which contains a radio button. When user clicks the radio button , a default-invisible textfield is set visible. But I cannot get the textfield's Model Object , it is null What's the problem ? Did I miss anything ?
Re: Cannot get default invisible TextField's ModelObject ?
This is a full functional Page : I found this problem only occurs when the form is in the listView : If I move the form out of the listView , it works like a charm. Bug ? I am not sure... The link is the screen capture : http://xs.to/image-B859_4B57CDD0.gif MyPage.html table border=1 tr thname/th thmore ?/th /tr span wicket:id=listView form wicket:id=form tr td wicket:id=name[name]/td td span wicket:id=radioGroup input type=radio wicket:id=yes/yes input type=radio wicket:id=no/no /span /td /tr tr wicket:id=more td colspan=2 input type=text size=40 value=Please leave comments wicket:id=textfield/ input type=submit value=Submit wicket:id=submit/ /td /tr /form /span /table MyPage.java package quickstart.ajax; import java.util.ArrayList; import java.util.List; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.form.AjaxButton; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.Radio; import org.apache.wicket.markup.html.form.RadioGroup; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.model.Model; public class MyPage extends WebPage { private final static ListString names = new ArrayListString(); static { names.add(Andy); names.add(Brian); names.add(Carol); } public MyPage() { ListViewString listView = new ListViewString(listView , names) { @Override protected void populateItem(ListItemString item) { FormVoid form = new FormVoid(form); item.add(form); String name = item.getModelObject(); form.add(new Label(name , name)); final WebMarkupContainer more = new WebMarkupContainer(more); more.setVisible(false); more.setOutputMarkupPlaceholderTag(true); form.add(more); final RadioGroupBoolean radioGroup = new RadioGroupBoolean(radioGroup , Model.of(Boolean.FALSE)); form.add(radioGroup); RadioBoolean yes = new RadioBoolean(yes , Model.of(Boolean.TRUE)); RadioBoolean no = new RadioBoolean(no , Model.of(Boolean.FALSE)); radioGroup.add(yes); radioGroup.add(no); yes.add(new AjaxEventBehavior(onClick) { @Override protected void onEvent(AjaxRequestTarget target) { more.setVisible(true); target.addComponent(more); } }); no.add(new AjaxEventBehavior(onClick) { @Override protected void onEvent(AjaxRequestTarget target) { more.setVisible(false); target.addComponent(more); } }); final TextFieldString textfield = new TextFieldString(textfield , new ModelString()); more.add(textfield); AjaxButton button = new AjaxButton(submit) { @Override protected void onSubmit(AjaxRequestTarget arg0, Form? form) { System.out.println(radioGroup = + radioGroup.getModelObject() + , textfield.getModelObject() = + textfield.getModelObject()); } }; more.add(button); } }; add(listView); } }
Re: Cannot get default invisible TextField's ModelObject ?
Yes , indeed , if the form is in the second row (default invisible) , it works , But I cannot get the first row's data (such as radioGroup's model object will become null ). Moreover , Form with multiple row , with something visible and something extensible (default invisible), it is not so rare. If the form is not inside a ListView , it will work. But it just fails if it is inside a ListView. 2010/1/21 Chuck Brinkman chasb1...@gmail.com I stepped through the code and found that the convertedInput is null when processing submit. I didn't see anything that looked like an error message from wicket.I look forward to seeing what the wicket developers have to say. I'm just a new wicket user but was interested in this issue. I also found that if you make the following changes it will work. tr wicket:id=more td colspan=2 *form wicket:id=moreForm* input type=text size=40 value=Please leave comments wicket:id=textfield / input type=submit value=Submit wicket:id=submit / * /form* /td /tr *FormVoid moreForm = new FormVoid(moreForm); more.add(moreForm);* final TextFieldString textfield = new TextFieldString( textfield, new ModelString()); *moreForm*.add(textfield); AjaxButton button = new AjaxButton(submit) { @Override protected void onSubmit(AjaxRequestTarget arg0, Form? form) { System.out.println(radioGroup = + radioGroup.getModelObject() + , textfield.getModelObject() = + textfield.getModelObject()); } }; *moreForm*.add(button); On Wed, Jan 20, 2010 at 10:47 PM, smallufo small...@gmail.com wrote: This is a full functional Page : I found this problem only occurs when the form is in the listView : If I move the form out of the listView , it works like a charm. Bug ? I am not sure... The link is the screen capture : http://xs.to/image-B859_4B57CDD0.gif MyPage.html table border=1 tr thname/th thmore ?/th /tr span wicket:id=listView form wicket:id=form tr td wicket:id=name[name]/td td span wicket:id=radioGroup input type=radio wicket:id=yes/yes input type=radio wicket:id=no/no /span /td /tr tr wicket:id=more td colspan=2 input type=text size=40 value=Please leave comments wicket:id=textfield/ input type=submit value=Submit wicket:id=submit/ /td /tr /form /span /table MyPage.java package quickstart.ajax; import java.util.ArrayList; import java.util.List; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.form.AjaxButton; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.Radio; import org.apache.wicket.markup.html.form.RadioGroup; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.model.Model; public class MyPage extends WebPage { private final static ListString names = new ArrayListString(); static { names.add(Andy); names.add(Brian); names.add(Carol); } public MyPage() { ListViewString listView = new ListViewString(listView , names) { @Override protected void populateItem(ListItemString item) { FormVoid form = new FormVoid(form); item.add(form); String name = item.getModelObject(); form.add(new Label(name , name)); final WebMarkupContainer more = new WebMarkupContainer(more); more.setVisible(false); more.setOutputMarkupPlaceholderTag(true); form.add(more); final RadioGroupBoolean radioGroup = new RadioGroupBoolean(radioGroup , Model.of(Boolean.FALSE)); form.add(radioGroup); RadioBoolean yes = new RadioBoolean(yes , Model.of(Boolean.TRUE)); RadioBoolean no = new RadioBoolean(no , Model.of(Boolean.FALSE)); radioGroup.add(yes); radioGroup.add(no); yes.add(new AjaxEventBehavior(onClick) { @Override protected void onEvent(AjaxRequestTarget target
Re: Cannot get default invisible TextField's ModelObject ?
I think it is a bug , and already submitted to JIRA https://issues.apache.org/jira/browse/WICKET-2694 https://issues.apache.org/jira/browse/WICKET-2694 2010/1/21 Chuck Brinkman chasb1...@gmail.com I looked some more and found the following: When it works, with my modification, FormComponent.getInputAsArray tries to get parameters for the TextField named more:moreForm:textfield. I looked in the parameter map or the RequestFacade object and found these: wicket:interface, wicket:ignoreIfNotActive, random, more:moreForm:textfield, radioGroup and more:moreForm:submit. And it finds the TextField. The version that fails is looking for TextField named more:textfield. The RequestFacade object has: wicket:interface, wicket:ignoreIfNotActive, random, forma_hf_0, radioGroup and more:submit. Is there a problem with forma_hf_0? On Thu, Jan 21, 2010 at 7:35 AM, smallufo small...@gmail.com wrote: Yes , indeed , if the form is in the second row (default invisible) , it works , But I cannot get the first row's data (such as radioGroup's model object will become null ). Moreover , Form with multiple row , with something visible and something extensible (default invisible), it is not so rare. If the form is not inside a ListView , it will work. But it just fails if it is inside a ListView.
[Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
This is my code : String s1 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s1 = + s1); Link link = new AjaxFallbackLink(link) { @Override public void onClick(AjaxRequestTarget target) { final String s2 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s2 = + s2); } }; This is the result : s1 = http://foo.bar:8080/app/CurrentPage s2 = CurrentPage/foo/bar/para/meters String s1 is what I need , it has http://foo.bar:8080/app/; in the head of the string. But why s2 don't have host and context name (app) in the head ? It is inconsistent Is it possible to make it consistent with s1 ?
Re: RequestUtils.toAbsolutePath()'s bug ?
I don't know if this is related to WICKET-1599 : https://issues.apache.org/jira/browse/WICKET-1599 2008/5/7 smallufo small...@gmail.com Environment : Wicket 1.3.3 Suppose the following code in a bookmarkable page , say FirstPage : When user pushes an AJAX button , the page builds a bookmarkable link : MapString , Object parameterMap = new HashMapString , Object(); parameterMap.put(index , myObj.getIndex()); PageParameters pps = new PageParameters(parameterMap); String absUrl = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(SecondPage.class , pps).toString()); If the user navigates properly (by clicking links to the FirstPage) , the absUrl is correct : foobar/SecondPage/index/1/ after pre-adding http://; + req.getServerName() + contextPath + / , I can correctly build the (bookmarkable) link like this : http://www.foobar.com/app/foobar/SecondPage/index/1 BUT , if the user directly links to the FirstPage(copy / paste the FirstPage's url in the browser's url bar) , or clicks the SecondPage's link and back (by browser) , and pushes the AJAX button again... SOMETIMES , absUrl becomes : http://foobar/SecondPage/index/1/ , the preceding http://; is redundant !!! And , my bookmarkable link becomes : http://www.foobar.com/app/http://foobar/SecondPage/index/1 I can not successfully re-produce this error every time. but sometimes it just occurs . It seems it is a bug... PS : I know how to build a BookmarkablePageLink in the wicket way , But I have to do this for a special purpose.
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
I don't know if this is related to WICKET-1599 : https://issues.apache.org/jira/browse/WICKET-1599 2009/6/7 smallufo small...@gmail.com This is my code : String s1 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s1 = + s1); Link link = new AjaxFallbackLink(link) { @Override public void onClick(AjaxRequestTarget target) { final String s2 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s2 = + s2); } }; This is the result : s1 = http://foo.bar:8080/app/CurrentPage s2 = CurrentPage/foo/bar/para/meters String s1 is what I need , it has http://foo.bar:8080/app/; in the head of the string. But why s2 don't have host and context name (app) in the head ? It is inconsistent Is it possible to make it consistent with s1 ?
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
2009/6/7 Johan Compagner jcompag...@gmail.com can you debug and see what this returns for both situations? ((WebRequest)RequestCycle.*get*().getRequest()).getHttpServletRequest() .getRequestURL().toString() ok , here is my test : String a1 = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest().getRequestURL().toString(); System.out.println(a1 = + a1); String s1 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s1 = + s1); Link link = new AjaxFallbackLink(link) { @Override public void onClick(AjaxRequestTarget target) { String a2 = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest().getRequestURL().toString(); System.out.println(a2 = + a2); final String s2 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s2 = + s2); } }; a1 = http://foo.bar:8080/app/CurrentPage s1 = http://foo.bar:8080/app/CurrentPage a2 = http://foo.bar:8080/app/ s2 = http://CurrentPage/ a1 , s1 are correct , a2 , s2 are totally wrong.
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
I've attached a quickstart code , including error case , to WICKET-2312 https://issues.apache.org/jira/browse/WICKET-2312 I think the problem may come from bookmarkablePage parsing parameters... The CurrentPage is mounted to /CurrentPage by mountBookmarkablePage(/CurrentPage , CurrentPage.class); Test steps : Step 1: user browser to link to http://foo.bar:8080/quickstart/app/CurrentPage outer = http://foo.bar:8080/quickstart/app/CurrentPage inner = http://foo.bar:8080/quickstart/app/CurrentPage both are correct. But ... Step 2: Open browser to connect to : http://foo.bar:8080/quickstart/app/CurrentPage/key/value outer = http://foo.bar:8080/quickstart/app/CurrentPage/key/value/ inner = http://foo.bar:8080/CurrentPage/key/value/ outer is correct , but inner is wrong ! inner lacks of context(quickstart) and path(app) here.
[1.4.6] WicketURLDecoder - No current Application found - defaulting encoding to UTF-8
After upgrading to 1.4.6 , it always pops up this warning : WARN http.WicketURLDecoder - No current Application found - defaulting encoding to UTF-8 It is ok in 1.4.5 , but I don't know why it has such warning in 1.4.6 . How to get rid of it ? Thanks ...
Re: [1.4.6] WicketURLDecoder - No current Application found - defaulting encoding to UTF-8
2010/2/5 Igor Vaynberg igor.vaynb...@gmail.com disable it in your logging configuration -igor I tried a lot of configurations , but http.WicketURLDecoder's warning still pops up... log4j.rootLogger=INFO, console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d %-5p %C{2} - %m%n Then , I tried the following three configurations , but are all invalid , WicketURLDecoder's warning still pops up : log4j.logger.org.apache.wicket.protocol.http.WicketURLDecoder=OFF log4j.org.apache.wicket.protocol.http.WicketURLDecoder=OFF log4j.logger.org.apache.wicket.protocol.http.WicketURLDecoder=ERROR , console
[1.4.6] inconsistent setResponsePage behavior in AjaxButton , with 1.4.5
Suppose inside a BookmarkablePage which is mounted to CurrentPage , there is an AjaxButton , when clicked , it will setResponsePage(CurrentPage.class , pps) If a user is browsing http://foo.bar/app/CurrentPage/key/value , and submit the AjaxButton , In 1.4.5 , he will be redirect to http://foo.bar/app/CurrentPage/key/value , it is correct But in 1.4.6 , he will be redirect to http://foo.bar/app/CurrentPage/key/CurrentPage/key/value , it is WRONG I think it is related to wicket2312 patch.
Re: [1.4.6] inconsistent setResponsePage behavior in AjaxButton , with 1.4.5
I've submitted it to JIRA https://issues.apache.org/jira/browse/WICKET-2735 https://issues.apache.org/jira/browse/WICKET-2735 2010/2/10 smallufo small...@gmail.com Suppose inside a BookmarkablePage which is mounted to CurrentPage , there is an AjaxButton , when clicked , it will setResponsePage(CurrentPage.class , pps) If a user is browsing http://foo.bar/app/CurrentPage/key/value , and submit the AjaxButton , In 1.4.5 , he will be redirect to http://foo.bar/app/CurrentPage/key/value , it is correct But in 1.4.6 , he will be redirect to http://foo.bar/app/CurrentPage/key/CurrentPage/key/value , it is WRONG I think it is related to wicket2312 patch.
[1.4.6] NotSerializableException: java.nio.HeapCharBuffer
Hi I found a lot of NotSerializableException: java.nio.HeapCharBuffer when I try Wicket 1.4.6 + Resin 4.0.3 I've never seen this exception , is it the problem from Wicket ? Stacktrace : java.io.NotSerializableException: java.nio.HeapCharBuffer at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416) at org.apache.wicket.Component.writeObject(Component.java:4439) at sun.reflect.GeneratedMethodAccessor5608.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at
Inject Dao ( with JPA impl) into Wicket without Spring ?
Hi Is there any way to inject a DAO into Wicket without Spring ? ex : public interface PersonDao { some methods... } public class PersonDaoImpl implements PersonDao , Serializable { @PersistenceContext(unitName = data, type = PersistenceContextType.TRANSACTION) EntityManager entityManager; .. other method implementations ... } public class CurrentPage extends WebPage { @javax.inject.Inject PersonDao personDao; } It's not working , anybody know how to achieve this ? server : Resin 4.0.4
Re: Inject Dao ( with JPA impl) into Wicket without Spring ?
Is it possible to 'not' introduce any 3rd library / annotation to enable this feature ? Will a custom IComponentInstantiationListener be able to do this ? 2010/3/23 Igor Vaynberg igor.vaynb...@gmail.com something has to do the injection, if not spring you can try salve.googlecode.com or aspectj, etc -igor On Tue, Mar 23, 2010 at 8:20 AM, smallufo small...@gmail.com wrote: Hi Is there any way to inject a DAO into Wicket without Spring ? ex : public interface PersonDao { some methods... } public class PersonDaoImpl implements PersonDao , Serializable { @PersistenceContext(unitName = data, type = PersistenceContextType.TRANSACTION) EntityManager entityManager; .. other method implementations ... } public class CurrentPage extends WebPage { @javax.inject.Inject PersonDao personDao; } It's not working , anybody know how to achieve this ? server : Resin 4.0.4 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Inject Dao ( with JPA impl) into Wicket without Spring ?
I am just curious : I am trying Resin 4.0.4 , which natively supports JSR 330's @javax.inject.Inject . And I am able to inject the Dao to one Servlet without any problem : public class HelloServlet extends HttpServlet { @Inject private PersonDao personDao; // it will automatically create PersonDaoImpl (and inject PersistenceContext ) and inject to here. ... } Since WicketServlet is essentially a HttpServlet , there should be a way to intercept the injection when in a JSR-330-enabled container (like Resin 4 , JBoss , Glassfish v3) ... But I don't know how ... I think it will greatly reduce the webapp size (and memory footprint , probably) without spring. 2010/3/23 Major Péter majorpe...@sch.bme.hu I think yes, Wicket is already depending on cglib, so you could create something like this: http://fisheye6.atlassian.com/browse/wicket/branches/wicket-1.4.x/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java?r=HEAD or for non-spring code check out the wicketstuff javaee-inject project. Best Regards, Peter 2010-03-23 16:52 keltezéssel, smallufo Ãrta: Is it possible to 'not' introduce any 3rd library / annotation to enable this feature ? Will a custom IComponentInstantiationListener be able to do this ? 2010/3/23 Igor Vaynberg igor.vaynb...@gmail.com something has to do the injection, if not spring you can try salve.googlecode.com or aspectj, etc -igor On Tue, Mar 23, 2010 at 8:20 AM, smallufo small...@gmail.com wrote: Hi Is there any way to inject a DAO into Wicket without Spring ? ex : public interface PersonDao { some methods... } public class PersonDaoImpl implements PersonDao , Serializable { @PersistenceContext(unitName = data, type = PersistenceContextType.TRANSACTION) EntityManager entityManager; .. other method implementations ... } public class CurrentPage extends WebPage { @javax.inject.Inject PersonDao personDao; } It's not working , anybody know how to achieve this ? server : Resin 4.0.4 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Inject Dao ( with JPA impl) into Wicket without Spring ?
Thank you , I tried it , and it can successfully inject EntityManagerFactory into a WebPage , But it seems unable to inject EntityManager , is it because of some thread-safe limitation here ? 2010/3/23 Major Péter majorpe...@sch.bme.hu I think yes, Wicket is already depending on cglib, so you could create something like this: http://fisheye6.atlassian.com/browse/wicket/branches/wicket-1.4.x/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java?r=HEAD or for non-spring code check out the wicketstuff javaee-inject project. Best Regards, Peter
Re: Inject Dao ( with JPA impl) into Wicket without Spring ?
2010/3/24 smallufo small...@gmail.com Thank you , I tried it , and it can successfully inject EntityManagerFactory into a WebPage , But it seems unable to inject EntityManager , is it because of some thread-safe limitation here ? Sorry , I meant wicket-contrib-javaee here. 2010/3/23 Major Péter majorpe...@sch.bme.hu I think yes, Wicket is already depending on cglib, so you could create something like this: http://fisheye6.atlassian.com/browse/wicket/branches/wicket-1.4.x/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java?r=HEAD or for non-spring code check out the wicketstuff javaee-inject project. Best Regards, Peter
[wicketstuff-push] NPE when CometdService.initBayeux()
Hi , I am trying Wicketstuff-push with a small chat program , but encounter this problem : org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component [MarkupContainer [Component id = sayForm]] threw an exception at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:193) at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:158) at javax.servlet.http.HttpServlet.service(HttpServlet.java:96) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109) at destiny.webapp.filters.FilterUserAgent.doFilter(FilterUserAgent.java:29) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:88) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:88) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:88) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:88) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:183) at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:103) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:286) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:789) at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:660) at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:624) at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:575) at com.caucho.network.listen.TcpSocketLink$AcceptTask.doTask(TcpSocketLink.java:1183) at com.caucho.network.listen.TcpSocketLink$ConnectionReadTask.runThread(TcpSocketLink.java:1118) at com.caucho.network.listen.TcpSocketLink$AcceptTask.run(TcpSocketLink.java:1150) at com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:901) at com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:866) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182) ... 34 more Caused by: java.lang.NullPointerException at org.wicketstuff.push.cometd.CometdService.initBayeux(CometdService.java:184) at org.wicketstuff.push.cometd.CometdService.getBayeux(CometdService.java:161) at org.wicketstuff.push.cometd.CometdService.publish(CometdService.java:155) at destiny.wicket.chatroom.ChatPanel$SayForm.onSubmit(ChatPanel.java:603) at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1538) at org.apache.wicket.markup.html.form.Form.process(Form.java:934) at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:896) ... 39 more After tracing some code , it seems _bayeux cannot be initialized in CometdService.initBayeux() , and that's because it cannot find an attribute org.cometd.bayeux in ServletContext. But I didn't find any code that setAttribute(org.cometd.bayeux , something) in
[1.4.9] Ajax displayed label not compatible with IE6/7/8 if the label contains pre tag !
If a label is default invisible and is setVisible(true) in an AjaxButton.onSubmit() , and if that label containing prexxx/pre string, it will fail to render in IE 6/8 . IE6/8 report wicket-ajax.js has something wrong ... I don't have IE7 , but I think the result is the same : HTML form wicket:id=form input type=button value=failButton wicket:id=failButton / span wicket:id=failLabel/span /form Java Code : public class MainPage extends WebPage { private MultiLineLabel failLabel = new MultiLineLabel(failLabel); public MainPage() { failLabel.setVisible(false); failLabel.setOutputMarkupPlaceholderTag(true); FormVoid form = new FormVoid(form); add(form); form.add(failLabel); AjaxButton failButton = new AjaxButton(failButton) { @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { failLabel.setDefaultModel(new PropertyModelString(MainPage.this , failResult)); failLabel.setEscapeModelStrings(false); failLabel.setVisible(true); target.addComponent(failLabel); } }; form.add(failButton); } /** * Success in Firefox/Chrome , but fail in IE 6/8 (I don't have IE7) */ public String getFailResult() { return prefont color=\#ff\R/font/pre; } } In the code above , if I take away pre and /pre in getFailResult() , it works like a charm! I think it is a bug...
Re: [1.4.9] Ajax displayed label not compatible with IE6/7/8 if the label contains pre tag !
I have created a JIRA issue with quickstart file here : https://issues.apache.org/jira/browse/WICKET-2965 https://issues.apache.org/jira/browse/WICKET-2965 2010/7/26 smallufo small...@gmail.com HTML form wicket:id=form input type=button value=failButton wicket:id=failButton / span wicket:id=failLabel/span /form Java Code : public class MainPage extends WebPage { private MultiLineLabel failLabel = new MultiLineLabel(failLabel); public MainPage() { failLabel.setVisible(false); failLabel.setOutputMarkupPlaceholderTag(true); FormVoid form = new FormVoid(form); add(form); form.add(failLabel); AjaxButton failButton = new AjaxButton(failButton) { @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { failLabel.setDefaultModel(new PropertyModelString(MainPage.this , failResult)); failLabel.setEscapeModelStrings(false); failLabel.setVisible(true); target.addComponent(failLabel); } }; form.add(failButton); } /** * Success in Firefox/Chrome , but fail in IE 6/8 (I don't have IE7) */ public String getFailResult() { return prefont color=\#ff\R/font/pre; } } In the code above , if I take away pre and /pre in getFailResult() , it works like a charm! I think it is a bug...
Is it a good practice to use intern() in all ids ?
I am using a profiler to analyze an OOM heap-dump file , and find tons of duplicated Strings . These strings are mostly IDs of wicket components or PropertyModel's expression ... I wonder if it a good practice to intern() all these Strings ? such as : private final static String TIME_STR = time.intern(); add(new Label(TIME_STR , foobar));
How to get other page's localized messages ?
If I have two WebPages : Page1.java Page1.properties , which stores default value Page1_zh.properties , which stores Chinese translations And Page2.java How do I get Page1's specific localized message in Page2 ? I noticed the StringResourceModel , but it seems not what I want. StringResourceModel's constructor must pass a Component object , but I cannot new Page1 in Page2 Is there anything like : SomeModel(key , Page1.class) , so that I can get key bound to Page1 ? Thanks.
AjaxLink overridden by SimpleAttributeModifier(onclick)
If I want to add a simple 'onclick warning' to an AjaxLink , the ajax's behavior will be overridden by : ajaxLink.add( new SimpleAttributeModifier(onclick, return confirm('sure ?');)); How to avoid this ?
implicit key in PageParameter ?
Hi , I wonder how to build an implicit key when a Page is mountBookmarkablePage() ? Suppose I have a TagPage , that accepts a parameter : name , and if the TagPage is mounted to /tag prefix The url will look like : http://foobar.com/app/tag/name/abc I feel the name is redundant I hope I can achieve shorter url like this : http://foobar.com/app/tag/abc http://foobar.com/app/tag/other Is is possible ?
Re: implicit key in PageParameter ?
Hi , thanks . But it seems that IndexedParamUrlCodingStrategy only accepts integer parameters. I need String value ... 2010/12/1 Martin Grigorov mgrigo...@apache.org See Indexed** UrlCodingStrategies On Wed, Dec 1, 2010 at 11:52 AM, smallufo small...@gmail.com wrote: Hi , I wonder how to build an implicit key when a Page is mountBookmarkablePage() ? Suppose I have a TagPage , that accepts a parameter : name , and if the TagPage is mounted to /tag prefix The url will look like : http://foobar.com/app/tag/name/abc I feel the name is redundant I hope I can achieve shorter url like this : http://foobar.com/app/tag/abc http://foobar.com/app/tag/other Is is possible ?
Re: implicit key in PageParameter ?
Hi I found the solution , it is MixedParamUrlCodingStrategy Thanks. 2010/12/1 smallufo small...@gmail.com Hi , thanks . But it seems that IndexedParamUrlCodingStrategy only accepts integer parameters. I need String value ... 2010/12/1 Martin Grigorov mgrigo...@apache.org See Indexed** UrlCodingStrategies On Wed, Dec 1, 2010 at 11:52 AM, smallufo small...@gmail.com wrote: Hi , I wonder how to build an implicit key when a Page is mountBookmarkablePage() ? Suppose I have a TagPage , that accepts a parameter : name , and if the TagPage is mounted to /tag prefix The url will look like : http://foobar.com/app/tag/name/abc I feel the name is redundant I hope I can achieve shorter url like this : http://foobar.com/app/tag/abc http://foobar.com/app/tag/other Is is possible ?
How to I get an un-proxied Spring Bean ?
I have a page with such definition : public class CrudPageT extends Serializable extends WebPage { public CrudPage(PageParameters pps , AbstractDaoT dao) {...} } and here is how I initialize the page : CrudPageUser page = new CrudPageUser(pps , userDao); the userDao is a Spring injected DAO : @SpringBean private UserDao userDao; And in fact , UserDao extends Abstract Dao Pattern : public interface UserDao extends AbstractDaoUser {...} Here comes the problem : I want to know which type is passed to CrudPage , I use the code : ParameterizedType genericSuperclass = (ParameterizedType) dao.getClass().getGenericSuperclass(); this.clazz = (ClassT) genericSuperclass.getActualTypeArguments()[0]; But it throws exception : java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType I then print the type : System.out.println(dao.getClass() = + dao.getClass()); System.out.println(dao.getClass().getGenericSuperclass() = + dao.getClass().getGenericSuperclass()); and found the dao is proxied : dao.getClass() = class org.apache.wicket.proxy.$Proxy101 dao.getClass().getGenericSuperclass() = class java.lang.reflect.Proxy Maybe that's why I cannot get the type ... And ... how to solve the problem ? Thanks a lot !
Re: How to I get an un-proxied Spring Bean ?
Hi , I tried : dao.getClass() = class org.apache.wicket.proxy.$Proxy101 dao.getClass().getGenericSuperclass() = class java.lang.reflect.Proxy dao.getClass().getSuperclass() = class java.lang.reflect.Proxy But still unable to get the dao class 2010/12/14 Pedro Santos pedros...@gmail.com proxyClass.getSuperclass() gives you the dao type
How to programmatically get PlatformTransactionManager of a DAO ?
I am developing a generic CRUD app , that can edit any Spring/JPA entities with a AbstractDao pattern's implementation , such as UserDaoImpl , ForumDaoImpl ...etc In my wicket page : I have to use @SpringBean to identify which PlatformTransactionManager to use , such as : @SpringBean(name=transactionManagerUser) private PlatformTransactionManager transactionManagerUser; private TransactionTemplate txTemplate; public CrudPage(final PageParameters pps , final AbstractDaoT dao) { super(pps); txTemplate= new TransactionTemplate(transactionManagerUser); } The problem is , these DAOs are using different transaction managers , such astransactionManagerUser , transactionManagerForum ...etc. I cannot hard-code these txManager's name in my code. I have to programmatically get the dao's txManager . How to achieve that ? Thanks a lot ! Environments : Spring 3.0.5 , Hibernate-3.6 , JPA2
Re: How to programmatically get PlatformTransactionManager of a DAO ?
Thanks. but declarative txManagement add a lot of complexity to XMLs Is there any other option ? 2010/12/19 James Carman ja...@carmanconsulting.com declarative transaction management
ResourceReference.getResource() returns NULL ?
I want to build a DynamicImageResource which can scale internal (packaged) images (with name : {index}.gif ) . In getImageData() , I try to load a truly existing image , but cannot getResource() , it returns null ! Here is my code : public class ScaledImageResource extends DynamicImageResource { private ThreadLocalInteger index = new ThreadLocalInteger(); private ThreadLocalInteger width = new ThreadLocalInteger(); private ThreadLocalInteger height = new ThreadLocalInteger(); @Override public IResourceStream getResourceStream() { ValueMap map = getParameters(); index .set(map.getAsInteger(index , 1)); width .set(map.getAsInteger(width , 50)); height.set(map.getAsInteger(height, 50)); return super.getResourceStream(); } @Override protected byte[] getImageData() { ResourceReference imageResource = new ResourceReference(MyPage.class , icons/byIndex/+index.get()+.gif); http://foobar.com/app/resources/foo.bar.MyPage/icons/byIndex/1.gif does exist ! try { System.out.println(imageResource.getResource() = + imageResource.getResource()); // returns NULL InputStream is = imageResource.getResource().getResourceStream().getInputStream(); BufferedImage bufferedImage = ImageIO.read(is); BufferedImage scaledImage = BufferedImageTools.getImage(bufferedImage, width.get() , height.get()); byte[] bytes = null; //scale image , build bytes , skipped here. return bytes; } catch (Exception e) { } return null; } } And in Application's init(): getSharedResources().add(IMG_KEY, new ScaledImageResource()); mountSharedResource(/scaledImage, new ResourceReference(IMG_KEY).getSharedResourceKey()); Note , the image file does exist there , and http://foobar.com/app/resources/foo.bar.MyPage/icons/byIndex/1.gif does browsable ! But why cannot I getResource() of the imageResource ?
wicket:link changes behavior from 1.4.15 to 1.4.19 ?
wicket:linkimg src=../icons/facebookLogin_300_35.png border=0/ /wicket:link This code works fine in wicket 1.4.15 , and will generate a url like this : http://foobar.com/app/resources/foobar.login.LoginPanel/null/icons/facebookLogin_300_35.png The null in URL seems represents .. in the resource path. But when I upgrade to 1.4.19 , the URL becomes : http://foobar.com/app/resources/icons/facebookLogin_300_35.png It is broken !!! Why ? And ... how to fix it ? (without hardcode the path in java code)
Re: wicket:link changes behavior from 1.4.15 to 1.4.19 ?
sorry for disturbance after adding the 2 lines in Application , it's solved. getResourceSettings().setParentFolderPlaceholder($up$); getResourceSettings().addResourceFolder(getServletContext().getContextPath ()); 2012/2/12 smallufo small...@gmail.com wicket:linkimg src=../icons/facebookLogin_300_35.png border=0/ /wicket:link This code works fine in wicket 1.4.15 , and will generate a url like this : http://foobar.com/app/resources/foobar.login.LoginPanel/null/icons/facebookLogin_300_35.png The null in URL seems represents .. in the resource path. But when I upgrade to 1.4.19 , the URL becomes : http://foobar.com/app/resources/icons/facebookLogin_300_35.png It is broken !!! Why ? And ... how to fix it ? (without hardcode the path in java code)
[6.7] How to set header of DynamicImageResource ?
Hi : I wonder how to set header of DynamicImageResource ? In 1.4 , it just override setHeaders(WebResponse response) { response.setHeader(Cache-Control , no-cache); } But , how to do this in 6.7 ? If I override setResponseHeaders(ResourceResponse data , Attributes attributes) , It seems there are two ways to setHeader : data.getHeaders().addHeader(Cache-Control, no-cache); and ((WebResponse) attributes.getResponse()).addHeader(Cache-Control , no-cache); Which is correct ? And... in 1.4 , there is an isCacheable() method , where is it in 6.7 ? Thanks .
Re: [6.7] How to set header of DynamicImageResource ?
Hi I just take Cache-Control:no-cache for example. What if I want to add additional header information, which is correct ? data.getHeaders().addHeader(key, value); ? or ((WebResponse) attributes.getResponse()).addHeader(key , value); ? Thanks.
How to get rid of -ver-blah-blah-blah.gif versioning ?
I am upgrading from 1.4 to 6.7 Is the random string appended used for anti-caching or object versioning ? I try to redeploy and the appended string is identical !? Now I am stuck by how to get rid of image/resource versioning , and enable caching ... I use general Image , or override shouldAddAntiCacheParameter (return false) But I still cannot get rid of the versioning string... Anyway to disable that ? One more question wicket:linkimg src=xxx.png/wicket:link How to enable caching and disable versioning string for this img ? (there is no wicket:id assigned)
Re: How to get rid of -ver-blah-blah-blah.gif versioning ?
Hi thanks. But it doesn't mention how to turn off the -ver-blah-blah-blah string. I just want a general xxx.png , not xxx-ver-7E49549BCE322EACE0C8F26B4CD553C5.png 2013/5/2 Martin Grigorov mgrigo...@apache.org Hi, Check https://cwiki.apache.org/WICKET/caching-in-wicket-15.html On Wed, May 1, 2013 at 6:36 PM, smallufo small...@gmail.com wrote: I am upgrading from 1.4 to 6.7 Is the random string appended used for anti-caching or object versioning ? I try to redeploy and the appended string is identical !? Now I am stuck by how to get rid of image/resource versioning , and enable caching ... I use general Image , or override shouldAddAntiCacheParameter (return false) But I still cannot get rid of the versioning string... Anyway to disable that ? One more question wicket:linkimg src=xxx.png/wicket:link How to enable caching and disable versioning string for this img ? (there is no wicket:id assigned) -- Martin Grigorov Wicket Training Consulting http://jWeekend.com http://jweekend.com/
[wicket 6] How to get InputStream from ResourceReference ?
In wicket 1.4 I can get InputStream from a ResourceReference : ResourceReference resRef = new ResourceReference(Page.class , xxx.png); InputStream is = resRef.getResource().getResourceStream().getInputStream(); But it seems invalid in wicket 6 I need to build a DynamicImageResource , which returns byte[] in getImageData() ResourceReference resRef = new PackageResourceReference(Page.class , xxx.png); (in fact , the true resRef depends on the attributes parameter) but I am stuck here. I find no way to get InputStream of resRef , so I cannot transform InputStream to byte[]. Any solutions ? Thanks !
Re: [wicket 6] How to get InputStream from ResourceReference ?
2013/5/2 Martin Grigorov mgrigo...@apache.org PackageResourceStream Wow , thanks for your rapid response !
[wicket 6] Modal unable to see page's properties anymore ?
I have a LoginModal which binds a LoginPage . In LoginModal.setWindowClosedCallback() method , I use LoginPage.isSuccessful() to judge if the user login successful. If login successful , I refresh the page , or do nothing. LoginModal code : http://pastebin.com/nLU2akzV LoginPage code : http://pastebin.com/PqfLwsNg It works in wicket 1.4 , but failed in wicket 6 In LoginPage , I can see user correctly login , and the successful = true is set. But LoginModal can only see the old successful value (which is FALSE). No matter I read the property (isSuccessful() ) or through reflection PropertyModel : boolean successful = (new PropertyModelBoolean(loginPage, successful)). getObject().booleanValue(); It just returns FALSE. I notice it may be page serialization problem introduced in wicket 1.5 . My page has an integer attached , such as /app/?1 , no matter how I refresh the page , I just see the LoginPage's isSuccessful is FALSE. But if I manually browse /app/ (no trailing integer) , the user is logged in. (I set something in the httpSession in LoginPage) I searched the maillist , try to override *isVersioned() and return false*, but everything is the same How to solve the problem , making LoginModal able to see LoginPage's latest property ? Thanks !
Re: [wicket 6] Modal unable to see page's properties anymore ?
Hi , I found no IPageReference class . If you mean PageReference , I finally found the solution: http://pastebin.com/bes3H9w3 Though the solution seems not so intuitional compared to wicket 1.4 2013/5/7 Martin Grigorov mgrigo...@apache.org Hi, You should not keep references to other page instances. Instead pass IPageReference: page.getPageReference(). Later you can do: MyPage page = (MyPage) pageRef.getPage(); page.setXyz(); But in your case I think you should use the Session. If the login is successful then bind a session and set the flag. Then redirect to LoginPage and in its constructor check whether there is a session, and whether the flag is set and redirect to the post-login page. On Tue, May 7, 2013 at 4:03 AM, smallufo small...@gmail.com wrote: I have a LoginModal which binds a LoginPage . In LoginModal.setWindowClosedCallback() method , I use LoginPage.isSuccessful() to judge if the user login successful. If login successful , I refresh the page , or do nothing. LoginModal code : http://pastebin.com/nLU2akzV LoginPage code : http://pastebin.com/PqfLwsNg It works in wicket 1.4 , but failed in wicket 6 In LoginPage , I can see user correctly login , and the successful = true is set. But LoginModal can only see the old successful value (which is FALSE). No matter I read the property (isSuccessful() ) or through reflection PropertyModel : boolean successful = (new PropertyModelBoolean(loginPage, successful)). getObject().booleanValue(); It just returns FALSE. I notice it may be page serialization problem introduced in wicket 1.5 . My page has an integer attached , such as /app/?1 , no matter how I refresh the page , I just see the LoginPage's isSuccessful is FALSE. But if I manually browse /app/ (no trailing integer) , the user is logged in. (I set something in the httpSession in LoginPage) I searched the maillist , try to override *isVersioned() and return false*, but everything is the same How to solve the problem , making LoginModal able to see LoginPage's latest property ? Thanks ! -- Martin Grigorov Wicket Training Consulting http://jWeekend.com http://jweekend.com/
[wicket 6] javascript confirmation via onPrecondition failed.
I want to add a warning dialog when user clicks an ajax deleteLink I saw the following solution: LinkVoid deleteLink = new AjaxFallbackLinkVoid(deleteLink) { @Override public void onClick(AjaxRequestTarget target) { commentService.deleteComment(user, comment, ip); setResponsePage(CommentsPage.class , pps); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener(); ajaxCallListener.onPrecondition(return confirm('Are you sure?');); attributes.getAjaxCallListeners().add(ajaxCallListener); } }; add(deleteLink); It did popup a warning box , display Are you sure? But no matter user clicks OK or Cancel The comment get deleted ! What's wrong here ? Thanks. (wicket 6.7)
[wicket 6] Create/Register Spring Bean in wicket ?
Hi , I wonder if it possible to programmatically create / register a spring bean in wicket? maybe in Application.init() ... Most documents about spring are making use of existent beans , and inject to WebPage or Panel via @SpringBean , and it indeed works well. But my interface implementations are depend on wicket-component , such as getting absolute URL of a page or a DynamicImageResource So these beans should be initialized and register to Spring in init() (correct me if I am wrong) Any way to achieve this ? Thanks. (I am using wicket 6.7 )
Re: [wicket 6] Create/Register Spring Bean in wicket ?
Hi Is there any code example to create beans and register to spring ? I can get ApplicationContext by WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); but there is no setter or register or createBean methods within... Or use of factory bean ? I searched FactoryBean , got the idea behind it . But I still don't know how to do it in wicket ? Thanks. 2013/5/11 Igor Vaynberg igor.vaynb...@gmail.com see spring's FactoryBean, its an indirect way to create beans. -igor On Fri, May 10, 2013 at 12:33 PM, smallufo small...@gmail.com wrote: Hi , I wonder if it possible to programmatically create / register a spring bean in wicket? maybe in Application.init() ... Most documents about spring are making use of existent beans , and inject to WebPage or Panel via @SpringBean , and it indeed works well. But my interface implementations are depend on wicket-component , such as getting absolute URL of a page or a DynamicImageResource So these beans should be initialized and register to Spring in init() (correct me if I am wrong) Any way to achieve this ? Thanks. (I am using wicket 6.7 ) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [wicket 6] Create/Register Spring Bean in wicket ?
I try to do this in init() : ctx.getAutowireCapableBeanFactory().configureBean(obj, myobj); or ctx.getAutowireCapableBeanFactory().applyBeanPostProcessorsAfterInitialization(obj, myobj); or ctx.getAutowireCapableBeanFactory().applyBeanPostProcessorsBeforeInitialization(obj, myobj); But in a WebPage with a @SpringBean(name=myobj) private IMyObj myobj; I still get NoSuchBeanDefinitionException error ... 2013/5/11 smallufo small...@gmail.com Hi Is there any code example to create beans and register to spring ? I can get ApplicationContext by WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); but there is no setter or register or createBean methods within... Or use of factory bean ? I searched FactoryBean , got the idea behind it . But I still don't know how to do it in wicket ? Thanks. 2013/5/11 Igor Vaynberg igor.vaynb...@gmail.com see spring's FactoryBean, its an indirect way to create beans. -igor On Fri, May 10, 2013 at 12:33 PM, smallufo small...@gmail.com wrote: Hi , I wonder if it possible to programmatically create / register a spring bean in wicket? maybe in Application.init() ... Most documents about spring are making use of existent beans , and inject to WebPage or Panel via @SpringBean , and it indeed works well. But my interface implementations are depend on wicket-component , such as getting absolute URL of a page or a DynamicImageResource So these beans should be initialized and register to Spring in init() (correct me if I am wrong) Any way to achieve this ? Thanks. (I am using wicket 6.7 ) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [wicket 6] Create/Register Spring Bean in wicket ?
2013/5/11 Marco Springer ma...@glitchbox.nl Maybe this is too simple but: Did you define this bean in the applicationContext.xml?: bean id=myobj class={impl. class}{possible properties}/bean No this is not what I want. The whole story is ... I have two maven repositories : One is *business-layer* , which defines whole business objects , service layers , and make use of SpringConfig and package scan to build a lot of beans . Another is *wicket-layer* , which depends on business-layer , and makes use of beans scanned in the business-layer and serve the web. The problem is : All the beans are defined ( package scanned ) in the business-layer. There is no spring's xml or spring's @Repository class or SpringConfig settings in the wicket-layer. But I have some idea of implementing some interface which depends on wicket's library. Such as getting absolute url of a DynamicImageReference or a PackageResourceReference , which depends on RequestCycle and wicket's components. I wonder how to programmatically generate such bean and inject to the spring ? class MyApplication extends WebApplication { @SpringBean dao; // defined in business-layer , and injected successfully. public init () { getComponentInstantiationListeners().add(new SpringComponentInjector(this)); Injector.get().inject(this); *URLGetter urlGetter = new URLGetterDynImgRefImpl(dao);* // How to inject this urlGetter to spring ? } } In the above code , how to inject the urlGetter object to Spring ? so that other wicket WebPage or Panel can use @SpringBean(name=urlGetter) to get the object ? Thanks.
Re: [wicket 6] Create/Register Spring Bean in wicket ?
I solve this problem by introducing another spring's xml inside wicket's repository, which I didn't want to do this at first. (I was looking for a programmatic way , but it seems not so easy... ) 2013/5/11 smallufo small...@gmail.com 2013/5/11 Marco Springer ma...@glitchbox.nl Maybe this is too simple but: Did you define this bean in the applicationContext.xml?: bean id=myobj class={impl. class}{possible properties}/bean No this is not what I want. The whole story is ... I have two maven repositories : One is *business-layer* , which defines whole business objects , service layers , and make use of SpringConfig and package scan to build a lot of beans . Another is *wicket-layer* , which depends on business-layer , and makes use of beans scanned in the business-layer and serve the web. The problem is : All the beans are defined ( package scanned ) in the business-layer. There is no spring's xml or spring's @Repository class or SpringConfig settings in the wicket-layer. But I have some idea of implementing some interface which depends on wicket's library. Such as getting absolute url of a DynamicImageReference or a PackageResourceReference , which depends on RequestCycle and wicket's components. I wonder how to programmatically generate such bean and inject to the spring ? class MyApplication extends WebApplication { @SpringBean dao; // defined in business-layer , and injected successfully. public init () { getComponentInstantiationListeners().add(new SpringComponentInjector(this)); Injector.get().inject(this); *URLGetter urlGetter = new URLGetterDynImgRefImpl(dao);* // How to inject this urlGetter to spring ? } } In the above code , how to inject the urlGetter object to Spring ? so that other wicket WebPage or Panel can use @SpringBean(name=urlGetter) to get the object ? Thanks.
Deserialization InvalidClassException : no valid constructor
Today I encountered one famous deserialization problem : InvalidClassException : no valid constructor I googled and found some solution , but all are in-vain. The solution says the first non-serializable super class should define a no-arg constructor. But I try to define a no-arg constructor to EACH class of the HIERARCHY , and EACH class implements Serializable... (which is not necessary , but I want to make it simple , to pinpoint the problem) My base class is an abstract class extends BufferedImage (java 2D) while BufferedImage is not Serializable So I make my abstract class implements Serializable and define a no-arg default constructor. The total hierarchy is : public abstract class AbstractChart extends BufferedImage implements Serializable { public AbstractChart() {// I try to remove this constructor , but in vain super(0 , 0, TYPE_INT_ARGB); } } and first child class : public class ChildChart extends AbstractChart implements Serializable { public ChildChart() { super(); // or not calling super() } } and the grandson class : public class GrandsonChart extends ChildChart implements Serializable { public GrandsonChart() { super(); // or not calling super() } } No matter I calls super() in ChildChart or GrandsonChart , Caused by: java.io.InvalidClassException: foobar.GrandsonChart; no valid constructor It happens when I click a button ,use ajax to paint this GrandsonChart , and click another page , and use browser back . The browser will be redirected to /context/wicket/page?xxx (The error page) The screen shows : Could not deserialize object using: class org.apache.wicket.serialize.java.JavaSerializer$ClassResolverObjectInputStream and in the console log , I can see this InvalidClassException is thrown. Any way to solve this problem ? (I've already added default no-arg constructor , and make each class implements Serializable , but still not working ) environment : Wicket version : 6.7 Resin 4.0.25 Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402, 64, mixed mode, Apple Inc (It happens on Linux JDK too)
Re: Deserialization InvalidClassException : no valid constructor
Thanks. But in my example , I cannot modify BufferedImage (to add a no-arg constructor) What should I do if I want to output a BufferedImage (and make back button work) ? 2013/5/14 Jonas barney...@gmail.com This could only work if BufferedImage itself had a no-arg constructor. It is it the first non-serializable class in the hierarchy that needs to have it, not the first serializable one, like in your example. Besides, you would still lose all data stored in the BufferedImage's fields (i.e. the image stored in it). On Mon, May 13, 2013 at 7:15 PM, smallufo small...@gmail.com wrote: Today I encountered one famous deserialization problem : InvalidClassException : no valid constructor I googled and found some solution , but all are in-vain. The solution says the first non-serializable super class should define a no-arg constructor. But I try to define a no-arg constructor to EACH class of the HIERARCHY , and EACH class implements Serializable... (which is not necessary , but I want to make it simple , to pinpoint the problem) My base class is an abstract class extends BufferedImage (java 2D) while BufferedImage is not Serializable So I make my abstract class implements Serializable and define a no-arg default constructor. The total hierarchy is : public abstract class AbstractChart extends BufferedImage implements Serializable { public AbstractChart() {// I try to remove this constructor , but in vain super(0 , 0, TYPE_INT_ARGB); } } and first child class : public class ChildChart extends AbstractChart implements Serializable { public ChildChart() { super(); // or not calling super() } } and the grandson class : public class GrandsonChart extends ChildChart implements Serializable { public GrandsonChart() { super(); // or not calling super() } } No matter I calls super() in ChildChart or GrandsonChart , Caused by: java.io.InvalidClassException: foobar.GrandsonChart; no valid constructor It happens when I click a button ,use ajax to paint this GrandsonChart , and click another page , and use browser back . The browser will be redirected to /context/wicket/page?xxx (The error page) The screen shows : Could not deserialize object using: class org.apache.wicket.serialize.java.JavaSerializer$ClassResolverObjectInputStream and in the console log , I can see this InvalidClassException is thrown. Any way to solve this problem ? (I've already added default no-arg constructor , and make each class implements Serializable , but still not working ) environment : Wicket version : 6.7 Resin 4.0.25 Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402, 64, mixed mode, Apple Inc (It happens on Linux JDK too)
Re: Deserialization InvalidClassException : no valid constructor
I solve this problem by making the BufferedImage transient. 2013/5/27 Jonas barney...@gmail.com Well, you can't serialize the BufferedImage, but maybe you can serialize whatever data you've used to render BufferedImage's contents, i.e. instead of saving the image, save whatever is necessary to recreate the image? Or, you could store the BufferedImage's content to an actual image file (using ImageIO)? On Wed, May 22, 2013 at 5:39 AM, smallufo small...@gmail.com wrote: Thanks. But in my example , I cannot modify BufferedImage (to add a no-arg constructor) What should I do if I want to output a BufferedImage (and make back button work) ? 2013/5/14 Jonas barney...@gmail.com This could only work if BufferedImage itself had a no-arg constructor. It is it the first non-serializable class in the hierarchy that needs to have it, not the first serializable one, like in your example. Besides, you would still lose all data stored in the BufferedImage's fields (i.e. the image stored in it). On Mon, May 13, 2013 at 7:15 PM, smallufo small...@gmail.com wrote: Today I encountered one famous deserialization problem : InvalidClassException : no valid constructor I googled and found some solution , but all are in-vain. The solution says the first non-serializable super class should define a no-arg constructor. But I try to define a no-arg constructor to EACH class of the HIERARCHY , and EACH class implements Serializable... (which is not necessary , but I want to make it simple , to pinpoint the problem) My base class is an abstract class extends BufferedImage (java 2D) while BufferedImage is not Serializable So I make my abstract class implements Serializable and define a no-arg default constructor. The total hierarchy is : public abstract class AbstractChart extends BufferedImage implements Serializable { public AbstractChart() {// I try to remove this constructor , but in vain super(0 , 0, TYPE_INT_ARGB); } } and first child class : public class ChildChart extends AbstractChart implements Serializable { public ChildChart() { super(); // or not calling super() } } and the grandson class : public class GrandsonChart extends ChildChart implements Serializable { public GrandsonChart() { super(); // or not calling super() } } No matter I calls super() in ChildChart or GrandsonChart , Caused by: java.io.InvalidClassException: foobar.GrandsonChart; no valid constructor It happens when I click a button ,use ajax to paint this GrandsonChart , and click another page , and use browser back . The browser will be redirected to /context/wicket/page?xxx (The error page) The screen shows : Could not deserialize object using: class org.apache.wicket.serialize.java.JavaSerializer$ClassResolverObjectInputStream and in the console log , I can see this InvalidClassException is thrown. Any way to solve this problem ? (I've already added default no-arg constructor , and make each class implements Serializable , but still not working ) environment : Wicket version : 6.7 Resin 4.0.25 Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402, 64, mixed mode, Apple Inc (It happens on Linux JDK too)
Fragment(String,String) is deprecated ?
In 1.3 rc2 , I found Fragment(String,String) is deprecated . I see the src, saying : @deprecated use [EMAIL PROTECTED] #Fragment(String, String, MarkupContainer)} But I don't know what should I fill in the MarkupContainer . ... ? span wicket:id=myPanelExample input (will be removed)/span wicket:fragment wicket:id=frag1panel 1/wicket:fragment wicket:fragment wicket:id=frag2panel 2/wicket:fragment add(new Fragment(myPanel1, frag1); Just like this easy example above (in the JavaDoc) , what is the recommended way in 1.3 ?
FormComponentPanel and setConvertedInput()
Hi , I am evaluating FormComponentPanel . I looked into the document , it seems setConvertedInput() is the proper way . I use another method , which skips the setConvertedInput() , I don't know if it is suggested : Here is the code : public class TimePanel extends FormComponentPanel { private Time time; public TimePanel(String id , Time time ) { super(id); this.time = time; add(new CheckBox(beforeChrist , new PropertyModel(time , beforeChrist))); add(new TextField(year , new PropertyModel(time , year))); add(new TextField(month , new PropertyModel(time , month))); add(new TextField(day , new PropertyModel(time , day))); add(new TextField(hour , new PropertyModel(time , hour))); add(new TextField(minute , new PropertyModel(time , minute))); add(new TextField(second , new PropertyModel(time , second))); } } I embed this TimePanel to a form : Time time = new Time(); //my custom Time class add(new TimePanel(timePanel , time)); add(new Button(button) { @Override public void onSubmit() { System.out.println(time = + time); } }); It works . It seems by this way , I can skip implementing setConvertedInput() , right ? Is there any drawback ? Is this a suggested way ?
How to get a form component's value that is not a sub-node of the Form.
I have a Form component : SomeCheckGroup added to a SomePanel. For screen arrangement purpose , this SomePanel is not a sub-node of the Form , it's outside of the Form . It looks like this : OutmostPanel add FormPanel FormPanel add MainForm MainForm add other form components OutmostPanel add SomePanel SomePanel add SomeCheckGroup1 SomePanel add SomeCheckGroup2 SomePanel add SomeCheckGroup3 ... How do I get the value of SomeCheckGroup when MainForm submit() ? Now , I could only use AjaxCheckBox in SomeCheckGroup to update the MainForm's model , but sometimes , it seems maybe network delay problem , cause some synchronized problem , which set null to the form's model , it's hard to debug , and I feel it is bandwidth consumptive... But I cannot find a way to not using AJAX and notify the checkGroup latest model to MainForm's model . Can somebody give me a hint . Thanks in advanced.
Re: How to get a form component's value that is not a sub-node of the Form.
Can you specify details more precisely ? According to http://www.thescripts.com/forum/thread95602.html It seems nested forms is forbidden. 2008/1/25, Eelco Hillenius [EMAIL PROTECTED]: You could try nested forms. Eelco On Jan 24, 2008 11:19 AM, smallufo [EMAIL PROTECTED] wrote: I have a Form component : SomeCheckGroup added to a SomePanel. For screen arrangement purpose , this SomePanel is not a sub-node of the Form , it's outside of the Form . It looks like this : OutmostPanel add FormPanel FormPanel add MainForm MainForm add other form components OutmostPanel add SomePanel SomePanel add SomeCheckGroup1 SomePanel add SomeCheckGroup2 SomePanel add SomeCheckGroup3 ... How do I get the value of SomeCheckGroup when MainForm submit() ? Now , I could only use AjaxCheckBox in SomeCheckGroup to update the MainForm's model , but sometimes , it seems maybe network delay problem , cause some synchronized problem , which set null to the form's model , it's hard to debug , and I feel it is bandwidth consumptive... But I cannot find a way to not using AJAX and notify the checkGroup latest model to MainForm's model . Can somebody give me a hint . Thanks in advanced.
Wicket as a front controller ?
Hi . I wonder if wicket can act as a servlet front controller ? I have a normal wicket webapp , but I need one endpoint to process Yahoo's bbAuth's request. Yes , I can write normal servlet to process this , but normal servlet lacks of spring injection and cannot access to wicket's environment. Therefore , I need a specialized wicket endpoint , and that endpoint must coexist with my wicket app . How to do that ?
Re: Wicket as a front controller ?
Thank you , but I want a (bookmarkable) page without HTML Is it possible ? 2008/2/24, Kent Tong [EMAIL PROTECTED]: smallufo wrote: I have a normal wicket webapp , but I need one endpoint to process Yahoo's bbAuth's request. Yes , I can write normal servlet to process this , but normal servlet lacks of spring injection and cannot access to wicket's environment. Have you tried using a bookmarkabke page as the endpoint? Something like http://foo.com/MyApp/app/?wicket:bookmarkablePage=:com.foo.MyApp.MyPage
Re: Wicket as a front controller ?
I just need to redirect. If bbAuth token is correct , then set correct Wicket Session and redirect to proper page. If incorrect , then redirect to another page. If I use pure servlet to implement this , I have to hard code the redirecting URL , and can only use HttpSession ... 2008/2/24, Kent Tong [EMAIL PROTECTED]: smallufo wrote: Thank you , but I want a (bookmarkable) page without HTML Is it possible ? What do you want to output? - -- Kent Tong Wicket tutorials freely available at http://www.agileskills2.org/EWDW Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA -- View this message in context: http://www.nabble.com/Wicket-as-a-front-controller---tp15656646p15664148.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]