You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Aaron Dixon <at...@gmail.com> on 2009/06/22 19:53:26 UTC

redirect to mailto

How do I redirect to a mailto: url? This doesn't seem to work:

                    final String url = "mailto:...";
                    getRequestCycle().setRequestTarget(new IRequestTarget() {
                        @Override
                        public void detach(RequestCycle requestCycle) {}
                        @Override
                        public void respond(RequestCycle requestCycle) {
                            Response response = requestCycle.getResponse();
                            response.reset();
                            response.redirect(url);
                        }
                    });

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


SV: redirect to mailto

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> How do I redirect to a mailto: url? This doesn't seem to work:

Mailto is a browser-managed protocol that does not use http; and the
Ajax response does not go to the browser but is analyzed by the Ajax
implementation. 

Perhaps adding custom Javascript in the requestTarget to do a
window.open() on the URL will work, but that is as close as you get
unless you want to ditch the use of Ajax.

- Tor Iver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: redirect to mailto

Posted by Erik van Oosten <e....@grons.nl>.
Well, then its time to whip up some javascript!

E.g.:

new AjaxLink(..) {
  public void onClick(target) {
     target.addJavascript("document.url = 'mailto:....'");
  }
}

Completely out of my head so you'll have to find the exact method names
yourself ;)

Regards,
    Erik.


On Mon, 22 Jun 2009 15:22:41 -0500, Aaron Dixon <at...@gmail.com> wrote:
> Thanks, Erik. But I need to have this behavior initiated in response
> to an ajax event (say, on an onchange for a select drop down).
> 
> On Mon, Jun 22, 2009 at 2:00 PM, Erik van Oosten<e....@grons.nl>
> wrote:
>> You can use ExternalLink with a mailto: url.
>>
>> Regards,
>>   Erik.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: redirect to mailto

Posted by Aaron Dixon <at...@gmail.com>.
Thanks, Erik. But I need to have this behavior initiated in response
to an ajax event (say, on an onchange for a select drop down).

On Mon, Jun 22, 2009 at 2:00 PM, Erik van Oosten<e....@grons.nl> wrote:
> You can use ExternalLink with a mailto: url.
>
> Regards,
>   Erik.
>
> Aaron Dixon wrote:
>>
>> How do I redirect to a mailto: url? This doesn't seem to work:
>>
>>                    final String url = "mailto:...";
>>                    getRequestCycle().setRequestTarget(new IRequestTarget()
>> {
>>                        @Override
>>                        public void detach(RequestCycle requestCycle) {}
>>                        @Override
>>                        public void respond(RequestCycle requestCycle) {
>>                            Response response = requestCycle.getResponse();
>>                            response.reset();
>>                            response.redirect(url);
>>                        }
>>                    });
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: redirect to mailto

Posted by Erik van Oosten <e....@grons.nl>.
You can use ExternalLink with a mailto: url.

Regards,
    Erik.

Aaron Dixon wrote:
> How do I redirect to a mailto: url? This doesn't seem to work:
>
>                     final String url = "mailto:...";
>                     getRequestCycle().setRequestTarget(new IRequestTarget() {
>                         @Override
>                         public void detach(RequestCycle requestCycle) {}
>                         @Override
>                         public void respond(RequestCycle requestCycle) {
>                             Response response = requestCycle.getResponse();
>                             response.reset();
>                             response.redirect(url);
>                         }
>                     });
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org