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<Void> 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<Void> resourceLink = new 
ResourceLink<Void>(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 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();
        
}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3729050.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

Reply via email to