Hi,
As we talk yesterday, it can be done in XWikiURLFactory.
We should add functions to parse an URL and return as you said an XWikiURI.
It will fix some problems of JSR168 integration.
jeremi
On 11/14/06, Vincent Massol <vincent(a)massol.net> wrote:
-----Original Message-----
From: jeremi23(a)gmail.com [mailto:jeremi23@gmail.com] On Behalf Of
jeremi joslin
Sent: lundi 13 novembre 2006 17:51
To: xwiki-dev(a)objectweb.org
Subject: Re: [xwiki-dev] [Code review] ZipExplorer plugin
[snip]
> * The getFileName() method can be improved:
> - first parameter variable must not be modified (the path one in
> this case). There should always be a local variable created.
> - I don't think XWiki URI manipulation should be done in this class
> at all! I'd recommend creating a XWikiURI class in charge of
> performing all actions on XWiki URI: creation, getting the different
> part, etc. In this manner is XWiki decides to change the URI format,
> it'll only be done in one place. This would also remove completely
> the need for getFileName() from ZipExplorerPlugin.
yes, it's not good, but the zip explorer
plugin is doing something
special, not standart on xwiki, so we just have this to do it. I know
this plugin is not working for exemple in exo.
I have thought more about this and I still believe the best would be to create a XWikiURL
class. The reason is that I was looking at randome at the code and noticed the following
in downloadAction:
public String getFileName(String path, String action) {
path = path.substring(path.indexOf("/" + action));
int pos = 0;
for (int i = 0; i < 3; i++) {
pos = path.indexOf("/", pos + 1);
}
if (path.indexOf("/", pos + 1) > 0)
return path.substring(pos + 1, path.indexOf("/", pos + 1));
return path.substring(pos + 1);
}
Thus the code in the zipexplorer plugin is actually very close to being a copy paste...
:-)
What it suggest to me is that there's a domain in xwiki which is URL management and
we need a class for it. I'd suggest a XWikiURL class and a XWikiZipURL one for
managing Zip URLs which are an extension of standard xwiki URLs. Note that this would
remove the copy paste as XWikiZipURL.getFileName() could share the code with
XWikiURL.getFileName().
WDYT?
[snip]
Thanks
-Vincent
___________________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo!
Questions/Réponses
http://fr.answers.yahoo.com
--
You receive this message as a subscriber of the xwiki-dev(a)objectweb.org mailing list.
To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page:
http://www.objectweb.org/wws