Thanks! Please, read below...

> ________________________________________
> From: Valdis Vītoliņš [valdis.vitol...@odo.lv]
> Sent: 28 April 2013 12:27
> To: Rodriguez Fernandez, Ricardo Julio
> Cc: users@xwiki.org
> Subject: RE: [xwiki-users] redirecting 302 responses
>
> Ricardo, then look also at:
> http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs
>

I've already used this instructions to shorten a bit URLs. but I we do feel 
confortable with the /bin part of the URL so far... until I make a mistake and 
distribute a wrong address in printed material. Thus: I need to find a solution 
for a single, at least by now, URL. So, please, allow me to give you some more 
details:

1) Some time ago, playing with the instructions so shorten URL, we had a bad 
time with our plain old 2.4.30451 server.  At that moment, we felt confortable 
with URLs like http://www.idisantiago.es/bin/ICT/CSS2, thus we sticked to that 
configurations.
2) Some weeks ago I distribute by mistake a wrong URL: it doesn't include the 
/bin part of the URL: this is the mistaken address: 
http://www.idisantiago.es/BIS2013.
3) By browsing, googling and stuff, I finally understood how to redirect all 
requests throwing a 302 error, the referenced above among them, to the right 
address http://www.idisantiago.es/bin/BIS2013: nothing fancy, just a simple 
$response.sendRedirect($xwiki.getURL("BIS2013.WebHome")) in 
Main.DocumentDoesNotExist.
4) This solution works fine, but it applies to only to the wrong /BIS2013 
address, but to any other URL that doesn't include the struts action. Thus, for 
instance, all these addresses are redirected to the same place:

http://www.idisantiago.es/dummy
http://www.idisantiago.es/bread
http://www.idisantiago.es/milk
http://www.idisantiago.es/chocolate

All of then are redirected to

http://www.idisantiago.es/bin/BIS2013

5) While reading the conversation between client and server for this request, I 
see that the first piece of the dialogue includes something like this...

Request URL:http://www.idisantiago.es/chocolate
Request Method:GET
Status Code:302 Moved Temporarily

6) And from this I figure out that it could be possible that, once the server 
answers the client and says: hei! .../chocolate doesn't exist! I'll invite you 
to make a new call and retrive Main.DocumentDoesNotExist and it includes 
$response.sendRedirect($xwiki.getURL("BIS2013.WebHome")), there must be any way 
of capturing and using the requested URL in an Velocity #if() structure. 
Something like this...

#if(wrong requested URL is /chocolate)
$response.sendRedirect($xwiki.getURL("BIS2013.WebHome"))
#else
$response.sendRedirect($xwiki.getURL("ICT.WebHome"))
#end

Beyond finding a the solution for this single use case, I'm imaging a database 
of requested URLs being matched to a set of "valid" ones "the TinyURL way"! :-)

Please, forgive me if this is complete no sense! Any idea, or directly call me 
stupid if this has no sense at all, we'll be extremely welcome!

Thanks once again,

Ricardo


