List Info

Thread: Problem with bad fileName with a + =>%20 not %2B




Problem with bad fileName with a + =>%20 not %2B
country flaguser name
France
2007-07-03 06:24:14
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-unsubscribejakarta.apache.org
For additional commands, e-mail: slide-user-helpjakarta.apache.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )