Author: dims
Date: Thu Mar 1 20:16:13 2007
New Revision: 513612
URL: http://svn.apache.org/viewvc?view=rev&rev=513612
Log:
Fix for GERONIMO-2913 - minor changes to JettyEJBWebServiceContext and TomcatEJBWebServiceContext for Axis2
Fix for GERONIMO-2914 - Axis2: a few changes to set the servicepath, contextroot correctly in EJB to allow getWSDL() test working correctly
Fix for GERONIMO-2894 - Restructure geronimo-axis2 code to split between EJB and POJO containers
Thanks a ton Lin.
Added:
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContext.java
Removed:
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainerFactoryGBean.java
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContext.java
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/EJBWebServiceGBean.java
Modified:
geronimo/server/trunk/configs/axis2-deployer/src/plan/plan.xml
geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java
geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java
Modified: geronimo/server/trunk/configs/axis2-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/axis2-deployer/src/plan/plan.xml?view=diff&rev=513612&r1=513611&r2=513612
==============================================================================
--- geronimo/server/trunk/configs/axis2-deployer/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/axis2-deployer/src/plan/plan.xml Thu Mar 1 20:16:13 2007
@@ -82,6 +82,6 @@
</reference>
</gbean>
- <gbean name="Axis2WebServiceEJBLinkTemplate" class="org.apache.geronimo.axis2.EJBWebServiceGBean"/>
+ <gbean name="Axis2WebServiceEJBLinkTemplate" class="org.apache.geronimo.axis2.ejb.EJBWebServiceGBean"/>
</module>
Modified: geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java?view=diff&rev=513612&r1=513611&r2=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java Thu Mar 1 20:16:13 2007
@@ -42,8 +42,8 @@
import org.apache.axis2.jaxws.javaee.WebservicesType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.axis2.Axis2WebServiceContainerFactoryGBean;
import org.apache.geronimo.axis2.client.Axis2ServiceReference;
+import org.apache.geronimo.axis2.pojo.POJOWebServiceContainerFactoryGBean;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.deployment.DeploymentContext;
import org.apache.geronimo.gbean.GBeanData;
@@ -75,7 +75,7 @@
}
protected GBeanInfo getContainerFactoryGBeanInfo() {
- return Axis2WebServiceContainerFactoryGBean.GBEAN_INFO;
+ return POJOWebServiceContainerFactoryGBean.GBEAN_INFO;
}
protected Map<String, PortInfo> parseWebServiceDescriptor(InputStream in,
Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=diff&rev=513612&r1=513611&r2=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java Thu Mar 1 20:16:13 2007
@@ -23,7 +23,6 @@
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
@@ -36,7 +35,6 @@
import javax.wsdl.xml.WSDLWriter;
import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.Handler;
import org.apache.axiom.om.util.UUIDGenerator;
import org.apache.axis2.AxisFault;
@@ -46,7 +44,6 @@
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
@@ -54,30 +51,25 @@
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.engine.DependencyManager;
-import org.apache.axis2.jaxws.binding.BindingImpl;
import org.apache.axis2.jaxws.description.builder.WsdlComposite;
import org.apache.axis2.jaxws.description.builder.WsdlGenerator;
-import org.apache.axis2.jaxws.javaee.HandlerChainsType;
import org.apache.axis2.jaxws.server.JAXWSMessageReceiver;
import org.apache.axis2.transport.OutTransportInfo;
import org.apache.axis2.transport.RequestResponseTransport;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HTTPTransportReceiver;
import org.apache.axis2.transport.http.HTTPTransportUtils;
-import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.util.MessageContextBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
import org.apache.geronimo.jaxws.JNDIResolver;
import org.apache.geronimo.jaxws.PortInfo;
import org.apache.geronimo.jaxws.ServerJNDIResolver;
-import org.apache.geronimo.jaxws.annotations.AnnotationException;
import org.apache.geronimo.webservices.WebServiceContainer;
import org.apache.ws.commons.schema.XmlSchema;
-public class Axis2WebServiceContainer implements WebServiceContainer {
+public abstract class Axis2WebServiceContainer implements WebServiceContainer {
private static final Log log = LogFactory.getLog(Axis2WebServiceContainer.class);
@@ -86,14 +78,9 @@
private transient final ClassLoader classLoader;
private final String endpointClassName;
- private final org.apache.geronimo.jaxws.PortInfo portInfo;
- private ConfigurationContext configurationContext;
- private String contextRoot = null;
- private Map servicesMap;
+ protected org.apache.geronimo.jaxws.PortInfo portInfo;
+ protected ConfigurationContext configurationContext;
private JNDIResolver jndiResolver;
- private JAXWSAnnotationProcessor annotationProcessor;
- private Object endpointInstance;
- private List<Handler> chain;
private AxisService service;
private URL configurationBaseUrl;
@@ -108,7 +95,6 @@
this.configurationBaseUrl = configurationBaseUrl;
try {
configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
- configurationContext.setServicePath(portInfo.getLocation());
if(portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")){ //WSDL file Has been provided
AxisServiceGenerator serviceGen = new AxisServiceGenerator();
@@ -221,26 +207,7 @@
}
- private void initContextRoot(Request request) {
- if (contextRoot == null || "".equals(contextRoot)) {
- String[] parts = JavaUtils.split(request.getContextPath(), '/');
- if (parts != null) {
- for (int i = 0; i < parts.length; i++) {
- if (parts[i].length() > 0) {
- contextRoot = parts[i];
- break;
- }
- }
- }
- if (contextRoot == null || request.getContextPath().equals("/")) {
- contextRoot = "/";
- }
- configurationContext.setContextRoot(contextRoot);
-
-// Parameter servicePath = new Parameter(Constants.PARAM_SERVICE_PATH, new String(""));
-
- }
- }
+ protected abstract void initContextRoot(Request request);
public void doService2(
final Request request,
@@ -248,15 +215,9 @@
final MessageContext msgContext) throws Exception {
ConfigurationContext configurationContext = msgContext.getConfigurationContext();
- final String servicePath = configurationContext.getServiceContextPath();
- final String contextPath = (servicePath.startsWith("/") ? servicePath : "/" + servicePath);
-
- URI uri = request.getURI();
- String path = uri.getPath();
String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
AxisService service = findServiceWithEndPointClassName(configurationContext, endpointClassName);
- String serviceName = service.getName();
// TODO: Port this section
// // Adjust version and content chunking based on the config
@@ -281,147 +242,10 @@
if (request.getMethod() == Request.GET) {
- if (!path.startsWith(contextPath)) {
- response.setStatusCode(301);
- response.setHeader("Location", contextPath);
- return;
- }
- if (uri.toString().indexOf("?") < 0) {
- if (!path.endsWith(contextPath)) {
- if (serviceName.indexOf("/") < 0) {
- String res = HTTPTransportReceiver.printServiceHTML(serviceName, configurationContext);
- PrintWriter pw = new PrintWriter(response.getOutputStream());
- pw.write(res);
- pw.flush();
- return;
- }
- }
- }
-
- //TODO: Has to implement
- if (uri.getQuery().startsWith("wsdl2")) {
- if (service != null) {
- service.printWSDL2(response.getOutputStream());
- return;
- }
- }
- if (uri.getQuery().startsWith("wsdl")) {
- if (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")) { //wsdl file has been provided
- Definition wsdlDefinition = new AxisServiceGenerator().getWSDLDefition(portInfo, configurationBaseUrl, classLoader);
- if(wsdlDefinition != null){
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLWriter writer = factory.newWSDLWriter();
- writer.writeWSDL(wsdlDefinition, response.getOutputStream());
- return;
- }
- }else {
- service.printWSDL(response.getOutputStream());
- return;
- }
- }
- //TODO: Not working properly and do we need to have these requests ?
- if (uri.getQuery().startsWith("xsd=")) {
- String schemaName = uri.getQuery().substring(uri.getQuery().lastIndexOf("=") + 1);
-
- if (service != null) {
- //run the population logic just to be sure
- service.populateSchemaMappings();
- //write out the correct schema
- Map schemaTable = service.getSchemaMappingTable();
- final XmlSchema schema = (XmlSchema) schemaTable.get(schemaName);
- //schema found - write it to the stream
- if (schema != null) {
- schema.write(response.getOutputStream());
- return;
- } else {
- // no schema available by that name - send 404
- response.setStatusCode(404);
- return;
- }
- }
- }
- //cater for named xsds - check for the xsd name
- if (uri.getQuery().startsWith("xsd")) {
- if (service != null) {
- response.setContentType("text/xml");
- response.setHeader("Transfer-Encoding", "chunked");
- service.printSchema(response.getOutputStream());
- response.getOutputStream().close();
- return;
- }
- }
-
- msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
- msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new Axis2TransportInfo(response));
-
- // deal with GET request
-// Temporary hack ... Looks like AXIS2 removed this method. Commented out for now and
-// replaced with a simple setting of the processed boolean below
-// boolean processed = HTTPTransportUtils.processHTTPGetRequest(
-// msgContext,
-// response.getOutputStream(),
-// soapAction,
-// path,
-// configurationContext,
-// HTTPTransportReceiver.getGetRequestParameters(path));
- boolean processed = false;
-
- if (!processed) {
- response.setStatusCode(200);
- String s = HTTPTransportReceiver.getServicesHTML(configurationContext);
- PrintWriter pw = new PrintWriter(response.getOutputStream());
- pw.write(s);
- pw.flush();
- }
+ processGetRequest(request, response, service, configurationContext, msgContext, soapAction);
} else if (request.getMethod() == Request.POST) {
- msgContext.setAxisService(service);
- configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
- ServiceGroupContext serviceGroupContext = msgContext.getServiceGroupContext();
- DependencyManager.initService(serviceGroupContext);
- endpointInstance = msgContext.getServiceContext().getProperty(ServiceContext.SERVICE_OBJECT);
-
- BindingImpl binding = new BindingImpl("GeronimoBinding");
- binding.setHandlerChain(chain);
- msgContext.setProperty(JAXWSMessageReceiver.PARAM_BINDING, binding);
- // deal with POST request
- msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
- msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new Axis2TransportInfo(response));
- msgContext.setAxisService(service);
- msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
- new Axis2RequestResponseTransport(response));
- msgContext.setProperty(Constants.Configuration.TRANSPORT_IN_URL, request.getURI().toString());
- msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
-
- HttpServletRequest servletRequest =
- (HttpServletRequest)request.getAttribute(WebServiceContainer.SERVLET_REQUEST);
- msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, servletRequest);
-
- HttpServletResponse servletResponse =
- (HttpServletResponse)request.getAttribute(WebServiceContainer.SERVLET_RESPONSE);
- msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, servletResponse);
-
- ServletContext servletContext =
- (ServletContext)request.getAttribute(WebServiceContainer.SERVLET_CONTEXT);
- msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, servletContext);
-
- String contenttype = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-
- annotationProcessor = new JAXWSAnnotationProcessor(jndiResolver,
- new Axis2WebServiceContext(msgContext));
-
- init();
- try {
- HTTPTransportUtils.processHTTPPostRequest(
- msgContext,
- request.getInputStream(),
- response.getOutputStream(),
- contenttype,
- soapAction,
- path);
- } finally {
- stop();
- }
+ processPostRequest(request, response, service, configurationContext, msgContext, soapAction, jndiResolver);
} else {
throw new UnsupportedOperationException("[" + request.getMethod() + " ] method not supported");
}
@@ -571,52 +395,154 @@
}
}
- protected void init() {
- // configure and inject handlers
- try {
- configureHandlers();
- } catch (Exception e) {
- throw new WebServiceException("Error configuring handlers", e);
+ protected void processGetRequest(Request request, Response response, AxisService service, ConfigurationContext configurationContext, MessageContext msgContext, String soapAction) throws Exception{
+ String servicePath = configurationContext.getServiceContextPath();
+ //This is needed as some cases the servicePath contains two // at the beginning.
+ while (servicePath.startsWith("/")) {
+ servicePath = servicePath.substring(1);
}
+ final String contextPath = "/" + servicePath;
- // inject resources into service
- try {
- injectResources(endpointInstance);
- } catch (AnnotationException e) {
- throw new WebServiceException("Service resource injection failed", e);
+ URI uri = request.getURI();
+ String path = uri.getPath();
+ String serviceName = service.getName();
+
+ if (!path.startsWith(contextPath)) {
+ response.setStatusCode(301);
+ response.setHeader("Location", contextPath);
+ return;
+ }
+ if (uri.toString().indexOf("?") < 0) {
+ if (!path.endsWith(contextPath)) {
+ if (serviceName.indexOf("/") < 0) {
+ String res = HTTPTransportReceiver.printServiceHTML(serviceName, configurationContext);
+ PrintWriter pw = new PrintWriter(response.getOutputStream());
+ pw.write(res);
+ pw.flush();
+ return;
+ }
+ }
+ }
+
+ //TODO: Has to implement
+ if (uri.getQuery().startsWith("wsdl2")) {
+ if (service != null) {
+ service.printWSDL2(response.getOutputStream());
+ return;
+ }
+ }
+ if (uri.getQuery().startsWith("wsdl")) {
+ if (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")) { //wsdl file has been provided
+ Definition wsdlDefinition = new AxisServiceGenerator().getWSDLDefition(portInfo, configurationBaseUrl, classLoader);
+ if(wsdlDefinition != null){
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLWriter writer = factory.newWSDLWriter();
+ writer.writeWSDL(wsdlDefinition, response.getOutputStream());
+ return;
+ }
+ }else {
+ service.printWSDL(response.getOutputStream());
+ return;
+ }
+ }
+ //TODO: Not working properly and do we need to have these requests ?
+ if (uri.getQuery().startsWith("xsd=")) {
+ String schemaName = uri.getQuery().substring(uri.getQuery().lastIndexOf("=") + 1);
+
+ if (service != null) {
+ //run the population logic just to be sure
+ service.populateSchemaMappings();
+ //write out the correct schema
+ Map schemaTable = service.getSchemaMappingTable();
+ final XmlSchema schema = (XmlSchema) schemaTable.get(schemaName);
+ //schema found - write it to the stream
+ if (schema != null) {
+ schema.write(response.getOutputStream());
+ return;
+ } else {
+ // no schema available by that name - send 404
+ response.setStatusCode(404);
+ return;
+ }
+ }
+ }
+ //cater for named xsds - check for the xsd name
+ if (uri.getQuery().startsWith("xsd")) {
+ if (service != null) {
+ response.setContentType("text/xml");
+ response.setHeader("Transfer-Encoding", "chunked");
+ service.printSchema(response.getOutputStream());
+ response.getOutputStream().close();
+ return;
+ }
}
- }
- /*
- * Gets the right handlers for the port/service/bindings and
- * performs injection.
- */
- protected void configureHandlers() throws Exception {
- HandlerChainsType handlerChains = this.portInfo.getHandlers(HandlerChainsType.class);
- Axis2HandlerResolver handlerResolver =
- new Axis2HandlerResolver(endpointInstance.getClass().getClassLoader(),
- endpointInstance.getClass(),
- handlerChains,
- this.annotationProcessor);
+ msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
+ msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new Axis2TransportInfo(response));
+ // deal with GET request
+ boolean processed = HTTPTransportUtils.processHTTPGetRequest(
+ msgContext,
+ response.getOutputStream(),
+ soapAction,
+ path,
+ configurationContext,
+ HTTPTransportReceiver.getGetRequestParameters(path));
- // TODO: pass non-null PortInfo to get the right handlers
- chain = handlerResolver.getHandlerChain(null);
+ if (!processed) {
+ response.setStatusCode(200);
+ String s = HTTPTransportReceiver.getServicesHTML(configurationContext);
+ PrintWriter pw = new PrintWriter(response.getOutputStream());
+ pw.write(s);
+ pw.flush();
+ }
}
+
+ protected void setMsgContextProperties(MessageContext msgContext, AxisService service, Response response, Request request) {
+ //BindingImpl binding = new BindingImpl("GeronimoBinding");
+ //binding.setHandlerChain(chain);
+ //msgContext.setProperty(JAXWSMessageReceiver.PARAM_BINDING, binding);
+ // deal with POST request
+ msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
+ msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new Axis2TransportInfo(response));
+ msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
+ new Axis2RequestResponseTransport(response));
+ msgContext.setProperty(Constants.Configuration.TRANSPORT_IN_URL, request.getURI().toString());
+ msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
- public void stop() {
- // call handlers preDestroy
- for (Handler handler : chain) {
- this.annotationProcessor.invokePreDestroy(handler);
- }
+ HttpServletRequest servletRequest =
+ (HttpServletRequest)request.getAttribute(WebServiceContainer.SERVLET_REQUEST);
+ msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, servletRequest);
+
+ HttpServletResponse servletResponse =
+ (HttpServletResponse)request.getAttribute(WebServiceContainer.SERVLET_RESPONSE);
+ msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, servletResponse);
+
+ ServletContext servletContext =
+ (ServletContext)request.getAttribute(WebServiceContainer.SERVLET_CONTEXT);
+ msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, servletContext);
+ }
+
+ protected void processPostRequest (Request request, Response response, AxisService service, ConfigurationContext configurationContext, MessageContext msgContext, String soapAction, JNDIResolver jndiResolver) throws Exception {
+ String contenttype = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+ msgContext.setAxisService(service);
+ configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
+ ServiceGroupContext serviceGroupContext = msgContext.getServiceGroupContext();
+ DependencyManager.initService(serviceGroupContext);
+ //endpointInstance = msgContext.getServiceContext().getProperty(ServiceContext.SERVICE_OBJECT);
- // call service preDestroy
- this.annotationProcessor.invokePreDestroy(endpointInstance);
- }
+ setMsgContextProperties(msgContext, service, response, request);
- private void injectResources(Object instance) throws AnnotationException {
- this.annotationProcessor.processAnnotations(instance);
- this.annotationProcessor.invokePostConstruct(instance);
+ try {
+ HTTPTransportUtils.processHTTPPostRequest(
+ msgContext,
+ request.getInputStream(),
+ response.getOutputStream(),
+ contenttype,
+ soapAction,
+ request.getURI().getPath());
+ } catch (Exception ex) {
+ //ignore
+ }
}
-
}
Added: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java?view=auto&rev=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java (added)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java Thu Mar 1 20:16:13 2007
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.axis2.ejb;
+
+import java.net.URL;
+
+import javax.naming.Context;
+
+import org.apache.axis2.util.JavaUtils;
+import org.apache.geronimo.axis2.Axis2WebServiceContainer;
+import org.apache.geronimo.jaxws.PortInfo;
+
+
+public class EJBWebServiceContainer extends Axis2WebServiceContainer {
+
+ private String contextRoot = null;
+
+ public EJBWebServiceContainer(PortInfo portInfo,
+ String endpointClassName,
+ ClassLoader classLoader,
+ Context context,
+ URL configurationBaseUrl) {
+ super(portInfo, endpointClassName, classLoader, context, configurationBaseUrl);
+ }
+
+ protected void initContextRoot(Request request) {
+ String servicePath = portInfo.getLocation();
+
+ if (contextRoot == null || "".equals(contextRoot)) {
+ String[] parts = JavaUtils.split(request.getContextPath(), '/');
+ if (parts != null) {
+ for (int i = 0; i < parts.length; i++) {
+ if (parts[i].length() > 0) {
+ contextRoot = parts[i];
+ break;
+ }
+ }
+ }
+ if (contextRoot == null || request.getContextPath().equals("/")) {
+ contextRoot = "/";
+ } else { //when contextRoot is not "/"
+ //set the servicePath here for EJB.
+ //check if portInfo.getLocation() contains contextRoot, if so, strip it.
+ int i = servicePath.indexOf(contextRoot);
+ if (i > -1) {
+ servicePath = servicePath.substring(i + contextRoot.length() + 1);
+ servicePath.trim();
+ }
+ }
+ configurationContext.setServicePath(servicePath);
+
+ //need to setContextRoot after servicePath as cachedServicePath is only built
+ //when setContextRoot is called.
+ configurationContext.setContextRoot(contextRoot);
+ }
+ }
+}
Added: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java?view=auto&rev=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java (added)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java Thu Mar 1 20:16:13 2007
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.axis2.ejb;
+
+import java.net.URL;
+
+import javax.naming.Context;
+
+import org.apache.geronimo.axis2.Axis2WebServiceContainer;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.jaxws.PortInfo;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.openejb.EjbDeployment;
+import org.apache.geronimo.webservices.SoapHandler;
+
+public class EJBWebServiceGBean implements GBeanLifecycle {
+
+ private SoapHandler soapHandler;
+ private String location;
+
+ public EJBWebServiceGBean(EjbDeployment ejbDeploymentContext,
+ PortInfo portInfo,
+ Kernel kernel,
+ URL configurationBaseUrl,
+ SoapHandler soapHandler,
+ String securityRealmName,
+ String realmName,
+ String transportGuarantee,
+ String authMethod,
+ String[] virtualHosts) throws Exception {
+ if (ejbDeploymentContext == null || soapHandler == null || portInfo == null) {
+ return;
+ }
+
+ this.location = portInfo.getLocation();
+
+ assert this.location != null : "null location received";
+
+ String beanClassName = ejbDeploymentContext.getBeanClass().getName();
+ Context context = ejbDeploymentContext.getComponentContext();
+
+ ClassLoader classLoader = ejbDeploymentContext.getClassLoader();
+
+ //TODO: need to invoke the EJB container and forward the call to the EJB container.
+
+ Axis2WebServiceContainer container =
+ new EJBWebServiceContainer(portInfo, beanClassName, classLoader, context, configurationBaseUrl);
+
+ if (soapHandler != null) {
+ soapHandler.addWebService(this.location,
+ virtualHosts,
+ container,
+ securityRealmName,
+ realmName,
+ transportGuarantee,
+ authMethod,
+ classLoader);
+ }
+
+ }
+
+ public void doStart() throws Exception {
+ }
+
+ public void doStop() throws Exception {
+ if (this.soapHandler != null) {
+ this.soapHandler.removeWebService(this.location);
+ }
+ }
+
+ public void doFail() {
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(EJBWebServiceGBean.class, EJBWebServiceGBean.class, NameFactory.WEB_SERVICE_LINK);
+
+ infoFactory.addReference("EjbDeployment", EjbDeployment.class);
+ infoFactory.addAttribute("portInfo", PortInfo.class, true);
+ infoFactory.addAttribute("kernel", Kernel.class, false);
+ infoFactory.addAttribute("configurationBaseUrl", URL.class, true);
+ infoFactory.addAttribute("securityRealmName", String.class, true);
+ infoFactory.addAttribute("realmName", String.class, true);
+ infoFactory.addAttribute("transportGuarantee", String.class, true);
+ infoFactory.addAttribute("authMethod", String.class, true);
+ infoFactory.addAttribute("virtualHosts", String[].class, true);
+ infoFactory.addReference("WebServiceContainer", SoapHandler.class);
+
+ infoFactory.setConstructor(new String[]{
+ "EjbDeployment",
+ "portInfo",
+ "kernel",
+ "configurationBaseUrl",
+ "WebServiceContainer",
+ "securityRealmName",
+ "realmName",
+ "transportGuarantee",
+ "authMethod",
+ "virtualHosts"
+ });
+
+
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+}
Added: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java?view=auto&rev=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java (added)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java Thu Mar 1 20:16:13 2007
@@ -0,0 +1,167 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.axis2.pojo;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.DependencyManager;
+import org.apache.axis2.jaxws.binding.BindingImpl;
+import org.apache.axis2.jaxws.javaee.HandlerChainsType;
+import org.apache.axis2.jaxws.server.JAXWSMessageReceiver;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPTransportUtils;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.geronimo.axis2.Axis2HandlerResolver;
+import org.apache.geronimo.axis2.Axis2WebServiceContainer;
+import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
+import org.apache.geronimo.jaxws.JNDIResolver;
+import org.apache.geronimo.jaxws.PortInfo;
+import org.apache.geronimo.jaxws.annotations.AnnotationException;
+
+
+public class POJOWebServiceContainer extends Axis2WebServiceContainer {
+
+ private JAXWSAnnotationProcessor annotationProcessor;
+ private Object endpointInstance;
+ private List<Handler> chain;
+ private String contextRoot = null;
+
+ public POJOWebServiceContainer(PortInfo portInfo,
+ String endpointClassName,
+ ClassLoader classLoader,
+ Context context,
+ URL configurationBaseUrl) {
+ super(portInfo, endpointClassName, classLoader, context, configurationBaseUrl);
+ configurationContext.setServicePath(portInfo.getLocation());
+ }
+
+ protected void processPostRequest (Request request, Response response, AxisService service, ConfigurationContext configurationContext, MessageContext msgContext, String soapAction, JNDIResolver jndiResolver) throws Exception {
+ String contenttype = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+ msgContext.setAxisService(service);
+ configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
+ ServiceGroupContext serviceGroupContext = msgContext.getServiceGroupContext();
+ DependencyManager.initService(serviceGroupContext);
+ endpointInstance = msgContext.getServiceContext().getProperty(ServiceContext.SERVICE_OBJECT);
+
+ super.setMsgContextProperties(msgContext, service, response, request);
+ annotationProcessor = new JAXWSAnnotationProcessor(jndiResolver,
+ new POJOWebServiceContext(msgContext));
+ init();
+ try {
+ HTTPTransportUtils.processHTTPPostRequest(
+ msgContext,
+ request.getInputStream(),
+ response.getOutputStream(),
+ contenttype,
+ soapAction,
+ request.getURI().getPath());
+ } finally {
+ stop();
+ }
+ }
+
+ protected void setMsgContextProperties(MessageContext msgContext, AxisService service, Response response, Request request) {
+ BindingImpl binding = new BindingImpl("GeronimoBinding");
+ binding.setHandlerChain(chain);
+ msgContext.setProperty(JAXWSMessageReceiver.PARAM_BINDING, binding);
+
+ super.setMsgContextProperties(msgContext, service, response, request);
+ }
+
+ protected void init() {
+ // configure and inject handlers
+ try {
+ configureHandlers();
+ } catch (Exception e) {
+ throw new WebServiceException("Error configuring handlers", e);
+ }
+
+ // inject resources into service
+ try {
+ injectResources(endpointInstance);
+ } catch (AnnotationException e) {
+ throw new WebServiceException("Service resource injection failed", e);
+ }
+ }
+
+ /*
+ * Gets the right handlers for the port/service/bindings and
+ * performs injection.
+ */
+ protected void configureHandlers() throws Exception {
+ HandlerChainsType handlerChains = this.portInfo.getHandlers(HandlerChainsType.class);
+ Axis2HandlerResolver handlerResolver =
+ new Axis2HandlerResolver(endpointInstance.getClass().getClassLoader(),
+ endpointInstance.getClass(),
+ handlerChains,
+ this.annotationProcessor);
+
+
+ // TODO: pass non-null PortInfo to get the right handlers
+ chain = handlerResolver.getHandlerChain(null);
+ }
+
+ public void stop() {
+ // call handlers preDestroy
+ for (Handler handler : chain) {
+ this.annotationProcessor.invokePreDestroy(handler);
+ }
+
+ // call service preDestroy
+ this.annotationProcessor.invokePreDestroy(endpointInstance);
+ }
+
+ private void injectResources(Object instance) throws AnnotationException {
+ if (instance == null)
+ System.out.println("instance is null");
+ if (annotationProcessor == null)
+ System.out.println("annotationProcessor is null");
+ this.annotationProcessor.processAnnotations(instance);
+ this.annotationProcessor.invokePostConstruct(instance);
+ }
+
+ protected void initContextRoot(Request request) {
+ if (contextRoot == null || "".equals(contextRoot)) {
+ String[] parts = JavaUtils.split(request.getContextPath(), '/');
+ if (parts != null) {
+ for (int i = 0; i < parts.length; i++) {
+ if (parts[i].length() > 0) {
+ contextRoot = parts[i];
+ break;
+ }
+ }
+ }
+ if (contextRoot == null || request.getContextPath().equals("/")) {
+ contextRoot = "/";
+ }
+ //need to setContextRoot after servicePath as cachedServicePath is only built
+ //when setContextRoot is called.
+ configurationContext.setContextRoot(contextRoot);
+ }
+ }
+}
Added: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java?view=auto&rev=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java (added)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java Thu Mar 1 20:16:13 2007
@@ -0,0 +1,97 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.axis2.pojo;
+
+import java.net.URL;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.transaction.TransactionManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
+import org.apache.geronimo.transaction.GeronimoUserTransaction;
+import org.apache.geronimo.webservices.WebServiceContainer;
+import org.apache.geronimo.webservices.WebServiceContainerFactory;
+
+public class POJOWebServiceContainerFactoryGBean implements WebServiceContainerFactory {
+
+ private static final Log log = LogFactory.getLog(POJOWebServiceContainerFactoryGBean.class);
+ private final ClassLoader classLoader;
+ private final org.apache.geronimo.jaxws.PortInfo portInfo;
+ private final String endpointClassName;
+ private URL configurationBaseUrl;
+ private Context context;
+
+ public POJOWebServiceContainerFactoryGBean(org.apache.geronimo.jaxws.PortInfo portInfo,
+ String endpointClassName,
+ ClassLoader classLoader,
+ Map componentContext,
+ Kernel kernel,
+ TransactionManager transactionManager,
+ URL configurationBaseUrl) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+
+ if (componentContext != null) {
+ GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
+ try {
+ this.context = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext,
+ userTransaction,
+ kernel,
+ classLoader);
+ } catch (NamingException e) {
+ log.warn("Failed to create naming context", e);
+ }
+ }
+
+ this.portInfo = portInfo;
+ this.classLoader = classLoader;
+ this.endpointClassName = endpointClassName;
+ this.configurationBaseUrl = configurationBaseUrl;
+ }
+
+ public WebServiceContainer getWebServiceContainer() {
+ return new POJOWebServiceContainer(portInfo, endpointClassName, classLoader, context, configurationBaseUrl);
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(POJOWebServiceContainerFactoryGBean.class, NameFactory.GERONIMO_SERVICE);
+ infoBuilder.addAttribute("portInfo", org.apache.geronimo.jaxws.PortInfo.class, true, true);
+ infoBuilder.addAttribute("endpointClassName", String.class, true, true);
+ infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
+ infoBuilder.addAttribute("componentContext", Map.class, true, true);
+ infoBuilder.addAttribute("kernel", Kernel.class, false);
+ infoBuilder.addReference("TransactionManager", TransactionManager.class, NameFactory.TRANSACTION_MANAGER);
+ infoBuilder.addAttribute("configurationBaseUrl", URL.class, true);
+
+ infoBuilder.setConstructor(new String[]{"portInfo", "endpointClassName", "classLoader",
+ "componentContext", "kernel", "TransactionManager", "configurationBaseUrl"});
+ GBEAN_INFO = infoBuilder.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+}
Added: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContext.java?view=auto&rev=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContext.java (added)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContext.java Thu Mar 1 20:16:13 2007
@@ -0,0 +1,42 @@
+package org.apache.geronimo.axis2.pojo;
+
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.jaxws.handler.LogicalMessageContext;
+
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.servlet.http.HttpServletRequest;
+import java.security.Principal;
+
+/**
+ * Implementation of WebServiceContext for POJO WS to ensure that getUserPrincipal()
+ * and isUserInRole() are properly handled.
+ */
+public class POJOWebServiceContext implements WebServiceContext {
+
+ private MessageContext ctx;
+
+ public POJOWebServiceContext(org.apache.axis2.context.MessageContext ctx) {
+ this.ctx = new LogicalMessageContext(new org.apache.axis2.jaxws.core.MessageContext(ctx));
+ }
+
+ public final MessageContext getMessageContext() {
+ return ctx;
+ }
+
+ private HttpServletRequest getHttpServletRequest() {
+ MessageContext ctx = getMessageContext();
+ return (ctx != null) ? (HttpServletRequest)ctx.get(HTTPConstants.MC_HTTP_SERVLETREQUEST) : null;
+ }
+
+ public final Principal getUserPrincipal() {
+ HttpServletRequest request = getHttpServletRequest();
+ return (request != null) ? request.getUserPrincipal() : null;
+ }
+
+ public final boolean isUserInRole(String user) {
+ HttpServletRequest request = getHttpServletRequest();
+ return (request != null) ? request.isUserInRole(user) : false;
+ }
+
+}
Modified: geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java?view=diff&rev=513612&r1=513611&r2=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java Thu Mar 1 20:16:13 2007
@@ -22,6 +22,7 @@
import java.net.URI;
import java.util.HashMap;
+import org.apache.geronimo.axis2.pojo.POJOWebServiceContainer;
import org.apache.geronimo.jaxws.PortInfo;
import org.apache.geronimo.webservices.WebServiceContainer.Request;
@@ -59,7 +60,7 @@
Axis2Response res = new Axis2Response("text/xml; charset=utf-8", "127.0.0.1", null, null, 8080, out);
String endpointClassName = "org.apache.geronimo.axis2.testdata.HelloWorld";
- Axis2WebServiceContainer container = new Axis2WebServiceContainer(portInfo, endpointClassName, cl , null, null);
+ POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName, cl , null, null);
container.invoke(req, res);
out.flush();
Modified: geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java?view=diff&rev=513612&r1=513611&r2=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java (original)
+++ geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java Thu Mar 1 20:16:13 2007
@@ -24,9 +24,9 @@
import java.util.HashMap;
import java.util.Map;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
import org.apache.geronimo.security.ContextManager;
import org.apache.geronimo.webservices.WebServiceContainer;
@@ -77,6 +77,8 @@
public JettyEJBWebServiceContext(String contextPath, WebServiceContainer webServiceContainer, InternalJAASJettyRealm internalJAASJettyRealm, String realmName, String transportGuarantee, String authMethod, ClassLoader classLoader) {
this.contextPath = contextPath;
this.webServiceContainer = webServiceContainer;
+ this.setContextPath(contextPath);
+
if (internalJAASJettyRealm != null) {
realm = new JAASJettyRealm(realmName, internalJAASJettyRealm);
//TODO
@@ -221,9 +223,9 @@
public java.net.URI getURI() {
if (uri == null) {
try {
- String uriString = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getRequestURI();
+ //String uriString = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getRequestURI();
//return new java.net.URI(uri.getScheme(),uri.getHost(),uri.getPath(),uri.);
- uri = new java.net.URI(uriString);
+ uri = new java.net.URI(request.getScheme(), null, request.getServerName(), request.getServerPort(), request.getRequestURI(), request.getQueryString(), null);
} catch (URISyntaxException e) {
throw new IllegalStateException(e.getMessage());
}
@@ -269,7 +271,10 @@
}
public String getContextPath() {
- return request.getContextPath();
+ //request.getContextPath() isn't working correctly and returned null.
+ //use getRequestURI() for now before it is fixed.
+ //return request.getContextPath();
+ return request.getRequestURI();
}
private static final Map methods = new HashMap();
Modified: geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java?view=diff&rev=513612&r1=513611&r2=513612
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java (original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java Thu Mar 1 20:16:13 2007
@@ -193,9 +193,9 @@
public java.net.URI getURI() {
if (uri == null) {
try {
- String uriString = request.getScheme() + "://" + request.getServerName() + ":" + request.getLocalPort() + request.getRequestURI();
+ //String uriString = request.getScheme() + "://" + request.getServerName() + ":" + request.getLocalPort() + request.getRequestURI();
//return new java.net.URI(uri.getScheme(),uri.getHost(),uri.getPath(),uri.);
- uri = new java.net.URI(uriString);
+ uri = new java.net.URI(request.getScheme(), null, request.getServerName(), request.getServerPort(), request.getRequestURI(), request.getQueryString(), null);
} catch (URISyntaxException e) {
throw new IllegalStateException(e.getMessage());
}
|