Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 51951 invoked by uid 500); 2 Aug 2002 20:46:57 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 51942 invoked by uid 500); 2 Aug 2002 20:46:57 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 2 Aug 2002 20:46:56 -0000 Message-ID: <20020802204656.13515.qmail@icarus.apache.org> From: tomj@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/src/org/apache/axis Constants.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N tomj 2002/08/02 13:46:56 Modified: java/src/org/apache/axis/transport/http AxisServlet.java java/src/org/apache/axis/providers/java JavaProvider.java java/src/org/apache/axis Constants.java Added: java/src/org/apache/axis/transport/http ServletEndpointContextImpl.java Log: Implement the ServletEndpointContext interface from JAX-RPC. Create an implementation class in org.apache.axis.transport.http (Is there a better place for this?) Create a S.E.C. in the AxisServlet and stash it in the message context for later. When we call the init() method of the ServiceLifeCycle, pass the S.E.C in to the function instead of null. Revision Changes Path 1.131 +8 -0 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.130 retrieving revision 1.131 diff -u -r1.130 -r1.131 --- AxisServlet.java 2 Aug 2002 17:27:42 -0000 1.130 +++ AxisServlet.java 2 Aug 2002 20:46:55 -0000 1.131 @@ -766,6 +766,14 @@ req.getHeader(HTTPConstants.HEADER_AUTHORIZATION)); msgContext.setProperty(Constants.MC_REMOTE_ADDR, req.getRemoteAddr()); + // Set up a javax.xml.rpc.server.ServletEndpointContext + ServletEndpointContextImpl sec = + new ServletEndpointContextImpl(req.getSession(), + msgContext, + req.getUserPrincipal(), + getServletConfig().getServletContext()); + + msgContext.setProperty(Constants.MC_SERVLET_ENDPOINT_CONTEXT, sec); /* Save the real path */ /**********************/ String realpath = 1.1 xml-axis/java/src/org/apache/axis/transport/http/ServletEndpointContextImpl.java Index: ServletEndpointContextImpl.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * 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 acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" 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 apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, 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 * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package org.apache.axis.transport.http; import javax.xml.rpc.server.ServletEndpointContext; import javax.xml.rpc.handler.MessageContext; import javax.servlet.http.HttpSession; import javax.servlet.ServletContext; import java.security.Principal; public class ServletEndpointContextImpl implements ServletEndpointContext { private HttpSession httpSession; private MessageContext msgContext ; private ServletContext servletContext; private Principal principal; public HttpSession getHttpSession() { return httpSession; } public MessageContext getMessageContext() { return msgContext; } public ServletContext getServletContext() { return servletContext; } public Principal getUserPrincipal() { return principal; } /** * Full constructor */ public ServletEndpointContextImpl(HttpSession httpSession, MessageContext msgContext, Principal principal, ServletContext servletContext) { this.httpSession = httpSession; this.msgContext = msgContext; this.principal = principal; this.servletContext = servletContext; } } 1.70 +3 -3 xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java Index: JavaProvider.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- JavaProvider.java 1 Aug 2002 18:35:42 -0000 1.69 +++ JavaProvider.java 2 Aug 2002 20:46:55 -0000 1.70 @@ -190,8 +190,7 @@ /** * Return a new service object which, if it implements the ServiceLifecycle - * interface, has been init()ed. Right now we pass "null" as the context - * argument to init() - this might want to be the MessageContext? + * interface, has been init()ed. * * @param msgContext the MessageContext * @param clsName the name of the class to instantiate @@ -203,7 +202,8 @@ Object serviceObject = makeNewServiceObject(msgContext, clsName); if (serviceObject != null && serviceObject instanceof ServiceLifecycle) { - ((ServiceLifecycle)serviceObject).init(null); + ((ServiceLifecycle)serviceObject).init( + msgContext.getProperty(Constants.MC_SERVLET_ENDPOINT_CONTEXT)); } return serviceObject; } 1.74 +4 -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.73 retrieving revision 1.74 diff -u -r1.73 -r1.74 --- Constants.java 24 Jul 2002 18:01:04 -0000 1.73 +++ Constants.java 2 Aug 2002 20:46:56 -0000 1.74 @@ -486,4 +486,8 @@ public static final String MC_CONFIGPATH = "configPath"; // MessageContext param for the IP of the calling client public static final String MC_REMOTE_ADDR = "remoteaddr"; + // When invoked from a servlet, per JAX-RPC, we need a + // ServletEndpointContext object. This is where it lives. + public static final String MC_SERVLET_ENDPOINT_CONTEXT = "servletEndpointContext"; + }