custom (non wicket) modal dialog. Problem with urls.
Hello everyone, in our project i have to use our own modal dialog (application is included in a portal). I have to open the dialog with the help of a javascript function which is wrapped in a Behaviour. What i am doing now: - in the constructor of my response page i call the javascript function via a behaviour, so that immediately after the responsepage is rendered, the javascript function gets called and the modal dialog opens. - the javascript funtion accepts a url of the page that will be included in the dialog. In order to get the url i'm doing the this: URL for Page in Modal Dialog: ServletWebRequest servletWebRequest = (ServletWebRequest) comp .getRequest(); HttpServletRequest request = servletWebRequest.getHttpServletRequest(); String path = Strings.stripJSessionId(request.getRequestURI()); CharSequence urlFor = comp.urlFor(targetPageClass, params); String contextRelativePath = path + urlFor; Behaviour for opening the Modal Dialog: public class OpenModalDialogBehaviour extends AbstractDefaultAjaxBehavior { private static final long serialVersionUID = -127624955452459934L; private String url; public OpenModalDialogBehaviour(String url) { this.url = url; } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); ASPSession session = (ASPSession) ASPSession.get(); String js = "{if(" + session.isShowModalDialog() + "){top.showForm('" + url + " + ');}}"; tag.append("onload", js , " "); session.setShowModalDialog(false); } @Override protected void respond(AjaxRequestTarget target) { System.out.println("respond"); } } Now, my problem is, that the response page is the page in the background (deactivated by the modal-dialog-javascript- function), not the page of the modal dialog. Therefore the links in the page of my modal dialog are dead (the onclick functions never get called). What i need is some trick to calculate and set the urls for my modal dialog page manually, but i have no clue how to do this. Or maybe there is a much simpler solution? Thanks for any suggestions! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3726196.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: custom (non wicket) modal dialog. Problem with urls.
Hi, thank you very much for your answer. It's correct till number 3. The link in the modal dialog has to be a resourcelink, which loads a pdf document from the server. I cannot use an external link because there is a firewall between user and document server (therefore i have to open an http-connection on the server). My problem is that neither the getData() method of the ResourceState nor the onclick() method of the link gets called because the response page ist the page in the background and not the page in the modal dialog where the links reside . Here's the code for my link. I have tested it and it works outside of the modal dialog, no problem with that. So i think the problem is really that i don't get callback messages from wicket in my links because the page with the links is not the response page. private ResourceLink createResourceLink( final Link serviceInfoLink, String labelId, String linkId) { final ASPDynamicResource resource = new ASPDynamicResource(URLUtil.extractFileName(serviceInfoLink.getUrl())){ private static final long serialVersionUID = 1L; @Override public String getContentType() { return "application/pdf"; }; @Override public String getUrl() { return serviceInfoLink.getUrl(); }; }; ResourceLink resourceLink = new ResourceLink(linkId, resource) { @Override public void onClick() { if(resource.isResourceAvailable()){ log.error("Resource with name: " + serviceInfoLink.getUrl() + "is not available"); } super.onClick(); } private static final long serialVersionUID = 192187593624907520L; }; resourceLink.add(new Label(labelId, serviceInfoLink.getName())); return resourceLink; } public abstract class ASPDynamicResource extends DynamicWebResource { private static final long serialVersionUID = -4500556464921243755L; private Log log = LogFactory.getLog(ASPDynamicResource.class); public ASPDynamicResource(String id){ super(id); } @Override protected ResourceState getResourceState() { return new ASPResourceState(); } private class ASPResourceState extends ResourceState { public String getContentType() { return ASPDynamicResource.this.getContentType(); } public byte[] getData() { URLReader urlReader = URLReader.newInstance(); try { return urlReader.getBytes(urlReader.webProxyUrl(getUrl())); } catch (MalformedURLException e) { log.error(e); } catch (Exception e) { log.error(e); } return null; } } public boolean isResourceAvailable() { URLTester urlTester = URLTester.newInstance(); try { return urlTester.isReachable(urlTester.webProxyUrl(getUrl())); } catch (MalformedURLException e) { log.error(e); return false; } catch (Exception e) { log.error(e); return false; } } public abstract String getUrl(); public abstract String getContentType(); } public abstract class ASPDynamicResource extends DynamicWebResource { private static final long serialVersionUID = -4500556464921243755L; private Log log = LogFactory.getLog(ASPDynamicResource.class); public ASPDynamicResource(String id){ super(id); } @Override protected ResourceState getResourceState() { return new ASPResourceState(); } private class ASPResourceState extends ResourceState { public String getContentType() { return ASPDynamicResource.this.getContentType(); } public byte[] getData() { URLReader urlReader = URLReader.newInstance(); try { return urlReader.getBytes(urlReader.webProxyUrl(getUrl())); } catch (MalformedURLException
Re: custom (non wicket) modal dialog. Problem with urls.
Could also be that it is a problem with iframes, because the Wicket page (in the modal dialog, which is a div) gets opened in the top iframe with top.showForm(...). -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3732156.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: custom (non wicket) modal dialog. Problem with urls.
One step further. My original assumption was wrong. It is a problem with iframes and the configuration of our firewall. But the situation hasn't improved. The url of the link is: ?wicket:interface=:85:border:_body:dialogContainer:contentPanels:infoTextContentPanel:externalLinks:0:externalLink::IResourceListener:: Now i have to prepend my servlet path e.g. /mybaseurl/mypath to the relative url of the link, e.g.: /mybaseurl/mypath/?wicket:interface=:85:border:_body:dialogContainer:contentPanels:infoTextContentPanel:externalLinks:0:externalLink::IResourceListener:: FurtherMore i need an Ajax-ResourceLink (which i think doesn't exist by now). Any suggestions would be greatly appreciated! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3733218.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: custom (non wicket) modal dialog. Problem with urls.
Problem is solved now: i extract the application-relative-path with: String path = Strings.stripJSessionId(request.getRequestURI()); the trick is to overwrite method "onComponentTag(ComponentTag tag)" of class ResourceLink and prepend the application -relative path so i end up with e.g.: /mybaseurl/mypath/?wicket:interface=:85:border:_body:dialogContainer:contentPanels:infoTextContentPanel:externalLinks:0:externalLink::IResourceListener:: complete code: public class CustomResourceLink extends ResourceLink { private static final long serialVersionUID = -4848428865939435963L; private boolean applicationRelative = false; private PopupSettings popupSettings = null; public CustomResourceLink (String id, Resource resource) { super(id, resource); } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (isLinkEnabled() == false) { disableLink(tag); } else { if (getURL() != null) { String url = getURL().toString(); if (applicationRelative) { if (url.length() > 0 && url.charAt(0) == '/') { url = url.substring(1); } url = RequestUtils.getBaseUrl(this) + url; } // if the tag is an anchor proper if (tag.getName().equalsIgnoreCase("a") || tag.getName().equalsIgnoreCase("link") || tag.getName().equalsIgnoreCase("area")) { // generate the href attribute tag.put("href", Strings.replaceAll(url, "&", "&")); // Add any popup script if (popupSettings != null) { // NOTE: don't encode to HTML as that is not valid // JavaScript tag.put("onclick", popupSettings.getPopupJavaScript()); } } else { // generate a popup script by asking popup settings for one if (popupSettings != null) { popupSettings.setTarget("'" + url + "'"); String popupScript = popupSettings.getPopupJavaScript(); tag.put("onclick", popupScript); } else { // or generate an onclick JS handler directly tag.put("onclick", "window.location.href='" + url + "';return false;"); } } } if (popupSettings != null) { IPageMap popupPageMap = popupSettings.getPageMap(this); if (popupPageMap != null && popupPageMap.getName() != null) { tag.put("target", popupPageMap.getName()); } } } } public void setApplicationRelative(boolean contextRelative) { this.applicationRelative = contextRelative; } } public class RequestUtils { public static String getBaseUrl(Component comp) { ServletWebRequest servletWebRequest = (ServletWebRequest) comp .getRequest(); HttpServletRequest request = servletWebRequest.getHttpServletRequest(); String path = Strings.stripJSessionId(request.getRequestURI()); return path; } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3735554.html Sent from the Users forum mailing list archive
custom url for specific pages
In our application (portal) we have a modal dialog that we have to use. In this modal dialog we put a page. Because the portal consists of iframes, we have to use relative urls in the modal dialog. For example instead of: ?wicket:interface=:4:border:_body:dialogContainer:contentPanels:infoTextContentPanel:ajaxEnabledContainer:externalLinks:0:externalLink::IResourceListener:: we have to use: */application-uri/servlet-name/* ?wicket:interface=:4:border:_body:dialogContainer:contentPanels:infoTextContentPanel:ajaxEnabledContainer:externalLinks:0:externalLink::IResourceListener:: but only for certain pages. what we've done now is create custom components that prepend the application-uri + the servlet-name to the URL. For example for a link we override onComponentTag() and prepend the strings to the url: url = RequestUtils.getBaseUrl(this) + url; Is there a more generic way to do this? for example let's say: When the Responsepage is of type "A" then modify the url accordingly. I've had a look at pathForTarget(IRequestTarget requestTarget) of class WebRequestCodingStrategy, but i think the CodingStrategy is only valid for the first time the page is called and not for every request within the page. For this i would have to mount every possible request-url within the page? Any suggestions? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/custom-url-for-specific-pages-tp3881166p3881166.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
PageExpiredException: Different JSessionId after second Ajax-Call only in IE8
Hi, i think have read (hopefully) all the posts about PageExpiredExceptions (Serializable etc.). I have a DropDownChoice, that updates a List of Links via Ajax (please see code below). After updating the List of Links or clicking on one of the links the *second time* in IE8 i receive a different session-id and therefore the PageExpiredExcption appears. Code for updating the list: dropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 6589985163593895157L; protected void onUpdate(AjaxRequestTarget target) { ... //Reload a list of links } }); Summary: - Problem only in IE8 - In Firefox everything works fine. - Wicket 1.4. - The application runs on WAS7 - No session replication - played around with settings e.g. getPageSettings().setAutomaticMultiWindowSupport(false); and caching. - Problem appears after the second Ajax-Call. - Error message is: onRuntimeException Cannot find the rendered page in session [pagemap=null,componentPath=4:border:_body:dialogContainer:contentPanels:infoTextContentPanel:ajaxEnabledContainer:fieldActions,versionNumber=0] Thanks for any help! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageExpiredException-Different-JSessionId-after-second-Ajax-Call-only-in-IE8-tp3944468p3944468.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Recreate Scroll-Position after Paging (click on paging link)
I have created a custom paging component with the help of "org.apache.wicket.markup.html.navigation.paging.PagingNavigation". In my PagingNavigator i have paging -links on top and at the bottom of the DataView. Now, when the user clicks on a link, i want to recreate the scroll-position so that the screen does not "jump" after paging. How can i submit the scroll-coordinates to the server when the user clicks on a "org.apache.wicket.markup.html.navigation.paging.PagingNavigationLink" which is a "org.apache.wicket.markup.html.link.Link". Is there a way to append the scroll-coordinates as query parameters to a "org.apache.wicket.markup.html.link.Link" or is it only possible with Ajax-Links? The problem is not the javascript-part of scrolling that already works with the help of behaviors. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Recreate-Scroll-Position-after-Paging-click-on-paging-link-tp4228868p4228868.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Recreate Scroll-Position after Paging (click on paging link)
Hello Martin, thanks for your reply. I solved it with the query parameters. Introducing AjaxLink would would have been propably to much rework as the paging component is already somewhat complex and i tried to reuse as much as possible of the PagingNavigator of wicket-extensions. Maybe next time i will try the ajax option. Here's the code: //save the scrollposition and append it as query parameter to 'href' attribute public SimpleAttributeModifier createAppendScrollPositionAttModifier() { return new SimpleAttributeModifier( "onclick", "var params = { pageXOffset:top.window.pageXOffset, pageYOffset:top.window.pageYOffset };" + "\n var str = jQuery.param(params);" + "\n str = '&' + str;" + "\n var href=$(this).attr('href');" + "\n href = href + str;" + "\n $(this).attr('href', href);"); } //scroll to previous scrolling position public static AbstractBehavior createScrollBehavior(String pageXOffset, String pageYOffset){ return BehaviorUtils .createTemporaryOnloadJavascriptBehaviour( "top.scrollTo(" + pageXOffset + "," + pageYOffset + ");" ); } //Add the scrolling behavior String pageXOffset = getRequest().getParameter("pageXOffset"); pageXOffset = "null".equals(pageXOffset) ? "0" : pageXOffset; String pageYOffset = getRequest().getParameter("pageYOffset"); pageYOffset = "null".equals(pageYOffset) ? "0" : pageYOffset; add(BehaviorUtils.createScrollBehavior(pageXOffset, pageYOffset)); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Recreate-Scroll-Position-after-Paging-click-on-paging-link-tp4228868p4240037.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
WicketTester functionalities
After working successfully with wicket for some time, I'm now trying ot set up regression tests with fitnesse and the help of WicketTester functionality or in combination with selenium if functionality of WicketTester does not fulfill my needs (probably i won't do it with selenium as i already tried and fought with the productivity problems that came along). Here a few questions on WicketTester functionality: - Is it possible to assert that a e.g. pdf/excel/tiff download succeeded? - Is it possible to assert that a e.g. pdf/excel/tiff download succeeded after click e.g. on a custom DefaultDataTable? - Is it possible to simulate paging and assert results on a DataTable after paging? I had a look on the Basic WicketTester classes and "enhancedwickettester" but couldn't find any classes that are capable of doing this. Any hints on other testing strategies would also be appreciated. Thanks in advance! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-functionalities-tp4369673p4369673.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Delete temporary files after end of a session
I'm using FileUpload to upload several files to the server in "javax.servlet.context.tempdir" or "java.io.tempdir" (i don't want to store them in the session because of session size) in order to send them via Email later in the process. So it's some sort of contactor application. My problem is that the files in the temporary directory should only be there for the period of the session. I just store the pathes to the files in the session and want to delete them at the end of the session. Implementing "sessionDestroyed(String sessionId)" in class Application doesn't work because i don't have access to the session in the context of the Application. I could also overwrite "newSessionStore()" in class "Application", deliver my own SessionStore implementation and overwrite method "unbind()" where i could delete my files but then i would have to copy the code of "newSessionStore" of class "WebApplication" which would be bad for upwards compatibility: @Override protected ISessionStore newSessionStore() { DiskPageStore store; try { store = new DiskPageStore(); } catch (SecurityException e) { throw new WicketRuntimeException( "SecurityException occurred while creating DiskPageStore. Consider overriding newSessionStore() in your application and using a PageStore that doesn't required disk access like: " + HttpSessionStore.class.getName(), e); } return new SecondLevelCacheSessionStore(this, store); } This thread recommends a HashMap in the Application class althoug this would propably work it doesn't seem to be the most elegant solution: http://apache-wicket.1842946.n4.nabble.com/Get-informed-about-invalidation-of-a-session-td1860497.html#a1860503 What is the best way to delete those file at the end of the session? Thanks in advance! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Delete-temporary-files-after-end-of-a-session-tp4438040p4438040.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Delete temporary files after end of a session
Hi Martin, So there is no "wicket way" at the moment. Thank you for your answer! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Delete-temporary-files-after-end-of-a-session-tp4438040p4438463.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
CryptedUrlWebRequestCodingStrategy and bookmarkable urls
Hi, i want to encrypt my urls except the bookmarkable ones. my bookmarkable pages are mounted in the contructor of my Application class. In my Application class i have this code (copied from wicket wiki page): @Override protected IRequestCycleProcessor newRequestCycleProcessor() { return new WebRequestCycleProcessor() { protected IRequestCodingStrategy newRequestCodingStrategy() { return new CryptedUrlWebRequestCodingStrategy(new WebRequestCodingStrategy()); } }; } When i leave it like this, the bookmarkable pages are still bookmarkable, but when i also set a crypt factory in my Application class, the bookmarkable pages are not bookmarkable any more: @Override protected void init() { getSecuritySettings().setCryptFactory( new ClassCryptFactory(KeyInSessionSunJceCryptFactory.class, ISecuritySettings.DEFAULT_ENCRYPTION_KEY)); } The comment of class "CryptedUrlWebRequestCodingStrategy" says that bookmarkable pages created during sessions will be not bookmarkable any more, but this isn't the case with my bookmarkable pages, because my mounts are set in my Application class. *Note:* The usage of the default {@link KeyInSessionSunJceCryptFactory} will also make all * bookmarkable urls generated during the user's session non-bookmarkable because they will be * encrypted using a session-relative encryption key; however, bookmarkable urls are still available * through their mounts. * Thanks for any ideas. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CryptedUrlWebRequestCodingStrategy-and-bookmarkable-urls-tp4498153p4498153.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: CryptedUrlWebRequestCodingStrategy and bookmarkable urls
Thanks Martin for your reply! So what i understand is: using: *@Override protected IRequestCycleProcessor newRequestCycleProcessor() { return new WebRequestCycleProcessor() { protected IRequestCodingStrategy newRequestCodingStrategy() { return new CryptedUrlWebRequestCodingStrategy(new WebRequestCodingStrategy()); } }; } * in combination with: new ClassCryptFactory(*NoCrypt.class*,* ISecuritySettings.DEFAULT_ENCRYPTION_KEY*)); will work for wicket 1.4 as long as don't need a custom Crypt-Factory. Is that correct? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CryptedUrlWebRequestCodingStrategy-and-bookmarkable-urls-tp4498153p4498328.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
common data picker component
Hi, is there a component in wicket which acts like a datepicker but works for any content? I mean just a box where you can put your custom panels in. I need an alernative for a DropDown Box because if have about 400 entries. so i think of a little popup box with paging and filtering elements. In the popup box i would place my DataView and other components. Popup | Filterbox | | | | << < > >>| | row1 | | row2 | | ..| | << < > >>| TextBox with button that opens popup box. Thanks for your help! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/common-data-picker-component-tp4534753p4534753.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
FileUpload temp files never get removed also they get tracked
Hi, I'm using the FileUpload Component. The component creates temporary files "uploadtmp". I set some breakpoints to see what happens. In DiskFileItem i can see that the File is added to the FileCleaner: FileCleaner.track(tempFile, this); but the File never gets removed from Disk. I also added the apache commons FileCleanerCleanup -Listener to my web.xml. org.apache.commons.fileupload.servlet.FileCleanerCleanup Is this a bug or am i missing something? If it's a bug, is there a workaround? Thanks for any suggestions. I'm using wicket 1.4.17 -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileUpload-temp-files-never-get-removed-also-they-get-tracked-tp4649926.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileUpload temp files never get removed also they get tracked
Thanks for your reply Martin! After i declared the commons FileCleaner interface in my web.xml the file was removed after my session timed out. Obviously i was just to impatient. It also went through the breakpoint in the reaper thread. I thin this functionality is enough for my needs. Thank you! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileUpload-temp-files-never-get-removed-also-they-get-tracked-tp4649926p4649930.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Detach Model Objects when user leaves page
Hi, i have a list view with content from a "Repository" that is input to a wicket DataProvider with ModelObject. I get the content of the repository from a webservice. I don't want to load the data from the webservice after each request, but the model gets detached after each request and accordingly my Repository (which is connected to the webservice) is empty after each request (because its objects are set to null in the detachment process). Now, is there a way to influence a LoadableDetachableModel in a way that it gets detached after the user leaves the page/accesses another page. I tried to overwrite the detach-method but without success. As a workaround i'm using the session to store my repository but then i don't have an indication when the data isn't needed any more. I think about time based expiration of session data (time based cache mechanism like in guava library), but i think this is rather cumbersome. Detaching the model object after the user leaves the page would be more elegant. Thanks for any suggestions or hints how you fixed this scenario. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Detach-Model-Objects-when-user-leaves-page-tp4649977.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Detach Model Objects when user leaves page
Hi Thomas, thanks for your reply. Data is not that much, but i think it's no good practice to have data in memory that is not used any more. So i'd like to have a general solution to this. Your right, the user could leave the page by any means. But for me it would be enough to discard the data when the user goes to one of my (other) wicket pages. Maybe i should have a look at the seam framework which adresses conversation scope... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Detach-Model-Objects-when-user-leaves-page-tp4649977p4649982.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Detach Model Objects when user leaves page
Thanks for the link! I think i will give this one a try: https://www.42lines.net/2011/11/15/integrating-cdi-into-wicket/ -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Detach-Model-Objects-when-user-leaves-page-tp4649977p4649990.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Custom PagingNavigation Back-Button -Problem
I wrote a custom PagingNavigation which renders page links in the form: [1-5...11-15 *16-20* 21-25...196-200]. The page size is adjustable by a DropDownChoice. Everything works fine until i hit the back-button and then click on one of the links (e.g. 11-15). What happens then is that in class "RequestListenerInterface" the request doesn't get processed in the invoke method, which results in an empty DataView (because my custom PagingNavigation class does not get called): if (!component.isEnabledInHierarchy() || !component.isVisibleInHierarchy()) { // just return so that we have a silent fail and just re-render the // page log.warn("component not enabled or visible; ignoring call. Component: " + component); return; } I already searched the mailing list and found, that this has been introduced because of a security problem. On the one hand i removed every code line which sets components visibility or enablement to false. That didn't solve the problem. On the other hand even if that worked, i'd have no idea how to get around this problem, as i have to set the visibility of loopItems (i overwrote method "populateItem" in class PagingNavigation) because not every page has a corresponding link and when instead i call "remove()" on the loopItems, wicket exits with an exception that the component is "null". Thanks for any suggestions!!! Here's the code of my customized PagingNavigation class: public class CustomPagingNavigation extends PagingNavigation { private static final long serialVersionUID = -3614988044938070942L; private BrowsingItems f; private PagingNavigationLink link; private int currentPage; private BrowsingItems.BrowsingItem selectedBi; private BrowsingItems.BrowsingItem pageMatchingBi; private IPageable pageable; private int offset = 1; private IASPPagingDimensionsProvider dimensionsProvider; private BrowsingItems.BrowsingItem nextBrowsingItem = null; public CustomPagingNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider, IASPPagingDimensionsProvider dimensionsProvider) { super(id, pageable, labelProvider); this.dimensionsProvider = dimensionsProvider; this.pageable = pageable; setViewSize(dimensionsProvider.getRecordCount() / dimensionsProvider.getItemsPerPage()); f = newBrowsingItems(); f.setOffset(1); } @Override protected void populateItem(LoopItem loopItem) { setViewSize(dimensionsProvider.getRecordCount() / dimensionsProvider.getItemsPerPage()); if (f.getCurrentPage() >= f.getPages()) f.setOffset(f.getLastPageOffset()); if (f.getOffset() < 0) f.setOffset(1); if (f.getOffset() > f.getRecordCount()) f.setOffset(f.getLastPageOffset()); currentPage = loopItem.getIteration(); pageMatchingBi = findMatchingPage(f.getBrowsingItems(), currentPage); if (pageMatchingBi != null) { boolean selected = false; if (selectedBi == null) { selectedBi = f.getBrowsingItems()[0]; } if (selectedBi != null && selectedBi.equals(pageMatchingBi)) { selected = true; } link = new ASPBrowsingItemPageNavigationLink("pageLink", pageable, currentPage, pageMatchingBi, selected) { private static final long serialVersionUID = 7412763652723598668L; @Override public void onClick() { super.onClick(); selectedBi = this.getBrowsingItem(); offset = this.getBrowsingItem().getFrom(); newBrowsingItems(); getPage().setRedirect(true); // Return the current page. setResponsePage(getPage()); } }; loopItem.add(link); loopItem.add(new Label("separator", " ") .setEscapeModelStrings(false)); nextBrowsingItem = f.findNextBrowsingItem(pageMatchingBi); if(nextBrowsingItem != null && nextBrowsingItem
Re: Custom PagingNavigation Back-Button -Problem
Solved the problem. My assumption about the RequestListenerInterface was wrong. What i am doing now: In my page i prevent Browser Caching: protected void configureResponse() { super.configureResponse(); WebResponse response = getWebRequestCycle().getWebResponse(); response.setHeader("Cache-Control", "no-cache, max-age=0,must-revalidate, no-store"); response.setHeader("Expires","-1"); response.setHeader("Pragma","no-cache"); } The problem was located in my DataProvider: public int size() { //That solved my problem: if(technicalInfoRepository.countAllEntities() == 0) technicalInfoRepository.load("", null, null, null, null); return filteringStrategy.getFiltered( new LinkedList (technicalInfoRepository .findAll(all(ITechnicalInfo.class.size(); } When i clicked on the back-button my Repository was empty. No i am loading the repository again if its size is null. By the way: I am using the InMemoryRepositories of the sourceforge project "domian". I am using this kind of repository because my Application solely uses Web Services as its data source. In order to get a good compromise between caching and the number of web service calls i'm saving a reference to the repositories in the DataProvider or in the Page (Panel, Component, whatever). Whenever possible i use a transient reference (but that wasn't the problem in this case). So this is just a thin cache for user specific data. For data that is reusable for all users i use ehcache. If you've got any suggestions on alternative approaches i would really appreciate that. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Custom-PagingNavigation-Back-Button-Problem-tp3666779p3677549.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Access, read and modify "td" Tag (cell tag) in Datatable
Thanks for your reply, there is only one method in class DataTable, but it is not called. Maybe it's because i work with wicket 1.4.7. protected Item newRowItem(final String id, int index, final IModel model) { return new Item(id, index, model); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Access-read-and-modify-td-Tag-cell-tag-in-Datatable-tp4655872p4655888.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AjaxLazyLoadPanel update with target.addComponent
Hi, i'm using a Table inside an AjaxLazyLoadPanel. The table should repaint lazy (with busy icon) when i call: target.addComponent(AjaxLazyLoadPanel.this); is this possible somehow? i've read a post that i would have to replace the od AjaxLazyLoadPanel with a new instance, but this would totally disrupt my design. Is this the only way to do this? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxLazyLoadPanel-update-with-target-addComponent-tp4657120.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxLazyLoadPanel update with target.addComponent
found a solution. Here is a class which can be used for every long running interactions for which you have an AjaxRequestTarget available. You can use it instead of AjaxLazyLoadPanel, when creating a new instance of your class is inappropriate. I used the concept of callback script in AjaxLazyLoadPanel and reorganized the handling: Usage of the class: The class: * -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxLazyLoadPanel-update-with-target-addComponent-tp4657120p4657320.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Preserve state of wicket page after page navigation
Hi, i have a Wicket Page that opens a modal dialog via javascript. The content of the modal dialog is again a wicket page that i forward to. The page of the modal dialog just renders a message and can be closed via javascript. The url of the target page is calculated as follows: String url = RequestUtils .getApplicationRelativePath(page, FinSearchHelpPage.class, params); add(new OpenModalDialogBehaviour(url){ private static final long serialVersionUID = -8760975185570597361L; @Override protected String getEventListener() { return "onclick"; } }); actually this works, as the page is loaded in the upper i frame. As a lot of different states on the source page are set via ajax, i want the source page to be left completely "untouched", after the dialog is closed via javascript. But when processing tasks in RequestCylce happen, the model objects of the source page are detached and i get a NEP on the model objects, on execution of the next ajax call (model object in onclick is null), after the modal dialog is closed. I tried overriding the detach() method in the DetachableModel that i use and even in the source page but it didn't help. What i need is a way to intercept the RequestCycle at a certain point, so that the source page is left completely "untouched". The forward to the wicket page in the modal dialog shouldn't affect the source page at all. I debugged the RequestCycle processing with its different steps but couldn't find such an interception point. Thanks for any suggestions. P.S. using wickets internal modal dialog is not an option, i need to use our standards. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Preserve-state-of-wicket-page-after-page-navigation-tp4660511.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Preserve state of wicket page after page navigation
Now i tried to use multi window support feature of wicket. I think this would be most elegant solution. In every page i do: super(ESSession.get().createAutoPageMap()); And in the application i set: getPageSettings().setAutomaticMultiWindowSupport(true); But still the objects are getting detached, so i get NEPs. Shouln't it behave like every Page has its own distinct state? Thanks for any hints! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Preserve-state-of-wicket-page-after-page-navigation-tp4660511p4660542.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicket conversation scope - weld integration
Hi, after fighting for several days with integrating cdi with wicket (i am interseted in this conversation scope thing). I ended up with the following stack trace: java.lang.IllegalStateException: Context is already active at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:245) This is the configuration: tomcat apache-tomcat-7.0.6 or apache-tomcat-7.0.47 seam-conversation-spi-3.0.0.Final.jar seam-wicket.jar weld-servlet.jar cdi-api.jar seam-conversation-weld-3.0.0.Final.jar wicket-cdi-6.11.0.jar wicket version is wicket-6.11.0 cdi version is weld-2.1.0 i think i tried every possible configuration and proposed solution on the internet. Of course i read every article about wicket- cdi, conversation scope, ftlines As it has to run although on WAS7, i'm not very optimistic. Has anyone tried that? Thanks for any suggestions. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-conversation-scope-weld-integration-tp4662028.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket conversation scope - weld integration
Hi heapifyman, thanks for your reply. Yes i read it all. But the blog is from 2011 and is based on wicket 1.5. I downloaded the libs with maven, but it didn't work with wicket 6.11. I wanted to use the latest wicket for the new project. I also tried without seam-wicket in the classpath, but it also didn't help I feel like having tried all possible classpath combinations but none of them worked. I also debugged the initialization of weld at startup but couldn't detect the problem. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-conversation-scope-weld-integration-tp4662028p4662036.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket conversation scope - weld integration
Hello François, thanks for your reply! I double checked this. I have weld-servlet.jar in my classpath. According to the documentation this is the "ueber"-jar that contains all classes of other jar files. I belive so because otherwise i get NoClassDef-Errors. i changed my classpath and removed wicket-weld according to heapifyman. No my weld related jars in classpath are: weld-servlet.jar seam-conversation-spi-3.0.0.Final.jar seam-conversation-weld-3.0.0.Final.jar wicket-cdi-6.11.0.jar i cannot imagine where a second weld implemention could reside? the rest of my configuration: web.xml: org.jboss.weld.environment.servlet.Listener beans.xml (in WEB-INF- Folder): and my context.xml looks like this: -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-conversation-scope-weld-integration-tp4662028p4662046.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket conversation scope - weld integration
Hi Martin, thanks for your answer! With the dependencies from your link i now can see log entries of weld. So now it seems to initialize correctly. But i have to run it with wicket version 1.5.10 from the examples page? When i run the examples with wicket 6.11, i get the compile error that method "get()" of Class CdiConfiguration does not exist. When i run the old examples with wicket 6.11, i get the following (now well known error): WELD-001408 Unsatisfied dependencies for type [ApplicationCounter] with qualifiers [@Default] at injection point [[field] @Inject net.ftlines.wicket.cdi.examples.InjectionPage.counter] this seems to be the "main default error" of weld. 30.10.2013 15:16:30 org.jboss.weld.bootstrap.WeldBootstrap INFO: WELD-000900 1.1.9 (Final) 30.10.2013 15:16:30 org.jboss.weld.bootstrap.WeldBootstrap startContainer INFO: WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously. 30.10.2013 15:16:31 org.jboss.weld.environment.tomcat7.Tomcat7Container initialize INFO: Tomcat 7 detected, CDI injection will be available in Servlets and Filters. Injection into Listeners is not supported 30.10.2013 15:16:31 org.jboss.weld.interceptor.util.InterceptionTypeRegistry WARNUNG: Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled 30.10.2013 15:16:31 org.jboss.weld.interceptor.util.InterceptionTypeRegistry WARNUNG: Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-conversation-scope-weld-integration-tp4662028p4662049.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket conversation scope - weld integration
Hello François, thanks for your reply. yes that are exactly the dependencies that i use. I found out, that api changed between 1.5 and 1.6.. I checked out wicket examples 1.6 from wicket homepage and now it compiles. But still I get: WELD-001408 Unsatisfied dependencies for type [ApplicationCounter] with qualifiers [@Default] at injection point [[field] @Inject org.apache.wicket.examples.cdi.InjectionPage.counter] I got this exception with several different examples i tried (including the ftlines example) and different classpath dependencies. Althougt weld seems to start up according to the log files, something must go wrong during initialization. But weld doesn't output any details. As now i should have the same configuration as in wicket examples 6.x, i think it just doesn't work with tomcat 7. Thanks anyway. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-conversation-scope-weld-integration-tp4662028p4662059.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket conversation scope - weld integration
Hi again, finally i found the last problem bei incident: I had the beans.xml under WEB-INF and WEB-INF/META-INF as described in the docs and user forums. But actually it turned out that i had to put it under classes/META-INF or whatever the class folder is named. But nevertheless your hints were very valuable. Thank you! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-conversation-scope-weld-integration-tp4662028p4662228.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
weld conversation propagation page
Hi, after spending a hard time debugging i found this problem: i have to pages: FirstPage.class SecondPage.class on FirstPage.class i create a new conversation with "conversation.begin();" and on FirstPage.class i have a link: *setResponsePage(SecondPage.class);* this link results in a new transient Conversation on SecondPage.class if i create a new instance in setResponsePage(): *setResponsePage(new SecondPage());* the conversation is propagated correctly ot SecondPage.class. As i am new to cdi and weld i cannot really estimate if this is a bug or desired behavior: Thanks for any explanations. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/weld-conversation-propagation-page-tp4662389.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org