You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mike Mander <wi...@gmx.de> on 2011/07/18 13:37:31 UTC

How can i redirect to a wicket page after executing an url-request?

Hi,

my usecase:
I use a solr server for search. Importing data to the server works by 
calling an url (localhost:8983/solr/....).
I've added this url to a link. On click data-import starts. All works fine.

SolrLink.java
<code>
     @Override
     protected CharSequence getURL() {
         return "localhost:8983/solr/...";
     }
</code>

*But* the link leads me to the solr response page. I know it's intended 
by clicking a link to get directed to the called page, but i would like 
to call the url and immediatly after that call i would like to redirect 
to wicket page.

I could use solrj to call the data-import handler. But i'm a bit lazy 
and thus would like to use the url :-)

Can i do this?
Thanks
Mike

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


Re: How can i redirect to a wicket page after executing an url-request?

Posted by Mike Mander <wi...@gmx.de>.
Am 18.07.2011 14:41, schrieb Wilhelmsen Tor Iver:
>>           throw new
>> RestartResponseAtInterceptPageException(DashboardPage.class);
> Will you ever be returning from that (via continueToOriginalDestination())? If not, setResponsePage(DashboardPage.class) is better.
>
> - Tor Iver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
oops. ok. Thanks

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


RE: How can i redirect to a wicket page after executing an url-request?

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
>          throw new 
> RestartResponseAtInterceptPageException(DashboardPage.class);

Will you ever be returning from that (via continueToOriginalDestination())? If not, setResponsePage(DashboardPage.class) is better.

- Tor Iver

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


Re: How can i redirect to a wicket page after executing an url-request?

Posted by Mike Mander <wi...@gmx.de>.
Am 18.07.2011 14:08, schrieb Wilhelmsen Tor Iver:
>> HttpClient looks great. Do you know if i can execute the HttpMethod
>> without waiting for request to comeback?
>> Maybe an asynchronous way?
> There seems to be an async fork you can try:
>
> http://jfarcand.wordpress.com/2010/03/04/new-open-source-project-alert-a-new-asynchronous-http-client-library/
>
> - Tor Iver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
That was simple :-)
<dependency>
<groupId>com.ning</groupId>
<artifactId>async-http-client</artifactId>
<version>1.6.4</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

     @Override
     public void onClick() {
         final AsyncHttpClient client = new AsyncHttpClient();
         try {
             client.preparePost(getSolrUrl()).execute();
         } catch (Exception e) {
             throw new WicketRuntimeException(e);
         }
         throw new 
RestartResponseAtInterceptPageException(DashboardPage.class);
     }

Thanks Tor
Mike

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


RE: How can i redirect to a wicket page after executing an url-request?

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> HttpClient looks great. Do you know if i can execute the HttpMethod 
> without waiting for request to comeback?
> Maybe an asynchronous way?

There seems to be an async fork you can try:

http://jfarcand.wordpress.com/2010/03/04/new-open-source-project-alert-a-new-asynchronous-http-client-library/

- Tor Iver

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


Re: How can i redirect to a wicket page after executing an url-request?

Posted by Mike Mander <wi...@gmx.de>.
Am 18.07.2011 13:43, schrieb Wilhelmsen Tor Iver:
>> *But* the link leads me to the solr response page. I know it's intended
>> by clicking a link to get directed to the called page, but i would like
>> to call the url and immediatly after that call i would like to redirect
>> to wicket page.
> Sounds like what you really want to do is use Apache commons-httpclient or the like to make a server-side call Solr (to trigger what you want), then show a Wicket page as normal. You do not always need to use a browser to perform a HTTP request you know... :)
>
> - Tor Iver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
HttpClient looks great. Do you know if i can execute the HttpMethod 
without waiting for request to comeback?
Maybe an asynchronous way?

Thanks
Mike

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


RE: How can i redirect to a wicket page after executing an url-request?

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> *But* the link leads me to the solr response page. I know it's intended 
> by clicking a link to get directed to the called page, but i would like 
> to call the url and immediatly after that call i would like to redirect 
> to wicket page.

Sounds like what you really want to do is use Apache commons-httpclient or the like to make a server-side call Solr (to trigger what you want), then show a Wicket page as normal. You do not always need to use a browser to perform a HTTP request you know... :)

- Tor Iver

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