roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r369262 - in /incubator/roller/trunk: sandbox/atomprotocol/src/org/roller/presentation/atomapi/ src/org/roller/presentation/ src/org/roller/presentation/weblog/actions/ src/org/roller/presentation/website/tags/ src/org/roller/presentation/x...
Date Sun, 15 Jan 2006 20:47:55 GMT
Author: agilliland
Date: Sun Jan 15 12:47:44 2006
New Revision: 369262

URL: http://svn.apache.org/viewcvs?rev=369262&view=rev
Log:
removing RollerContext.getUploadXXX() methods because the preferred method is to use the FileManager.


Modified:
    incubator/roller/trunk/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java
    incubator/roller/trunk/src/org/roller/presentation/RollerContext.java
    incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ImportEntriesAction.java
    incubator/roller/trunk/src/org/roller/presentation/website/tags/FileManagerTag.java
    incubator/roller/trunk/src/org/roller/presentation/xmlrpc/MetaWeblogAPIHandler.java

Modified: incubator/roller/trunk/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java?rev=369262&r1=369261&r2=369262&view=diff
==============================================================================
--- incubator/roller/trunk/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java
(original)
+++ incubator/roller/trunk/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java
Sun Jan 15 12:47:44 2006
@@ -445,8 +445,7 @@
     public Entry getMedia(String[] pathInfo) throws Exception {
         String handle = pathInfo[0];
         WebsiteData website = mRoller.getUserManager().getWebsiteByHandle(handle);
-        String uploadPath = RollerContext.getUploadPath(
-                mRequest.getSession(true).getServletContext());
+        String uploadPath = RollerFactory.getRoller().getFileManager().getUploadUrl();
         File resource = new File(uploadPath + File.separator + pathInfo[2]);
         return createAtomResourceEntry(website, resource);
     }

Modified: incubator/roller/trunk/src/org/roller/presentation/RollerContext.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/RollerContext.java?rev=369262&r1=369261&r2=369262&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/RollerContext.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/RollerContext.java Sun Jan 15 12:47:44
2006
@@ -394,34 +394,6 @@
     
     
     /**
-     *  Gets the hard-drive location of the upload directory.
-     */
-    public static String getUploadDir(ServletContext app) {
-        // ACK ... this really isn't the right place for this lookup!!
-        String uploaddir = null;
-        try {
-            uploaddir = RollerFactory.getRoller().getFileManager().getUploadDir();
-        } catch(Exception e) {}
-        
-        return uploaddir;
-    }
-    
-    
-    /**
-     * Gets the base url for the upload directory.
-     */
-    public static String getUploadPath(ServletContext app) {
-        // ACK ... why do this here??
-        String uploadurl = null;
-        try {
-            uploadurl = RollerFactory.getRoller().getFileManager().getUploadUrl();
-        } catch(Exception e) {}
-        
-        return uploadurl;
-    }
-    
-    
-    /**
      * RollerSpellCheck must be initialized with a dictionary file
      * so that it can return valid a SpellChecker.
      */

Modified: incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ImportEntriesAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ImportEntriesAction.java?rev=369262&r1=369261&r2=369262&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ImportEntriesAction.java
(original)
+++ incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ImportEntriesAction.java
Sun Jan 15 12:47:44 2006
@@ -6,8 +6,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-
-import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -20,14 +18,14 @@
 import org.apache.struts.action.ActionMessage;
 import org.apache.struts.action.ActionMessages;
 import org.apache.struts.actions.DispatchAction;
+import org.roller.RollerException;
+import org.roller.model.RollerFactory;
 import org.roller.pojos.WebsiteData;
-import org.roller.presentation.RollerContext;
 import org.roller.presentation.RollerRequest;
 import org.roller.presentation.RollerSession;
 import org.roller.presentation.cache.CacheManager;
 import org.roller.presentation.weblog.formbeans.ImportEntriesForm;
 import org.roller.util.StringUtils;
