cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <gree...@hotmail.com>
Subject Re: current file in XSP
Date Mon, 14 Aug 2000 19:32:11 GMT
request.getRequestURI () will give you the raw request URI as requested by 
the browser. If you just want the name of the xml file you can then do this:

  String uri = request.getRequestURI ();
  int i = uri.lastIndexOf ('/');
  String filename = ((i == -1) ? uri : ((i == uri.length ()) ? "index.xml" : 
uri.substring (i + 1)));

The last line is a compressed if..else statement by the way. Not very 
readable, I have to admit - but quick to type.

Have a look at the javadocs for the servlet API at java.sun.com if you need 
something more complicated. Especially see HTTPUtils.


--
Robin Green
i-tao Ltd.
4 Skyline Village
Limeharbour
London E14 9TS
United Kingdom
Phone +44 20 7537 2233  Fax +44 70 8081 5118
http://www.i-tao.com


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message