Author: dkulp
Date: Tue Feb 5 18:17:23 2008
New Revision: 618855
URL: http://svn.apache.org/viewvc?rev=618855&view=rev
Log:
Merged revisions 614983 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r614983 | dkulp | 2008-01-24 15:41:21 -0500 (Thu, 24 Jan 2008) | 3 lines
[CXF-1404] Fix issues with parameterOrder causing problems with Bare mode
Add ServletContext to message for Jetty endpoints
........
Added:
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/
- copied from r614983,
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
- copied unchanged from r614983,
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=618855&r1=618854&r2=618855&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Tue Feb 5 18:17:23 2008
@@ -27,6 +27,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -59,6 +60,7 @@
protected JettyHTTPServerEngine engine;
protected JettyHTTPTransportFactory transportFactory;
protected JettyHTTPServerEngineFactory serverEngineFactory;
+ protected ServletContext servletContext;
protected URL nurl;
/**
@@ -93,6 +95,10 @@
return LOG;
}
+ public void setServletContext(ServletContext sc) {
+ servletContext = sc;
+ }
+
/**
* Post-configure retreival of server engine.
*/
@@ -193,7 +199,16 @@
return address;
}
- protected void doService(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
+ protected void doService(HttpServletRequest req,
+ HttpServletResponse resp) throws IOException {
+ doService(servletContext, req, resp);
+ }
+ protected void doService(ServletContext context,
+ HttpServletRequest req,
+ HttpServletResponse resp) throws IOException {
+ if (context == null) {
+ context = servletContext;
+ }
Request baseRequest = (req instanceof Request)
? (Request)req :
HttpConnection.getCurrentConnection().getRequest();
@@ -240,13 +255,15 @@
// REVISIT: service on executor if associated with endpoint
try {
BusFactory.setThreadDefaultBus(bus);
- serviceRequest(req, resp);
+ serviceRequest(context, req, resp);
} finally {
BusFactory.setThreadDefaultBus(null);
}
}
- protected void serviceRequest(final HttpServletRequest req, final
HttpServletResponse resp)
+ protected void serviceRequest(final ServletContext context,
+ final HttpServletRequest req,
+ final HttpServletResponse resp)
throws IOException {
Request baseRequest = (req instanceof Request)
? (Request)req :
HttpConnection.getCurrentConnection().getRequest();
@@ -259,6 +276,7 @@
inMessage.setContent(InputStream.class, req.getInputStream());
inMessage.put(HTTP_REQUEST, req);
inMessage.put(HTTP_RESPONSE, resp);
+ inMessage.put(HTTP_CONTEXT, context);
inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
inMessage.put(Message.PATH_INFO, req.getContextPath() +
req.getPathInfo());
String normalizedEncoding =
HttpHeaderHelper.mapCharset(req.getCharacterEncoding());
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java?rev=618855&r1=618854&r2=618855&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
Tue Feb 5 18:17:23 2008
@@ -20,6 +20,7 @@
import java.io.IOException;
+import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -29,12 +30,19 @@
private String urlName;
private boolean contextMatchExact;
private JettyHTTPDestination jettyHTTPDestination;
+ private ServletContext servletContext;
public JettyHTTPHandler(JettyHTTPDestination jhd, boolean cmExact) {
contextMatchExact = cmExact;
jettyHTTPDestination = jhd;
}
+ public void setServletContext(ServletContext sc) {
+ servletContext = sc;
+ if (jettyHTTPDestination != null) {
+ jettyHTTPDestination.setServletContext(sc);
+ }
+ }
public void setName(String name) {
urlName = name;
}
@@ -47,11 +55,11 @@
HttpServletResponse resp, int dispatch) throws
IOException {
if (contextMatchExact) {
if (target.equals(urlName)) {
- jettyHTTPDestination.doService(req, resp);
+ jettyHTTPDestination.doService(servletContext, req, resp);
}
} else {
if (target.startsWith(urlName)) {
- jettyHTTPDestination.doService(req, resp);
+ jettyHTTPDestination.doService(servletContext, req, resp);
}
}
}
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=618855&r1=618854&r2=618855&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Tue Feb 5 18:17:23 2008
@@ -29,6 +29,7 @@
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
+import javax.servlet.ServletContext;
import org.apache.cxf.Bus;
import org.apache.cxf.common.logging.LogUtils;
@@ -323,6 +324,9 @@
context.addHandler(sessionHandler);
}
contexts.addHandler(context);
+
+ ServletContext sc = context.getServletContext();
+ handler.setServletContext(sc);
final String smap = HttpUriMapper.getResourceBase(url.getPath());
handler.setName(smap);
Modified:
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=618855&r1=618854&r2=618855&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
Tue Feb 5 18:17:23 2008
@@ -584,30 +584,40 @@
outputParts = outputMessage.getMessageParts();
}
- boolean partFound = false;
-
while (params.hasNext()) {
String param = params.next();
- partFound = false;
+ MessagePartInfo inPart = null;
+ MessagePartInfo outPart = null;
for (MessagePartInfo part : inputParts) {
if (param.equals(part.getName().getLocalPart())) {
- partFound = true;
+ inPart = part;
break;
}
}
- // if not found, check output parts
- if (!partFound) {
- for (MessagePartInfo part : outputParts) {
- if (param.equals(part.getName().getLocalPart())) {
- partFound = true;
- break;
- }
+ //check output parts
+ for (MessagePartInfo part : outputParts) {
+ if (param.equals(part.getName().getLocalPart())) {
+ outPart = part;
+ break;
}
}
- if (!partFound) {
- break;
+ if (inPart == null && outPart == null) {
+ return false;
+ } else if (inPart != null
+ && outPart != null) {
+ if (inPart.isElement() != outPart.isElement()) {
+ return false;
+ }
+ if (inPart.isElement()
+ &&
!inPart.getElementQName().equals(outPart.getElementQName())) {
+ return false;
+ } else if (!inPart.isElement()
+ && !inPart.getTypeQName().equals(outPart.getTypeQName())) {
+ return false;
+ }
}
+
}
- return partFound;
+ return true;
}
}
Modified:
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=618855&r1=618854&r2=618855&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Tue Feb 5 18:17:23 2008
@@ -53,10 +53,12 @@
public class CodeGenTest extends ProcessorTestBase {
private JAXWSContainer processor;
private ClassLoader classLoader;
+ private String origCP;
@Before
public void setUp() throws Exception {
super.setUp();
+ origCP = System.getProperty("java.class.path");
File classFile = new java.io.File(output.getCanonicalPath() +
"/classes");
classFile.mkdir();
System.setProperty("java.class.path", getClassPath() +
classFile.getCanonicalPath()
@@ -75,6 +77,7 @@
@After
public void tearDown() {
super.tearDown();
+ System.setProperty("java.class.path", origCP);
processor = null;
env = null;
}
@@ -1142,5 +1145,14 @@
processor.setContext(env);
processor.execute();
}
-
+
+ @Test
+ public void testWrapperWithWildcard() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
getLocation("/wsdl2java_wsdl/cxf-1404/hello_world.wsdl"));
+ processor.setContext(env);
+ processor.execute();
+ Class sei =
classLoader.loadClass("org.apache.cxf.cxf1404.hello_world_soap_http.Greeter");
+ assertEquals(1, sei.getMethods().length);
+ assertFalse(Void.TYPE.equals(sei.getMethods()[0].getReturnType()));
+ }
}