You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pi...@apache.org on 2001/04/17 15:14:52 UTC
cvs commit: jakarta-tomcat-4.0/connectors/lib Makefile.in wa_general.c wa_request.c
pier 01/04/17 06:14:52
Added: connectors/lib Makefile.in wa_general.c wa_request.c
Log:
New sources for WebApp Library.
Revision Changes Path
1.1 jakarta-tomcat-4.0/connectors/lib/Makefile.in
Index: Makefile.in
===================================================================
# ========================================================================= #
# #
# The Apache Software License, Version 1.1 #
# #
# Copyright (c) 1999-2001 The Apache Software Foundation. #
# All rights reserved. #
# #
# ========================================================================= #
# #
# Redistribution and use in source and binary forms, with or without modi- #
# fication, are permitted provided that the following conditions are met: #
# #
# 1. Redistributions of source code must retain the above copyright notice #
# notice, this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. The end-user documentation included with the redistribution, if any, #
# must include the following acknowlegement: #
# #
# "This product includes software developed by the Apache Software #
# Foundation <http://www.apache.org/>." #
# #
# Alternately, this acknowlegement may appear in the software itself, if #
# and wherever such third-party acknowlegements normally appear. #
# #
# 4. The names "The Jakarta Project", "WebApp", and "Apache Software #
# Foundation" must not be used to endorse or promote products derived #
# from this software without prior written permission. For written #
# permission, please contact <ap...@apache.org>. #
# #
# 5. Products derived from this software may not be called "Apache" nor may #
# "Apache" appear in their names without prior written permission of the #
# Apache Software Foundation. #
# #
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES #
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY #
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL #
# THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY #
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL #
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS #
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) #
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, #
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
# POSSIBILITY OF SUCH DAMAGE. #
# #
# ========================================================================= #
# #
# This software consists of voluntary contributions made by many indivi- #
# duals on behalf of the Apache Software Foundation. For more information #
# on the Apache Software Foundation, please see <http://www.apache.org/>. #
# #
# ========================================================================= #
# @author Pier Fumagalli <ma...@eng.sun.com>
# @version $Id: Makefile.in,v 1.1 2001/04/17 13:14:50 pier Exp $
include ../Makedefs
OBJS = wa_general.o wa_request.o
LIB = libwebapp.la
all: $(LIB)
$(LIB): $(OBJS)
@echo - Linking library $(LIB)
@$(AR) -cr $(LIB) $(OBJS)
@$(RANLIB) $(LIB)
clean:
@echo Removing object files $(OBJS) $(LIB)
@rm -f $(OBJS) $(LIB)
1.1 jakarta-tomcat-4.0/connectors/lib/wa_general.c
Index: wa_general.c
===================================================================
/* ========================================================================= *
* *
* The Apache Software License, Version 1.1 *
* *
* Copyright (c) 1999-2001 The Apache Software Foundation. *
* All rights reserved. *
* *
* ========================================================================= *
* *
* Redistribution and use in source and binary forms, with or without modi- *
* fication, are permitted provided that the following conditions are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice *
* notice, this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. The end-user documentation included with the redistribution, if any, *
* must include the following acknowlegement: *
* *
* "This product includes software developed by the Apache Software *
* Foundation <http://www.apache.org/>." *
* *
* Alternately, this acknowlegement may appear in the software itself, if *
* and wherever such third-party acknowlegements normally appear. *
* *
* 4. The names "The Jakarta Project", "WebApp", and "Apache Software *
* Foundation" must not be used to endorse or promote products derived *
* from this software without prior written permission. For written *
* permission, please contact <ap...@apache.org>. *
* *
* 5. Products derived from this software may not be called "Apache" nor may *
* "Apache" appear in their names without prior written permission of the *
* Apache Software Foundation. *
* *
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY *
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY *
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, *
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= *
* *
* This software consists of voluntary contributions made by many indivi- *
* duals on behalf of the Apache Software Foundation. For more information *
* on the Apache Software Foundation, please see <http://www.apache.org/>. *
* *
* ========================================================================= */
/* @version $Id: wa_general.c,v 1.1 2001/04/17 13:14:51 pier Exp $ */
#include <wa.h>
/* The current APR memory pool. */
static apr_pool_t *pool=NULL;
/* Initialize the WebApp Library. */
const char *wa_init(void) {
if (pool==NULL) {
if (apr_initialize()!=APR_SUCCESS)
return("Cannot initialize APR");
if (apr_pool_create(&pool,NULL)!=APR_SUCCESS)
return("Cannot create WebApp Library memory pool");
if (pool==NULL)
return("Invalid WebApp Library memory pool created");
}
return(NULL);
}
/* Clean up the WebApp Library. */
const char *wa_destroy(void) {
if (pool==NULL) return("WebApp Library not initialized");
apr_pool_destroy(pool);
pool=NULL;
apr_terminate();
return(NULL);
}
/* Allocate and setup a connection */
const char *wa_connect(wa_connection **c, const char *p, const char *a) {
wa_connection *conn=NULL;
const char *msg=NULL;
/* Check parameters */
if (c==NULL) return("Invalid storage location specified");
/* Allocate some memory */
conn=(wa_connection *)apr_palloc(pool,sizeof(wa_connection));
if (conn==NULL) return("Cannot allocate memory");
conn->pool=pool;
/* Retrieve the provider and set up the conection */
conn->conf=NULL;
// if ((conn->prov=wa_provider_get(p))==NULL)
// return("Invalid provider name specified");
// if ((msg=conn->prov->configure(conn,a))!=NULL) return(msg);
/* Done! :) */
*c=conn;
return(NULL);
}
/* Allocate, set up and deploy an application. */
const char *wa_deploy(wa_application **a, wa_connection *c, const char *n,
const char *p) {
wa_application *appl=NULL;
const char *msg=NULL;
char *buf=NULL;
int l=0;
/* Check parameters */
if (a==NULL) return("Invalid storage location specified");
if (c==NULL) return("Invalid connection specified");
if (n==NULL) return("Invalid application name");
if (p==NULL) return("Invalid application path");
/* Allocate some memory */
appl=(wa_application *)apr_palloc(pool,sizeof(wa_application));
if (appl==NULL) return("Cannot allocate memory");
appl->pool=pool;
/* Set up application structure */
appl->conn=c;
appl->name=apr_pstrdup(pool,n);
buf=apr_pstrdup(appl->pool,p);
l=strlen(buf)-1;
if (buf[l]=='/') buf[l]='\0';
if (buf[0]=='/') appl->rpth=apr_pstrcat(pool,buf,"/");
else appl->rpth=apr_pstrcat(pool,"/",buf,"/");
appl->lpth=NULL;
/* Tell the connector provider we're deploying an application */
appl->conf=NULL;
// if ((msg=appl->conn->prov->deploy(a))!=NULL) return(msg);
/* Done! :) */
*a=appl;
return(NULL);
}
1.1 jakarta-tomcat-4.0/connectors/lib/wa_request.c
Index: wa_request.c
===================================================================
/* ========================================================================= *
* *
* The Apache Software License, Version 1.1 *
* *
* Copyright (c) 1999-2001 The Apache Software Foundation. *
* All rights reserved. *
* *
* ========================================================================= *
* *
* Redistribution and use in source and binary forms, with or without modi- *
* fication, are permitted provided that the following conditions are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice *
* notice, this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. The end-user documentation included with the redistribution, if any, *
* must include the following acknowlegement: *
* *
* "This product includes software developed by the Apache Software *
* Foundation <http://www.apache.org/>." *
* *
* Alternately, this acknowlegement may appear in the software itself, if *
* and wherever such third-party acknowlegements normally appear. *
* *
* 4. The names "The Jakarta Project", "WebApp", and "Apache Software *
* Foundation" must not be used to endorse or promote products derived *
* from this software without prior written permission. For written *
* permission, please contact <ap...@apache.org>. *
* *
* 5. Products derived from this software may not be called "Apache" nor may *
* "Apache" appear in their names without prior written permission of the *
* Apache Software Foundation. *
* *
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY *
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY *
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, *
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= *
* *
* This software consists of voluntary contributions made by many indivi- *
* duals on behalf of the Apache Software Foundation. For more information *
* on the Apache Software Foundation, please see <http://www.apache.org/>. *
* *
* ========================================================================= */
/* @version $Id: wa_request.c,v 1.1 2001/04/17 13:14:51 pier Exp $ */
#include <wa.h>
/* Attempt to match an URL against a web application. */
boolean wa_match(const char *u, wa_application *a) {
if (u==NULL) return(FALSE);
if (a==NULL) return(FALSE);
if (strncmp(u,a->rpth,strlen(a->rpth))==0) return(TRUE);
else return(FALSE);
}
/* Invoke a request in a web application. */
int wa_invoke(wa_request *r, wa_application *a) {
return(404);
}