You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ra...@apache.org on 2001/03/19 02:05:32 UTC

cvs commit: jakarta-turbine/src/java/org/apache/turbine/services/upload TurbineUploadService.java

rafal       01/03/18 17:05:32

  Modified:    src/java/org/apache/turbine/services/upload
                        TurbineUploadService.java
  Log:
  repository paths that don't start with a slash are webapp-relative now
  
  Revision  Changes    Path
  1.8       +21 -1     jakarta-turbine/src/java/org/apache/turbine/services/upload/TurbineUploadService.java
  
  Index: TurbineUploadService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/upload/TurbineUploadService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TurbineUploadService.java	2001/03/06 06:12:54	1.7
  +++ TurbineUploadService.java	2001/03/19 01:05:32	1.8
  @@ -57,6 +57,7 @@
   // Java Core Classes
   import java.io.*;
   import java.util.*;
  +import javax.servlet.*;
   import javax.servlet.http.*;
   
   // Turbine stuff.
  @@ -82,7 +83,7 @@
    * html widget.
    *
    * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
  - * @version $Id: TurbineUploadService.java,v 1.7 2001/03/06 06:12:54 chrise Exp $
  + * @version $Id: TurbineUploadService.java,v 1.8 2001/03/19 01:05:32 rafal Exp $
    */
   public class TurbineUploadService
       extends TurbineBaseService
  @@ -93,6 +94,25 @@
        * parsed. (1024 bytes).
        */
       public static final int MAX_HEADER_SIZE = 1024;
  +
  +    /**
  +     * Initializes the service.
  +     *
  +     * This method processes the repository path, to make it relative to the web
  +     * application root, if neccessary
  +     *
  +     * @param config the ServletConfig of the Turbine servlet
  +     */
  +    public void init(ServletConfig config)
  +    {
  +        String path = getProperties()
  +            .getProperty(UploadService.REPOSITORY_KEY,
  +                         UploadService.REPOSITORY_DEFAULT.toString());
  +        if(!path.startsWith("/")) {
  +            path = config.getServletContext().getRealPath(path);
  +            getProperties().setProperty(UploadService.REPOSITORY_KEY, path);
  +        }
  +    }
   
       /**
        * <p> Processes an <a href="http://rf.cx/rfc1867.html">RFC
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org