Hi again,
Ok, i've a start of solution to list the good filename.
URLCodec urlCodec = new URLCodec();
........
WebdavResource[] tabWDresources =
wdr.listWebdavResources();
long wdLength = tabWDresources.length;
WebdavResource currentResource = null;
Element elt = null;
for (int i = 0; i < wdLength; i++)
{
......
elt.setName(urlCodec.encode(currentResource.getDisplayName()
));
.......
}
but now il i want to see files in folder
"lost+found"
so....
urlWebDavComplete = http://SER
VER:PORT/folder1/temp/lost+found
that's doens't work => 404 Not found.
I tried to : urlWebDavComplete = "http://SERVER:
PORT/folder1/temp/" +
urlCodec.decode("lost+found");
but nothing....
thx for your help.
----- Message d'origine ----
De : Stephane huette <shuette2000 yahoo.fr>
À : slide-user jakarta.apache.org
Envoyé le : Mardi, 3 Juillet 2007, 13h24mn 14s
Objet : Problem with bad fileName with a + =>%20 not %2B
Hi all,
I'm developping a Web application with Slide 2.0, to list,
to download, to upload, to edit files.
I've a problem to list files when its name is with a
"+". Exemple 'lost+found' on unix system.
WebdavResource[] tabWDresources =
wdr.listWebdavResources();
I debug it and I saw that the displayedName was
"lost%20found".
But %20 is like a space %2B is "+" so the
dispayedName should be "lost%2Bfound".
And i create a new folder "Shu+name", and the same
problem happens.
I don't know how i can resolve it.
this code is How I list the filname from a folder :
urlWebDavComplete = http://SERVER:PORT/fo
lder1/temp
public List listerElements(String urlWebDavComplete) throws
ServicesException, Exception
{
logger.debug("<listerElements>");
WebdavResource wdr = null;
List listeElements = new ArrayList();
try
{
HttpURL hrl = new HttpURL(urlWebDavComplete);
hrl.setUserinfo(getLoginWDServer(), getPwdWDServer());
wdr = new WebdavResource(hrl);
if (wdr != null)
{
//Explorer un sous dossier
// Here the list is filled with bad name
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
WebdavResource[] tabWDresources =
wdr.listWebdavResources();
long wdLength = tabWDresources.length;
WebdavResource currentResource = null;
Element elt = null;
for (int i = 0; i < wdLength; i++)
{
//.......create my list of fileName........
}
}
}
catch (URIException e)
{
if (wdr != null)
logger.error("listerElements
:"+urlWebDavComplete+" ==> ERREUR HTTP
:"+wdr.getStatusCode());
else
logger.error(e.getMessage(),e);
throw new ServicesException(MSG_LOGGER
+e.getMessage(),e);
}
catch (HttpException e)
{
String msgErreur = e.getMessage();
if (wdr != null)
logger.error("listerElements
:"+urlWebDavComplete+" ==> ERREUR HTTP
:"+wdr.getStatusCode());
else
{
if (msgErreur == null)
{
msgErreur = String.valueOf(e.getReasonCode());
}
logger.error(msgErreur, e);
}
throw new ServicesException(MSG_LOGGER +msgErreur,e);
}
catch (IOException e)
{
if (wdr != null)
logger.error("listerElements
:"+urlWebDavComplete+" ==> ERREUR HTTP
:"+wdr.getStatusCode());
else
logger.error(e.getMessage(),e);
throw new ServicesException(MSG_LOGGER
+e.getMessage(),e);
}
catch (Exception e)
{
String msg;
if (wdr != null)
{
msg = wdr.getStatusMessage();
logger.error("listerElements
:"+urlWebDavComplete+" ==> ERREUR HTTP
:"+wdr.getStatusCode());
}
else
{
msg = e.getMessage();
logger.error(msg,e);
}
throw new ServicesException(MSG_LOGGER + msg,e);
}
finally
{
if (wdr != null)
{
try
{
wdr.close();
}
catch (IOException e)
{
logger.error(e.getMessage(),e);
}
}
}
Collections.sort(listeElements, new
TrierElementsParNom());
logger.debug("<listerElements/>");
return listeElements;
}
Thx,
Stephane
____________________________________________________________
_________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails
vers Yahoo! Mail
------------------------------------------------------------
---------
To unsubscribe, e-mail: slide-user-unsubscribe jakarta.apache.org
For additional commands, e-mail: slide-user-help jakarta.apache.org
____________________________________________________________
_______________
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.c
om
------------------------------------------------------------
---------
To unsubscribe, e-mail: slide-user-unsubscribe jakarta.apache.org
For additional commands, e-mail: slide-user-help jakarta.apache.org
|