-----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