pier        01/08/05 19:20:10

  Modified:    webapp/lib pr_warp_config.c
  Log:
  Analyze wether the Web-Application exists locally and can be accessed by
  Apache. This will come handy when contexts will be shared between Apache
  and Tomcat.
  
  Revision  Changes    Path
  1.5       +23 -4     jakarta-tomcat-connectors/webapp/lib/pr_warp_config.c
  
  Index: pr_warp_config.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp_config.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- pr_warp_config.c  2001/07/19 23:51:48     1.4
  +++ pr_warp_config.c  2001/08/06 02:20:10     1.5
  @@ -54,7 +54,7 @@
    *                                                                           *
    * ========================================================================= */
   
  -/* @version $Id: pr_warp_config.c,v 1.4 2001/07/19 23:51:48 pier Exp $ */
  +/* @version $Id: pr_warp_config.c,v 1.5 2001/08/06 02:20:10 pier Exp $ */
   #include "pr_warp.h"
   
   wa_boolean c_check(wa_connection *conn, warp_packet *pack) {
  @@ -155,10 +155,29 @@
           p_read_int(pack,(int *)&appl->conf);
           p_read_string(pack,&temp);
           appl->lpth=apr_pstrdup(wa_pool,temp);
  -        appl->depl=wa_true;
  -        wa_debug(WA_MARK,"Application \"%s\" deployed with root=%s id=%d",
  -                appl->name,appl->lpth,appl->conf);
  +        
  +        /* Check if this web-application is local or not by checking if its
  +           WEB-INF directory can be opened. */
  +        if (appl->lpth!=NULL) {
  +            apr_dir_t *dir=NULL;
  +            char *webinf=apr_pstrcat(wa_pool,appl->lpth,"/WEB-INF",NULL);
  +            if (apr_dir_open(&dir,webinf,wa_pool)==APR_SUCCESS) {
  +                if (dir!=NULL) apr_dir_close(dir);
  +                else appl->lpth=NULL;
  +            } else {
  +                appl->lpth=NULL;
  +            }
  +        }
   
  +        if (appl->lpth==NULL) {
  +            wa_debug(WA_MARK,"Application \"%s\" deployed with id=%d (%s)",
  +                appl->name,appl->conf,"remote");
  +        } else {
  +            wa_debug(WA_MARK,"Application \"%s\" deployed with id=%d (%s)",
  +                appl->name,appl->conf,appl->lpth);
  +        }
  +
  +        appl->depl=wa_true;
           elem=elem->next;
       }
   
  
  
  

Reply via email to