-
 /**
  * TODO: revisit this class once Atom 1.0 support comes to Rome
  * @struts.action name="importEntries" path="/editor/importEntries"
@@ -66,9 +64,7 @@
                     WebsiteData website = rreq.getWebsite();
 
                     // load selected file
-                    ServletContext app =
-                            getServlet().getServletConfig().getServletContext();
-                    String dir = RollerContext.getUploadDir( app );
+                    String dir = RollerFactory.getRoller().getFileManager().getUploadDir();
                     File f = new File(dir + website.getHandle() +
                                       "/" + form.getImportFileName());
 
@@ -149,8 +145,13 @@
 
     private void getXmlFiles(ActionForm actionForm, RollerRequest rreq)
     {
-		ServletContext app = this.getServlet().getServletConfig().getServletContext();
-		String dir = RollerContext.getUploadDir( app );
+		String dir = null;
+                try {
+                    RollerFactory.getRoller().getFileManager().getUploadDir();
+                } catch(RollerException re) {
+                    // shouldn't happen
+                }
+                
 		File d = new File(dir + rreq.getWebsite().getHandle());
 		ArrayList xmlFiles = new ArrayList();
 		if (d.mkdirs() || d.exists())

Modified: incubator/roller/trunk/src/org/roller/presentation/website/tags/FileManagerTag.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/tags/FileManagerTag.java?rev=369262&r1=369261&r2=369262&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/website/tags/FileManagerTag.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/website/tags/FileManagerTag.java Sun
Jan 15 12:47:44 2006
@@ -15,6 +15,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.util.RequestUtils;
+import org.roller.model.RollerFactory;
 import org.roller.pojos.WebsiteData;
 import org.roller.presentation.RollerContext;
 import org.roller.presentation.RollerRequest;
@@ -44,11 +45,10 @@
         JspWriter pw = pageContext.getOut();
         try
         {
-            ServletContext app = pageContext.getServletContext();
-
             // get the root of the /resource directory
-            String dir = RollerContext.getUploadDir( app );
-
+            String uploadDir = RollerFactory.getRoller().getFileManager().getUploadDir();
+            String uploadPath = RollerFactory.getRoller().getFileManager().getUploadUrl();
+            
             HttpServletRequest request =
                 (HttpServletRequest)pageContext.getRequest();
             RollerRequest rreq = RollerRequest.getRollerRequest(request);
@@ -69,7 +69,7 @@
             // get the files
             String[] files = new String[0];
             int numFiles = 0;
-            File d = new File(dir + website.getHandle());
+            File d = new File(uploadDir + website.getHandle());
             if (d.mkdirs() || d.exists())
             {
                 files = this.fileList(d);
@@ -108,7 +108,7 @@
 
                         fileLink = RequestUtils.printableURL(
                             RequestUtils.absoluteURL( request,
-                                RollerContext.getUploadPath( app ) +
+                                uploadPath +
                                 "/" + website.getHandle() + "/" + files[i] ) );
                         pw.print("<td class=\"rollertable\"><a href=\"" +
                             fileLink + "\">" + files[i] + "</a></td>");

Modified: incubator/roller/trunk/src/org/roller/presentation/xmlrpc/MetaWeblogAPIHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/xmlrpc/MetaWeblogAPIHandler.java?rev=369262&r1=369261&r2=369262&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/xmlrpc/MetaWeblogAPIHandler.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/xmlrpc/MetaWeblogAPIHandler.java Sun
Jan 15 12:47:44 2006
@@ -366,8 +366,7 @@
                 HttpServletRequest request = rreq.getRequest();
                 
                 // TODO: build URL to uploaded file should be done in FileManager
-                String uploadPath = RollerContext.getUploadPath(
-                        request.getSession(true).getServletContext());
+                String uploadPath = RollerFactory.getRoller().getFileManager().getUploadUrl();
                 uploadPath += "/" + website.getHandle() + "/" + name;
                 String fileLink = RequestUtils.printableURL(
                         RequestUtils.absoluteURL(request, uploadPath));



Mime
View raw message