gdaniels    02/02/04 15:34:10

  Modified:    java/src/org/apache/axis Constants.java
               java/src/org/apache/axis/handlers JWSProcessor.java
               java/src/org/apache/axis/transport/http AxisServlet.java
                        SimpleAxisServer.java
  Log:
  Improve customized JWS class dir code.
  
  * Cache a few more things in AxisServlet
  
  * Better interpretation of properties to work in various environments
  
  * Put the generated .java file in the output directory
  
  * Default the SimpleAxisServer's jws class dir to "jwsClasses"
  
  Revision  Changes    Path
  1.51      +2 -0      xml-axis/java/src/org/apache/axis/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- Constants.java    4 Feb 2002 14:51:57 -0000       1.50
  +++ Constants.java    4 Feb 2002 23:34:09 -0000       1.51
  @@ -408,6 +408,8 @@
   
       // Where to put those pesky JWS classes
       public static final String MC_JWS_CLASSDIR = "jws.classDir" ;
  +    // Where we're rooted
  +    public static final String MC_HOME_DIR = "home.dir";
   
       // Relative path of the request URL (ie. http://.../axis/a.jws = /a.jws
       public static final String MC_RELATIVE_PATH = "path";
  
  
  
  1.35      +10 -5     xml-axis/java/src/org/apache/axis/handlers/JWSProcessor.java
  
  Index: JWSProcessor.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/JWSProcessor.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- JWSProcessor.java 4 Feb 2002 14:51:57 -0000       1.34
  +++ JWSProcessor.java 4 Feb 2002 23:34:09 -0000       1.35
  @@ -117,16 +117,20 @@
               /* placed there by another handler (ie. HTTPActionHandler)     */
               /***************************************************************/
               Runtime  rt      = Runtime.getRuntime();
  -            String   jwsFile = msgContext.getStrProp(Constants.MC_RELATIVE_PATH);
  +            String   jwsFile = msgContext.getStrProp(Constants.MC_REALPATH);
  +            String rel = msgContext.getStrProp(Constants.MC_RELATIVE_PATH);
  +            if (rel.charAt(0) == '/') {
  +                rel = rel.substring(1);
  +            }
   
  -            int lastSlash = jwsFile.lastIndexOf('/');
  +            int lastSlash = rel.lastIndexOf('/');
               String dir = null;
   
               if (lastSlash > 0) {
  -                dir = jwsFile.substring(0, lastSlash);
  +                dir = rel.substring(0, lastSlash);
               }
   
  -            String file = jwsFile.substring(lastSlash + 1);
  +            String file = rel.substring(lastSlash + 1);
   
               String outdir = msgContext.getStrProp( Constants.MC_JWS_CLASSDIR );
               if ( outdir == null ) outdir = "." ;
  @@ -151,7 +155,7 @@
   
               if (category.isInfoEnabled())
                   category.info("jwsFile: " + jwsFile );
  -            String   jFile   = jwsFile.substring(0, jwsFile.length()-3) +
  +            String   jFile   = outdir + File.separator + file.substring(0, 
file.length()-3) +
                       "java" ;
               String   cFile   = outdir + File.separator + file.substring(0, 
file.length()-3) +
                       "class" ;
  @@ -159,6 +163,7 @@
               if (category.isInfoEnabled()) {
                   category.info("jFile: " + jFile );
                   category.info("cFile: " + cFile );
  +                category.info("outdir: " + outdir);
               }
   
               File  f1 = new File( cFile );
  
  
  
  1.75      +12 -4     
xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- AxisServlet.java  4 Feb 2002 20:19:06 -0000       1.74
  +++ AxisServlet.java  4 Feb 2002 23:34:09 -0000       1.75
  @@ -113,20 +113,24 @@
       private boolean isDebug= false;
   
       // Cached path to our WEB-INF directory
  -    private String webInfPath;
  +    private String webInfPath = null;
       // Cached path to JWS output directory
       private String jwsClassDir = null;
  +    // Cached path to our "root" dir
  +    private String homeDir = null;
   
       public AxisServlet() {
       }
   
       public void init() {
  -        webInfPath = getServletContext().getRealPath("/WEB-INF");
  +        ServletContext context = getServletConfig().getServletContext();
   
  +        webInfPath = context.getRealPath("/WEB-INF");
  +        homeDir = context.getRealPath("/");
  +        
           isDebug= category.isDebugEnabled();
           if(isDebug) category.debug("In servlet init");
           String param = getInitParameter("transport.name");
  -        ServletContext context = getServletConfig().getServletContext();
   
           if (param == null)
               param = context.getInitParameter("transport.name");
  @@ -147,7 +151,7 @@
           // JWS class files.
           param = System.getProperty("axis.jws.servletClassDir");
           if (param != null) {
  -            jwsClassDir = param;
  +            jwsClassDir = homeDir + param;
           } else {
               jwsClassDir = context.getRealPath("/");
           }
  @@ -223,10 +227,13 @@
   
           msgContext.setProperty(Constants.MC_JWS_CLASSDIR,
                                  jwsClassDir);
  +        msgContext.setProperty(Constants.MC_HOME_DIR, homeDir);
   
           String realpath = context.getRealPath(req.getServletPath());
           String configPath = webInfPath;
           if (realpath != null) {
  +            msgContext.setProperty(Constants.MC_RELATIVE_PATH,
  +                                   req.getServletPath());
               msgContext.setProperty(Constants.MC_REALPATH, realpath);
               msgContext.setProperty(Constants.MC_CONFIGPATH, configPath);
   
  @@ -454,6 +461,7 @@
           /* Save some HTTP specific info in the bag in case someone needs it */
           /********************************************************************/
           msgContext.setProperty(Constants.MC_JWS_CLASSDIR, jwsClassDir);
  +        msgContext.setProperty(Constants.MC_HOME_DIR, homeDir);
           msgContext.setProperty(Constants.MC_RELATIVE_PATH,
                                  req.getServletPath());
           msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLET, this );
  
  
  
  1.45      +2 -0      
xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
  
  Index: SimpleAxisServer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- SimpleAxisServer.java     4 Feb 2002 14:51:58 -0000       1.44
  +++ SimpleAxisServer.java     4 Feb 2002 23:34:09 -0000       1.45
  @@ -267,6 +267,8 @@
                                              fileName.toString());
                       msgContext.setProperty(Constants.MC_RELATIVE_PATH,
                                              fileName.toString());
  +                    msgContext.setProperty(Constants.MC_JWS_CLASSDIR,
  +                                           "jwsClasses");
   
                       // !!! Fix string concatenation
                       String url = "http://localhost:"; +
  
  
  


Reply via email to