1,6 → 1,5 |
package pt.estgp.estgweb.web; |
|
import jomm.utils.DesUtils; |
import jomm.web.ftp.IFile; |
import jomm.web.ftp.impl.FtpFile; |
import jomm.web.utils.NavPlace; |
12,8 → 11,6 |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.action.ActionMapping; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.UserSessionImpl; |
import pt.estgp.estgweb.services.ftpservices.FtpService; |
import pt.estgp.estgweb.utils.ConfigProperties; |
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController; |
import pt.estgp.estgweb.web.exceptions.NotAuthorizedException; |
120,7 → 117,7 |
|
|
|
protected void processRequestFtp(HttpServletRequest request, HttpServletResponse response, String path, String serverStr, String server, String startPath) |
protected void processRequestFtp(HttpServletRequest request, HttpServletResponse response, String path, String server, String serverUrl, String startPath) |
throws ServletException, IOException |
{ |
try |
131,17 → 128,20 |
FtpManager.checkOperations(this,request,response); |
|
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request); |
String username = userSession != null ? userSession.getUsername() : "UNKNOWN"; |
//String username = userSession != null ? userSession.getUsername() : "UNKNOWN"; |
|
FTPFileProxy.UserCredentialsForFtp u = FTPFileProxy.getUserCredentialsForFtp(server, userSession); |
String username = u.username; |
String password = u.password; |
|
|
if (path != null) |
{ |
|
boolean isStaticAccess = ConfigProperties.getBooleanProperty(serverStr+".use.default.credentials.to.updates.and.deletes"); |
String user; |
String pass; |
//boolean isStaticAccess = ConfigProperties.getBooleanProperty(serverStr+".use.default.credentials.to.updates.and.deletes"); |
//String user; |
//String pass; |
|
/* |
if(isStaticAccess) |
{ |
user = ConfigProperties.getProperty(serverStr + ".user"); |
155,8 → 155,9 |
pass= DesUtils.getInstance().decrypt(passwordCode); |
//pass= ((UserImpl)userSession.getUser()).getPop3PassDecrypted(); |
} |
FtpServer ftpServer = FtpServer.getNewServer(server, user, pass); |
FTPClient client = ftpServer.getClient(); |
*/ |
FtpServer ftpServer = FtpServer.getNewServer(serverUrl, username, password); |
FTPClient client = FTPFileProxy.getFtpClient(ftpServer,userSession,server,serverUrl); |
if(client == null) |
{ |
logger.warn("###################"); |
175,8 → 176,8 |
{ |
IFile iFile; |
if (path.endsWith("/")) |
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path +ftpFile.getName(),"ISO-8859-1"), path); |
else iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path); |
iFile = new FtpFile(ftpFile, serverUrl + URIUtil.encodePath(path +ftpFile.getName(),"ISO-8859-1"), path); |
else iFile = new FtpFile(ftpFile, serverUrl + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path); |
iFiles.add(iFile); |
} |
List<NavPlace> navPlaces = FtpFile.getNavPlaces(path,startPath); |
187,7 → 188,7 |
} |
else |
{ |
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path); |
throw new FileNotFoundException("url not found for server:" + serverUrl + " and path:" + path); |
} |
} |
catch (Throwable e) |