> Valdis
>>  Thanks, Vladis! Please, read below...
>>
> >>  ________________________________________
> >>  From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
> >> Valdis Vītoliņš [valdis.vitol...@odo.lv]
> >>  Sent: 27 April 2013 13:30
> >>  To: XWiki Users
> >>  Subject: Re: [xwiki-users] redirecting 302 responses
> >>
> >>  Ricardo,
> >>  if your intention is to shorten Xwiki URLs permanently,
> >>  look at http://odo.lv/Recipes/XwikiShortURLs_en
> >>
>>
>>  Your solution seems great, but I'm afraid I can't use it now: currently, 
>> I've no Apache web server behind the scene. Tomcat is directly serving on 
>> port 80. I know this is not a desirable situation, but it is how this server 
>> is running right now. So, I keep struggling to find a solution "within" 
>> XWiki. Any new idea will be welcome!
>>
>>
> >>  BTW, I have question to Xwiki developers — why status 302 (found) is
> >>  used?
> >>  IMHO, to train crawlers for changes, 301 (moved permanently) seems more
> >>  appropriate.
> >>
> >>  Valdis
>>
>
> >>>  Oops! Please, see below!
> >>>
> >> >>  ________________________________________
> >> >>  From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
> >> >> Rodriguez Fernandez, Ricardo Julio
> >> >>  Sent: 27 April 2013 11:21
> >> >>  To: users@xwiki.org
> >> >>  Subject: [xwiki-users] redirecting 302 responses
> >>>
> >> >>  Hi!
> >> >>
> >> >>  I more or less understand how URLs to missing/wrong/moved XWiki pages 
> >> >> work
> >> >>  involving docdoesnotexist.vm, but I'm still not able to modify this 
> >> >> behavior by
> >> >>  reading/taking into account values of request/responses exchanges 
> >> >> between client and server.
> >> >>
> >> >>  For instance: I would like to redirect a number of "short" URLs like 
> >> >> this...
> >> >>
> >> >>  http://www.idisantiago.es/BIS2013
> >> >>
> >> >>  to a set of given XWiki pages. Currently I can, and I did, a 
> >> >> redirection of all of them
> >> >>  to a single page by modifying Main.DocumentDoesNotExist this way...
> >> >>
> >> >>  {{velocity}}
> >> >>  $response.sendRedirect($xwiki.getURL("BIS2013.Schedule"))
> >> >>  {{/velocity}}
> >> >>
> >> >>  But I'm not able to find the way of using request's name and status in 
> >> >> Velocity #if().
> >> >>  Please, see attached file. I found a number of what I consider related 
> >> >> information dealing with
> >> >>  $response, $request, URL resolution, URL mappings and so on, so forth, 
> >> >> but I 'm afraid this is
> >> >>  too much for me to digest!
> >>>
> >>>  Sorry! I forgot that attachments are filtered out of the list! Here it 
> >>> is the referenced image...
> >>>
> >>>  
> >>> http://www.idisantiago.es/bin/download/ICT/Request/BIS2013.302Response.png
> >>>
> >>>  Thanks!
> >>>
> >> >>  Please, could anybody point me in the right direction? Am I completely 
> >> >> lost?
> >> >>
> >> >>  Thanks for your help!!!
> >> >>
> >> >>  Ricardo
> >> >>
> >>>
> >>>  --
> >>>  Ricardo Rodríguez
> >>>  Research Management and Promotion Technician
> >>>  Technical Secretariat
> >>>  Health Research Institute of Santiago de Compostela (IDIS)
> >>>  http://www.idisantiago.es
> >>>
> >>>
> >>>  Nota: A información contida nesta mensaxe e os seus posibles documentos 
> >>> adxuntos é privada e confidencial e está dirixida únicamente ó seu 
> >>> destinatario/a. Se vostede non é o/a destinatario/a orixinal desta 
> >>> mensaxe, por favor elimínea. A distribución ou copia desta mensaxe non 
> >>> está autorizada.
> >>>
> >>>  Nota: La información contenida en este mensaje y sus posibles documentos 
> >>> adjuntos es privada y confidencial y está dirigida únicamente a su 
> >>> destinatario/a. Si usted no es el/la destinatario/a original de este 
> >>> mensaje, por favor elimínelo. La distribución o copia de este mensaje no 
> >>> está autorizada.
> >>>
> >>>  See more languages: http://www.sergas.es/aviso_confidencialidad.htm
> >>>  _______________________________________________
> >>>  users mailing list
> >>>  users@xwiki.org
> >>>  http://lists.xwiki.org/mailman/listinfo/users
>>
>>
>>  _______________________________________________
>>  users mailing list
>>  users@xwiki.org
>>  http://lists.xwiki.org/mailman/listinfo/users
>>
>>  Nota: A información contida nesta mensaxe e os seus posibles documentos 
>> adxuntos é privada e confidencial e está dirixida únicamente ó seu 
>> destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, 
>> por favor elimínea. A distribución ou copia desta mensaxe non está 
>> autorizada.
>>
>>  Nota: La información contenida en este mensaje y sus posibles documentos 
>> adjuntos es privada y confidencial y está dirigida únicamente a su 
>> destinatario/a. Si usted no es el/la destinatario/a original de este 
>> mensaje, por favor elimínelo. La distribución o copia de este mensaje no 
>> está autorizada.
>>
>> See more languages: http://www.sergas.es/aviso_confidencialidad.htm

Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso_confidencialidad.htm
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to