Merge pull request #23034 from lukasj/m2
Integrate metro 3.0.0-M2
diff --git a/Jenkinsfile b/Jenkinsfile
index f5f5184..3504d12 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -210,7 +210,7 @@
bash -xe ./gfbuild.sh build_re_dev
'''
- // archiveArtifacts artifacts: 'bundles/*.zip'
+ archiveArtifacts artifacts: 'bundles/*.zip'
// junit testResults: 'test-results/build-unit-tests/results/junitreports/test_results_junit.xml'
stash includes: 'bundles/*', name: 'build-bundles'
}
diff --git a/appserver/security/webservices.security/src/main/java/com/sun/enterprise/security/webservices/SecurityServiceImpl.java b/appserver/security/webservices.security/src/main/java/com/sun/enterprise/security/webservices/SecurityServiceImpl.java
index f4ec326..e39cdf9 100644
--- a/appserver/security/webservices.security/src/main/java/com/sun/enterprise/security/webservices/SecurityServiceImpl.java
+++ b/appserver/security/webservices.security/src/main/java/com/sun/enterprise/security/webservices/SecurityServiceImpl.java
@@ -26,7 +26,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.glassfish.webservices.EjbRuntimeEndpointInfo;
import org.glassfish.webservices.SecurityService;
import org.glassfish.webservices.WebServiceContextImpl;
diff --git a/appserver/webservices/jsr109-impl/pom.xml b/appserver/webservices/jsr109-impl/pom.xml
index 429bf23..b893e72 100755
--- a/appserver/webservices/jsr109-impl/pom.xml
+++ b/appserver/webservices/jsr109-impl/pom.xml
@@ -17,17 +17,18 @@
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<parent>
<groupId>org.glassfish.main.webservices</groupId>
<artifactId>webservices</artifactId>
<version>6.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
</parent>
+
<artifactId>jsr109-impl</artifactId>
<packaging>glassfish-jar</packaging>
-
+
<name>JSR-109 implementation to deploy Metro</name>
<developers>
@@ -41,6 +42,7 @@
</roles>
</developer>
</developers>
+
<dependencies>
<dependency>
<groupId>org.glassfish.hk2</groupId>
@@ -106,17 +108,9 @@
<groupId>jakarta.ejb</groupId>
<artifactId>jakarta.ejb-api</artifactId>
</dependency>
- <!-- THIS MUST GO AWAY -->
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>4.0.1</version>
- </dependency>
- <!-- AS SOON AS THE ONE BELOW (OR NEWER) IS ADOPTED BY THE REST OF GF -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
- <version>5.0.0-M1</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.ejb</groupId>
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/Ejb3MessageDispatcher.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/Ejb3MessageDispatcher.java
index 98ae6aa..bba590c 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/Ejb3MessageDispatcher.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/Ejb3MessageDispatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,17 +16,23 @@
package org.glassfish.webservices;
+import static java.util.logging.Level.FINE;
+import static java.util.logging.Level.SEVERE;
+import static java.util.logging.Level.WARNING;
+import static org.glassfish.webservices.LogUtils.EJB_ENDPOINT_EXCEPTION;
+import static org.glassfish.webservices.LogUtils.ERROR_ON_EJB;
+import static org.glassfish.webservices.LogUtils.UNABLE_FIND_ADAPTER;
+import static org.glassfish.webservices.LogUtils.WEBSERVICE_DISPATCHER_INFO;
+
import java.io.IOException;
-
+import java.text.MessageFormat;
import java.util.logging.Logger;
-import java.util.logging.Level;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletContext;
import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
-import java.text.MessageFormat;
+
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
/**
* Implementation of the Ejb Message Dispatcher for EJB3 endpoints.
@@ -34,105 +40,89 @@
* @author Jerome Dochez
*/
public class Ejb3MessageDispatcher implements EjbMessageDispatcher {
-
+
private static final Logger logger = LogUtils.getLogger();
-
+
private static WsUtil wsUtil = new WsUtil();
-
+
@Override
- public void invoke(HttpServletRequest req,
- HttpServletResponse resp,
- ServletContext ctxt,
- EjbRuntimeEndpointInfo endpointInfo) {
+ public void invoke(HttpServletRequest req, HttpServletResponse resp, ServletContext ctxt, EjbRuntimeEndpointInfo endpointInfo) {
+
+ if (logger.isLoggable(FINE)) {
+ logger.log(FINE, WEBSERVICE_DISPATCHER_INFO, new Object[] { req.getMethod(), req.getRequestURI(), req.getQueryString() });
+ }
- if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE, LogUtils.WEBSERVICE_DISPATCHER_INFO,
- new Object[] {req.getMethod(), req.getRequestURI(), req.getQueryString()});
- }
String method = req.getMethod();
try {
switch (method) {
- case "POST":
- handlePost(req, resp, endpointInfo);
- break;
- case "GET":
- handleGet(req, resp, ctxt, endpointInfo);
- break;
- default:
- String errorMessage = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.UNSUPPORTED_METHOD_REQUEST),
- new Object[] {method, endpointInfo.getEndpoint().getEndpointName(),
- endpointInfo.getEndpointAddressUri()});
- logger.log(Level.WARNING, errorMessage);
- wsUtil.writeInvalidMethodType(resp, errorMessage);
- break;
+ case "POST":
+ handlePost(req, resp, endpointInfo);
+ break;
+ case "GET":
+ handleGet(req, resp, ctxt, endpointInfo);
+ break;
+ default:
+ String errorMessage = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.UNSUPPORTED_METHOD_REQUEST),
+ new Object[] { method, endpointInfo.getEndpoint().getEndpointName(), endpointInfo.getEndpointAddressUri() });
+ logger.log(WARNING, errorMessage);
+ wsUtil.writeInvalidMethodType(resp, errorMessage);
+ break;
}
- } catch(Exception e) {
- logger.log(Level.WARNING, LogUtils.EJB_ENDPOINT_EXCEPTION, e);
+ } catch (Exception e) {
+ logger.log(WARNING, EJB_ENDPOINT_EXCEPTION, e);
}
- }
-
- private void handlePost(HttpServletRequest req,
- HttpServletResponse resp,
- EjbRuntimeEndpointInfo endpointInfo)
- throws IOException {
+ }
+
+ private void handlePost(HttpServletRequest req, HttpServletResponse resp, EjbRuntimeEndpointInfo endpointInfo) throws IOException {
AdapterInvocationInfo adapterInfo = null;
ServletAdapter adapter;
- try {
+ try {
try {
adapterInfo = (AdapterInvocationInfo) endpointInfo.prepareInvocation(true);
adapter = adapterInfo.getAdapter();
if (adapter != null) {
- logger.log(Level.SEVERE, "!!! TODO: UNCOMMENT LINE BELLOW !!! ({0})", Ejb3MessageDispatcher.class.getName());
+ logger.log(SEVERE, "!!! TODO: UNCOMMENT LINE BELLOW !!! ({0})", Ejb3MessageDispatcher.class.getName());
// adapter.handle(null, req, resp);
} else {
- logger.log(Level.SEVERE, LogUtils.UNABLE_FIND_ADAPTER, endpointInfo.getEndpoint().getName());
+ logger.log(SEVERE, UNABLE_FIND_ADAPTER, endpointInfo.getEndpoint().getName());
}
} finally {
// Always call release, even if an error happened
// during getImplementor(), since some of the
- // preInvoke steps might have occurred. It's ok
+ // preInvoke steps might have occurred. It's ok
// if implementor is null.
endpointInfo.releaseImplementor((adapterInfo == null) ? null : adapterInfo.getInv());
- }
+ }
} catch (Throwable e) {
- String errorMessage = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.ERROR_ON_EJB),
- new Object[] {endpointInfo.getEndpoint().getEndpointName(),
- endpointInfo.getEndpointAddressUri(), e.getMessage()});
- logger.log(Level.WARNING, errorMessage, e);
+ String errorMessage = MessageFormat.format(logger.getResourceBundle().getString(ERROR_ON_EJB),
+ new Object[] { endpointInfo.getEndpoint().getEndpointName(), endpointInfo.getEndpointAddressUri(), e.getMessage() });
+ logger.log(WARNING, errorMessage, e);
String binding = endpointInfo.getEndpoint().getProtocolBinding();
WsUtil.raiseException(resp, binding, errorMessage);
}
- }
-
- private void handleGet(HttpServletRequest req,
- HttpServletResponse resp,
- ServletContext ctxt,
- EjbRuntimeEndpointInfo endpointInfo)
- throws IOException {
+ }
+
+ private void handleGet(HttpServletRequest req, HttpServletResponse resp, ServletContext ctxt, EjbRuntimeEndpointInfo endpointInfo) throws IOException {
AdapterInvocationInfo adapterInfo = null;
ServletAdapter adapter;
try {
- adapterInfo = (AdapterInvocationInfo) endpointInfo.prepareInvocation(true);
+ adapterInfo = (AdapterInvocationInfo) endpointInfo.prepareInvocation(true);
adapter = adapterInfo.getAdapter();
if (adapter != null) {
- logger.log(Level.SEVERE, "!!! TODO: UNCOMMENT LINE BELLOW !!! ({0})", Ejb3MessageDispatcher.class.getName());
+ logger.log(SEVERE, "!!! TODO: UNCOMMENT LINE BELLOW !!! ({0})", Ejb3MessageDispatcher.class.getName());
// adapter.publishWSDL(ctxt, req, resp);
} else {
- String message = "Invalid wsdl request " + req.getRequestURL();
+ String message = "Invalid wsdl request " + req.getRequestURL();
(new WsUtil()).writeInvalidMethodType(resp, message);
}
} catch (Throwable e) {
- String errorMessage = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.ERROR_ON_EJB),
- new Object[] {endpointInfo.getEndpoint().getEndpointName(),
- endpointInfo.getEndpointAddressUri(), e.getMessage()});
- logger.log(Level.WARNING, errorMessage, e);
+ String errorMessage = MessageFormat.format(logger.getResourceBundle().getString(ERROR_ON_EJB),
+ new Object[] { endpointInfo.getEndpoint().getEndpointName(), endpointInfo.getEndpointAddressUri(), e.getMessage() });
+ logger.log(WARNING, errorMessage, e);
String binding = endpointInfo.getEndpoint().getProtocolBinding();
WsUtil.raiseException(resp, binding, errorMessage);
} finally {
- endpointInfo.releaseImplementor((adapterInfo == null) ? null : adapterInfo.getInv());
+ endpointInfo.releaseImplementor((adapterInfo == null) ? null : adapterInfo.getInv());
}
- }
+ }
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/EjbMessageDispatcher.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/EjbMessageDispatcher.java
index 1b2113e..98bb3ab 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/EjbMessageDispatcher.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/EjbMessageDispatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,21 +16,15 @@
package org.glassfish.webservices;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletContext;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
/**
- * Common interface between jaxrpc 1.1 and jax-ws 2.0 for dispatching EJB
- * endpoint messages.
+ * Common interface between jaxrpc 1.1 and jax-ws 2.0 for dispatching EJB endpoint messages.
*
* @author Bhakti Mehta
*/
public interface EjbMessageDispatcher {
-
-
- public void invoke(HttpServletRequest req,
- HttpServletResponse resp,
- ServletContext ctxt,
- EjbRuntimeEndpointInfo endpointInfo);
+ void invoke(HttpServletRequest req, HttpServletResponse resp, ServletContext ctxt, EjbRuntimeEndpointInfo endpointInfo);
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/EjbWebServiceServlet.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/EjbWebServiceServlet.java
index 9f67634..9b1af4f 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/EjbWebServiceServlet.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/EjbWebServiceServlet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,37 +16,43 @@
package org.glassfish.webservices;
-
-import com.sun.enterprise.deployment.Application;
-import com.sun.enterprise.deployment.WebServiceEndpoint;
+import static jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND;
+import static jakarta.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
+import static jakarta.xml.ws.http.HTTPBinding.HTTP_BINDING;
+import static java.util.logging.Level.WARNING;
+import static org.glassfish.webservices.LogUtils.AUTH_FAILED;
+import static org.glassfish.webservices.LogUtils.EXCEPTION_THROWN;
+import static org.glassfish.webservices.LogUtils.INVALID_REQUEST_SCHEME;
import java.io.IOException;
import java.net.URL;
import java.net.URLEncoder;
-import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import jakarta.xml.ws.http.HTTPBinding;
+
import org.glassfish.api.logging.LogHelper;
-import org.glassfish.webservices.monitoring.Endpoint;
-import org.glassfish.webservices.monitoring.WebServiceEngineImpl;
-import org.glassfish.webservices.monitoring.WebServiceTesterServlet;
import org.glassfish.ejb.api.EjbEndpointFacade;
import org.glassfish.ejb.spi.WSEjbEndpointRegistry;
import org.glassfish.internal.api.Globals;
+import org.glassfish.webservices.monitoring.Endpoint;
+import org.glassfish.webservices.monitoring.WebServiceEngineImpl;
+import org.glassfish.webservices.monitoring.WebServiceTesterServlet;
+
+import com.sun.enterprise.deployment.Application;
+import com.sun.enterprise.deployment.WebServiceEndpoint;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
/**
* Servlet responsible for invoking EJB webservice endpoint.
*
- * Most of this code used to be in
- * com.sun.enterprise.webservice.EjbWebServiceValve.
+ * Most of this code used to be in com.sun.enterprise.webservice.EjbWebServiceValve.
*
- * @author Qingqing Ouyang
- * @author Kenneth Saks
- * @author Jan Luehe
+ * @author Qingqing Ouyang
+ * @author Kenneth Saks
+ * @author Jan Luehe
*/
public class EjbWebServiceServlet extends HttpServlet {
@@ -62,81 +68,76 @@
}
@Override
- protected void service(HttpServletRequest hreq,
- HttpServletResponse hresp)
- throws ServletException, IOException {
-
+ protected void service(HttpServletRequest hreq, HttpServletResponse hresp) throws ServletException, IOException {
String requestUriRaw = hreq.getRequestURI();
- String requestUri = (requestUriRaw.charAt(0) == '/') ?
- requestUriRaw.substring(1) : requestUriRaw;
+ String requestUri = (requestUriRaw.charAt(0) == '/') ? requestUriRaw.substring(1) : requestUriRaw;
String query = hreq.getQueryString();
-
- WebServiceEjbEndpointRegistry wsejbEndpointRegistry =
- (WebServiceEjbEndpointRegistry) Globals.getDefaultHabitat()
- .getService(WSEjbEndpointRegistry.class);
- EjbRuntimeEndpointInfo ejbEndpoint =
- wsejbEndpointRegistry.getEjbWebServiceEndpoint(requestUri, hreq.getMethod(), query);
+
+ WebServiceEjbEndpointRegistry wsejbEndpointRegistry = (WebServiceEjbEndpointRegistry)
+ Globals.getDefaultHabitat().getService(WSEjbEndpointRegistry.class);
+ EjbRuntimeEndpointInfo ejbEndpoint = wsejbEndpointRegistry.getEjbWebServiceEndpoint(requestUri, hreq.getMethod(), query);
if (requestUri.contains(WebServiceEndpoint.PUBLISHING_SUBCONTEXT) && ejbEndpoint == null) {
requestUri = requestUri.substring(0, requestUri.indexOf(WebServiceEndpoint.PUBLISHING_SUBCONTEXT) - 1);
- ejbEndpoint =
- wsejbEndpointRegistry.getEjbWebServiceEndpoint(requestUri, hreq.getMethod(), query);
+ ejbEndpoint = wsejbEndpointRegistry.getEjbWebServiceEndpoint(requestUri, hreq.getMethod(), query);
}
if (ejbEndpoint != null) {
/*
- * We can actually assert that ejbEndpoint is != null,
- * because this EjbWebServiceServlet would not have been
- * invoked otherwise
+ * We can actually assert that ejbEndpoint is != null, because this EjbWebServiceServlet would not have been invoked
+ * otherwise
*/
String scheme = hreq.getScheme();
WebServiceEndpoint wse = ejbEndpoint.getEndpoint();
if ("http".equals(scheme) && wse.isSecure()) {
- //redirect to correct protocol scheme if needed
- logger.log(Level.WARNING, LogUtils.INVALID_REQUEST_SCHEME,
- new Object[]{wse.getEndpointName(), "https", scheme});
+ // redirect to correct protocol scheme if needed
+ logger.log(WARNING, INVALID_REQUEST_SCHEME, new Object[] { wse.getEndpointName(), "https", scheme });
+
URL url = wse.composeEndpointAddress(new WsUtil().getWebServerInfoForDAS().getWebServerRootURL(true));
StringBuilder sb = new StringBuilder(url.toExternalForm());
if (query != null && query.trim().length() > 0) {
sb.append("?");
sb.append(query);
}
+
hresp.sendRedirect(URLEncoder.encode(sb.toString(), "UTF-8"));
} else {
boolean dispatch = true;
- // check if it is a tester servlet invocation
- if ("Tester".equalsIgnoreCase(query) && (!(HTTPBinding.HTTP_BINDING.equals(wse.getProtocolBinding())))) {
+
+ // Check if it is a tester servlet invocation
+ if ("Tester".equalsIgnoreCase(query) && (!(HTTP_BINDING.equals(wse.getProtocolBinding())))) {
Endpoint endpoint = WebServiceEngineImpl.getInstance().getEndpoint(hreq.getRequestURI());
- if ((endpoint.getDescriptor().isSecure())
- || (endpoint.getDescriptor().getMessageSecurityBinding() != null)) {
- String message = endpoint.getDescriptor().getWebService().getName()
- + "is a secured web service; Tester feature is not supported for secured services";
- (new WsUtil()).writeInvalidMethodType(hresp, message);
+ if ((endpoint.getDescriptor().isSecure()) || (endpoint.getDescriptor().getMessageSecurityBinding() != null)) {
+
+ new WsUtil().writeInvalidMethodType(hresp,
+ endpoint.getDescriptor().getWebService().getName() +
+ "is a secured web service; Tester feature is not supported for secured services");
+
return;
}
+
if (Boolean.parseBoolean(endpoint.getDescriptor().getDebugging())) {
dispatch = false;
- WebServiceTesterServlet.invoke(hreq, hresp,
- endpoint.getDescriptor());
+ WebServiceTesterServlet.invoke(hreq, hresp, endpoint.getDescriptor());
}
}
- if ("wsdl".equalsIgnoreCase(query) && (!(HTTPBinding.HTTP_BINDING.equals(wse.getProtocolBinding())))) {
+
+ if ("wsdl".equalsIgnoreCase(query) && (!(HTTP_BINDING.equals(wse.getProtocolBinding())))) {
if (wse.getWsdlExposed() != null && !Boolean.parseBoolean(wse.getWsdlExposed())) {
- hresp.sendError(HttpServletResponse.SC_NOT_FOUND);
+ hresp.sendError(SC_NOT_FOUND);
}
}
+
if (dispatch) {
dispatchToEjbEndpoint(hreq, hresp, ejbEndpoint);
}
}
} else {
- hresp.sendError(HttpServletResponse.SC_NOT_FOUND);
+ hresp.sendError(SC_NOT_FOUND);
}
}
- private void dispatchToEjbEndpoint(HttpServletRequest hreq,
- HttpServletResponse hresp,
- EjbRuntimeEndpointInfo ejbEndpoint) {
+ private void dispatchToEjbEndpoint(HttpServletRequest hreq, HttpServletResponse hresp, EjbRuntimeEndpointInfo ejbEndpoint) {
EjbEndpointFacade container = ejbEndpoint.getContainer();
ClassLoader savedClassLoader = null;
@@ -155,7 +156,6 @@
if (realmName == null) {
realmName = ejbEndpoint.getEndpoint().getRealm();
}
-
if (realmName == null) {
// use the same logic as BasicAuthenticator
realmName = hreq.getServerName() + ":" + hreq.getServerPort();
@@ -167,16 +167,14 @@
authenticated = secServ.doSecurity(hreq, ejbEndpoint, realmName, context);
}
- } catch(Exception e) {
- //sendAuthenticationEvents(false, hreq.getRequestURI(), null);
- LogHelper.log(logger, Level.WARNING, LogUtils.AUTH_FAILED,
- e, ejbEndpoint.getEndpoint().getEndpointName());
+ } catch (Exception e) {
+ // sendAuthenticationEvents(false, hreq.getRequestURI(), null);
+ LogHelper.log(logger, WARNING, AUTH_FAILED, e, ejbEndpoint.getEndpoint().getEndpointName());
}
if (!authenticated) {
- hresp.setHeader("WWW-Authenticate",
- "Basic realm=\"" + realmName + "\"");
- hresp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ hresp.setHeader("WWW-Authenticate", "Basic realm=\"" + realmName + "\"");
+ hresp.sendError(SC_UNAUTHORIZED);
return;
}
@@ -185,14 +183,15 @@
EjbMessageDispatcher msgDispatcher = ejbEndpoint.getMessageDispatcher();
msgDispatcher.invoke(hreq, hresp, getServletContext(), ejbEndpoint);
- } catch(Throwable t) {
- logger.log(Level.WARNING, LogUtils.EXCEPTION_THROWN, t);
+ } catch (Throwable t) {
+ logger.log(WARNING, EXCEPTION_THROWN, t);
} finally {
// remove any security context from the thread local before returning
if (secServ != null) {
secServ.resetSecurityContext();
secServ.resetPolicyContext();
}
+
// Restore context class loader
Thread.currentThread().setContextClassLoader(savedClassLoader);
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/JAXWSContainer.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/JAXWSContainer.java
index fb3df89..5c6c2a6 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/JAXWSContainer.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/JAXWSContainer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,74 +16,66 @@
package org.glassfish.webservices;
-import com.sun.xml.ws.api.server.Container;
-import com.sun.xml.ws.api.server.ResourceInjector;
-import com.sun.xml.ws.api.server.WSEndpoint;
-import com.sun.xml.ws.api.server.Module;
-
-import javax.servlet.ServletContext;
-import com.sun.xml.ws.transport.http.servlet.ServletModule;
-import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
-import com.sun.enterprise.deployment.WebServiceEndpoint;
-
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.internal.api.Globals;
+
+import com.sun.enterprise.deployment.WebServiceEndpoint;
+import com.sun.xml.ws.api.server.Container;
+import com.sun.xml.ws.api.server.Module;
+import com.sun.xml.ws.api.server.ResourceInjector;
import com.sun.xml.ws.api.server.ServerPipelineHook;
+import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
+
+import jakarta.servlet.ServletContext;
public class JAXWSContainer extends Container {
-
+
private final ServletContext servletContext;
private final WebServiceEndpoint endpoint;
private final JAXWSServletModule module;
- public JAXWSContainer(ServletContext servletContext,
- WebServiceEndpoint ep) {
+ public JAXWSContainer(ServletContext servletContext, WebServiceEndpoint ep) {
this.servletContext = servletContext;
this.endpoint = ep;
-
+
if (servletContext != null) {
- this.module = JAXWSServletModule
- .getServletModule(servletContext.getContextPath());
+ this.module = JAXWSServletModule.getServletModule(servletContext.getContextPath());
} else {
this.module = null;
}
-
}
-
- public void addEndpoint( ServletAdapter adapter) {
-
- if (module != null) {
- module.addEndpoint(endpoint.getEndpointAddressUri(),
- adapter);
- }
+ public void addEndpoint(ServletAdapter adapter) {
+ if (module != null) {
+ module.addEndpoint(endpoint.getEndpointAddressUri(), adapter);
+ }
}
public <T> T getSPI(Class<T> spiType) {
- if (ServletContext.class.isAssignableFrom( spiType)) {
- return (T)servletContext;
+ if (ServletContext.class.isAssignableFrom(spiType)) {
+ return (T) servletContext;
}
-
- if (ServerPipelineHook.class.isAssignableFrom(spiType)){
+
+ if (ServerPipelineHook.class.isAssignableFrom(spiType)) {
ServiceLocator h = Globals.getDefaultHabitat();
ServerPipeCreator s = h.getService(ServerPipeCreator.class);
s.init(endpoint);
- return((T)s);
+ return ((T) s);
}
if (ResourceInjector.class.isAssignableFrom(spiType)) {
// Give control of injection time only for servlet endpoints
- if(endpoint.implementedByWebComponent()) {
+ if (endpoint.implementedByWebComponent()) {
return (T) new ResourceInjectorImpl(endpoint);
}
}
if (Module.class.isAssignableFrom(spiType)) {
-
if (module != null) {
- return ((T)spiType.cast(module));
+ return ((T) spiType.cast(module));
}
}
+
return null;
}
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/JAXWSServlet.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/JAXWSServlet.java
index 7d40966..c2dc820 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/JAXWSServlet.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/JAXWSServlet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,23 +16,6 @@
package org.glassfish.webservices;
-//import com.sun.enterprise.Switch;
-
-import com.sun.enterprise.container.common.spi.util.ComponentEnvManager;
-import com.sun.enterprise.deployment.*;
-import com.sun.xml.ws.api.server.Adapter;
-import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
-import org.glassfish.webservices.monitoring.Endpoint;
-import org.glassfish.webservices.monitoring.WebServiceEngineImpl;
-import org.glassfish.webservices.monitoring.WebServiceTesterServlet;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import jakarta.xml.ws.WebServiceException;
-import jakarta.xml.ws.http.HTTPBinding;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Collection;
@@ -42,6 +25,28 @@
import org.glassfish.external.probe.provider.annotations.Probe;
import org.glassfish.external.probe.provider.annotations.ProbeParam;
import org.glassfish.external.probe.provider.annotations.ProbeProvider;
+import org.glassfish.webservices.monitoring.Endpoint;
+import org.glassfish.webservices.monitoring.WebServiceEngineImpl;
+import org.glassfish.webservices.monitoring.WebServiceTesterServlet;
+
+//import com.sun.enterprise.Switch;
+
+import com.sun.enterprise.container.common.spi.util.ComponentEnvManager;
+import com.sun.enterprise.deployment.JndiNameEnvironment;
+import com.sun.enterprise.deployment.WebBundleDescriptor;
+import com.sun.enterprise.deployment.WebComponentDescriptor;
+import com.sun.enterprise.deployment.WebServiceEndpoint;
+import com.sun.enterprise.deployment.WebServicesDescriptor;
+import com.sun.xml.ws.api.server.Adapter;
+import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
+
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.xml.ws.WebServiceException;
+import jakarta.xml.ws.http.HTTPBinding;
/**
* The JAX-WS dispatcher servlet.
@@ -67,7 +72,6 @@
wsEngine_ = WebServiceEngineImpl.getInstance();
// Register endpoints here
-
WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
ComponentEnvManager compEnvManager = wscImpl.getComponentEnvManager();
JndiNameEnvironment jndiNameEnv = compEnvManager.getCurrentJndiNameEnvironment();
@@ -78,16 +82,13 @@
throw new WebServiceException("Cannot intialize the JAXWSServlet for " + jndiNameEnv);
}
-
servletName = servletConfig.getServletName();
contextRoot = webBundle.getContextRoot();
- WebComponentDescriptor webComponent =
- webBundle.getWebComponentByCanonicalName(servletName);
+ WebComponentDescriptor webComponent = webBundle.getWebComponentByCanonicalName(servletName);
if (webComponent != null) {
WebServicesDescriptor webServices = webBundle.getWebServices();
- Collection<WebServiceEndpoint> endpoints =
- webServices.getEndpointsImplementedBy(webComponent);
+ Collection<WebServiceEndpoint> endpoints = webServices.getEndpointsImplementedBy(webComponent);
// Only 1 endpoint per servlet is supported, even though
// data structure implies otherwise.
endpoint = endpoints.iterator().next();
@@ -103,14 +104,12 @@
wsdlExposed = Boolean.parseBoolean(endpoint.getWsdlExposed());
}
// For web components, this will be relative to the web app
- // context root. Make sure there is a leading slash.
+ // context root. Make sure there is a leading slash.
String uri = endpoint.getEndpointAddressUri();
urlPattern = uri.startsWith("/") ? uri : "/" + uri;
} catch (Throwable t) {
- String msg = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.SERVLET_ENDPOINT_FAILURE),
- servletName);
+ String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.SERVLET_ENDPOINT_FAILURE), servletName);
logger.log(Level.WARNING, msg, t);
throw new ServletException(t);
}
@@ -122,16 +121,12 @@
}
}
- protected void doPost(HttpServletRequest request,
- HttpServletResponse response)
- throws ServletException {
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
startedEvent(endpoint.getEndpointAddressPath());
- if (("Tester".equalsIgnoreCase(request.getQueryString())) &&
- (!(HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding())))) {
+ if (("Tester".equalsIgnoreCase(request.getQueryString())) && (!(HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding())))) {
Endpoint endpt = wsEngine_.getEndpoint(request.getServletPath());
if (endpt != null && Boolean.parseBoolean(endpt.getDescriptor().getDebugging())) {
- WebServiceTesterServlet.invoke(request, response,
- endpt.getDescriptor());
+ WebServiceTesterServlet.invoke(request, response, endpt.getDescriptor());
endedEvent(endpoint.getEndpointAddressPath());
return;
}
@@ -156,36 +151,29 @@
}
@Probe(name = "startedEvent")
- private void startedEvent(
- @ProbeParam("endpointAddress") String endpointAddress) {
+ private void startedEvent(@ProbeParam("endpointAddress") String endpointAddress) {
}
@Probe(name = "endedEvent")
- private void endedEvent(
- @ProbeParam("endpointAddress") String endpointAddress) {
+ private void endedEvent(@ProbeParam("endpointAddress") String endpointAddress) {
}
- protected void doGet(HttpServletRequest request,
- HttpServletResponse response)
- throws ServletException, IOException {
- if (("Tester".equalsIgnoreCase(request.getQueryString())) &&
- (!(HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding())))) {
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ if (("Tester".equalsIgnoreCase(request.getQueryString())) && (!(HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding())))) {
Endpoint endpt = wsEngine_.getEndpoint(request.getServletPath());
- if ((endpt != null) && ((endpt.getDescriptor().isSecure()) ||
- (endpt.getDescriptor().getMessageSecurityBinding() != null) ||
- endpoint.hasSecurePipeline())) {
- String message = endpt.getDescriptor().getWebService().getName() +
- "is a secured web service; Tester feature is not supported for secured services";
+ if ((endpt != null)
+ && ((endpt.getDescriptor().isSecure()) || (endpt.getDescriptor().getMessageSecurityBinding() != null) || endpoint.hasSecurePipeline())) {
+ String message = endpt.getDescriptor().getWebService().getName()
+ + "is a secured web service; Tester feature is not supported for secured services";
(new WsUtil()).writeInvalidMethodType(response, message);
return;
}
if (endpt != null && Boolean.parseBoolean(endpt.getDescriptor().getDebugging())) {
- WebServiceTesterServlet.invoke(request, response,
- endpt.getDescriptor());
+ WebServiceTesterServlet.invoke(request, response, endpt.getDescriptor());
return;
}
@@ -194,8 +182,7 @@
// If it is not a "Tester request" and it is not a WSDL request,
// this might be a restful service
- if (!("WSDL".equalsIgnoreCase(request.getQueryString())) &&
- (HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding()))) {
+ if (!("WSDL".equalsIgnoreCase(request.getQueryString())) && (HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding()))) {
doPost(request, response);
return;
}
@@ -207,8 +194,7 @@
logger.log(Level.SEVERE, "!!! TODO: UNCOMMENT LINE BELLOW !!! ({0})", JAXWSServlet.class.getName());
// targetEndpoint.publishWSDL(getServletContext(), request, response);
} else {
- String message =
- "Invalid wsdl request " + request.getRequestURL();
+ String message = "Invalid wsdl request " + request.getRequestURL();
(new WsUtil()).writeInvalidMethodType(response, message);
}
} catch (Throwable t) {
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/MonitoringPipe.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/MonitoringPipe.java
index ea6dfe0..71d8523 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/MonitoringPipe.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/MonitoringPipe.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,26 +16,24 @@
package org.glassfish.webservices;
-import org.glassfish.webservices.monitoring.*;
-
-import javax.xml.namespace.QName;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import jakarta.xml.ws.http.HTTPBinding;
-
-import com.sun.xml.ws.api.pipe.Pipe;
-import com.sun.xml.ws.api.message.Message;
-import com.sun.xml.ws.api.pipe.PipeCloner;
-import com.sun.xml.ws.api.message.Packet;
-import com.sun.xml.ws.api.model.SEIModel;
-import com.sun.xml.ws.api.model.JavaMethod;
-import com.sun.xml.ws.api.model.wsdl.WSDLPort;
-import com.sun.xml.ws.api.server.WSEndpoint;
-import com.sun.xml.ws.api.pipe.ServerPipeAssemblerContext;
+import org.glassfish.webservices.monitoring.EndpointImpl;
+import org.glassfish.webservices.monitoring.HttpResponseInfoImpl;
+import org.glassfish.webservices.monitoring.JAXWSEndpointImpl;
+import org.glassfish.webservices.monitoring.ThreadLocalInfo;
+import org.glassfish.webservices.monitoring.WebServiceEngineImpl;
import com.sun.enterprise.deployment.WebServiceEndpoint;
-
+import com.sun.xml.ws.api.message.Packet;
+import com.sun.xml.ws.api.model.SEIModel;
+import com.sun.xml.ws.api.model.wsdl.WSDLPort;
+import com.sun.xml.ws.api.pipe.Pipe;
+import com.sun.xml.ws.api.pipe.PipeCloner;
+import com.sun.xml.ws.api.pipe.ServerPipeAssemblerContext;
import com.sun.xml.ws.api.pipe.helper.AbstractFilterPipeImpl;
+import com.sun.xml.ws.api.server.WSEndpoint;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
/**
* This pipe is used to do app server monitoring
@@ -48,8 +46,7 @@
private final WebServiceEndpoint endpoint;
private final WebServiceEngineImpl wsEngine;
- public MonitoringPipe(ServerPipeAssemblerContext ctxt, Pipe tail,
- WebServiceEndpoint ep) {
+ public MonitoringPipe(ServerPipeAssemblerContext ctxt, Pipe tail, WebServiceEndpoint ep) {
super(tail);
this.endpoint = ep;
this.seiModel = ctxt.getSEIModel();
@@ -72,36 +69,33 @@
}
public Packet process(Packet request) {
- // if it is a JBI request then skip the monitoring logic. This is done
- // as HTTPServletRequest/Response is not available when the invocation
+ // if it is a JBI request then skip the monitoring logic. This is done
+ // as HTTPServletRequest/Response is not available when the invocation
// is from JavaEE service engine.
String delegateClassName = request.webServiceContextDelegate.getClass().getName();
- if (delegateClassName.equals("com.sun.enterprise.jbi.serviceengine." +
- "bridge.transport.NMRServerConnection")) {
+ if (delegateClassName.equals("com.sun.enterprise.jbi.serviceengine." + "bridge.transport.NMRServerConnection")) {
return next.process(request);
}
-
+
// No monitoring available for restful services
- if("http://www.w3.org/2004/08/wsdl/http".equals(endpoint.getProtocolBinding())) {
+ if ("http://www.w3.org/2004/08/wsdl/http".equals(endpoint.getProtocolBinding())) {
return next.process(request);
}
SOAPMessageContext ctxt = new SOAPMessageContextImpl(request);
- HttpServletRequest httpRequest =
- (HttpServletRequest) request.get(jakarta.xml.ws.handler.MessageContext.SERVLET_REQUEST);
- HttpServletResponse httpResponse =
- (HttpServletResponse) request.get(jakarta.xml.ws.handler.MessageContext.SERVLET_RESPONSE);
+ HttpServletRequest httpRequest = (HttpServletRequest) request.get(jakarta.xml.ws.handler.MessageContext.SERVLET_REQUEST);
+ HttpServletResponse httpResponse = (HttpServletResponse) request.get(jakarta.xml.ws.handler.MessageContext.SERVLET_RESPONSE);
- String messageId=null;
+ String messageId = null;
JAXWSEndpointImpl endpt1;
- if(endpoint.implementedByWebComponent()) {
- endpt1 = (JAXWSEndpointImpl)wsEngine.getEndpoint(httpRequest.getServletPath());
+ if (endpoint.implementedByWebComponent()) {
+ endpt1 = (JAXWSEndpointImpl) wsEngine.getEndpoint(httpRequest.getServletPath());
} else {
- endpt1 = (JAXWSEndpointImpl)wsEngine.getEndpoint(httpRequest.getRequestURI());
+ endpt1 = (JAXWSEndpointImpl) wsEngine.getEndpoint(httpRequest.getRequestURI());
}
messageId = wsEngine.preProcessRequest(endpt1);
- if (messageId!=null) {
+ if (messageId != null) {
ctxt.put(EndpointImpl.MESSAGE_ID, messageId);
ThreadLocalInfo config = new ThreadLocalInfo(messageId, httpRequest);
wsEngine.getThreadLocal().set(config);
@@ -117,9 +111,8 @@
Packet pipeResponse = next.process(request);
- //Make the response packet available in the MessageContext
- ((SOAPMessageContextImpl)ctxt).setPacket(pipeResponse);
-
+ // Make the response packet available in the MessageContext
+ ((SOAPMessageContextImpl) ctxt).setPacket(pipeResponse);
try {
if (endpt1 != null) {
@@ -130,7 +123,7 @@
// temporary - need to send back SOAP fault message
}
- if (messageId!=null) {
+ if (messageId != null) {
HttpResponseInfoImpl info = new HttpResponseInfoImpl(httpResponse);
wsEngine.postProcessResponse(messageId, info);
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/SecurityService.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/SecurityService.java
index 9ca7aa9..eab84e9 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/SecurityService.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/SecurityService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -19,7 +19,7 @@
import com.sun.enterprise.deployment.ServiceReferenceDescriptor;
import com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor;
import com.sun.enterprise.web.WebModule;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import com.sun.xml.ws.assembler.metro.dev.ClientPipelineHook;
import java.security.Principal;
import org.jvnet.hk2.annotations.Contract;
@@ -30,13 +30,13 @@
*/
@Contract
public interface SecurityService {
+ Object mergeSOAPMessageSecurityPolicies(MessageSecurityBindingDescriptor desc);
- public Object mergeSOAPMessageSecurityPolicies(MessageSecurityBindingDescriptor desc);
- public boolean doSecurity(HttpServletRequest hreq, EjbRuntimeEndpointInfo ejbEndpoint, String realmName, WebServiceContextImpl context);
- public void resetSecurityContext();
- public void resetPolicyContext();
- public ClientPipelineHook getClientPipelineHook(ServiceReferenceDescriptor ref);
- public Principal getUserPrincipal(boolean isWeb);
- public boolean isUserInRole(WebModule webModule, Principal principal, String servletName, String role);
+ boolean doSecurity(HttpServletRequest hreq, EjbRuntimeEndpointInfo ejbEndpoint, String realmName, WebServiceContextImpl context);
+ Principal getUserPrincipal(boolean isWeb);
+ boolean isUserInRole(WebModule webModule, Principal principal, String servletName, String role);
+
+ void resetSecurityContext();
+ void resetPolicyContext();
+ ClientPipelineHook getClientPipelineHook(ServiceReferenceDescriptor ref);
}
-
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WSServletContextListener.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WSServletContextListener.java
index b2e9170..2c733af 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WSServletContextListener.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WSServletContextListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,15 +16,36 @@
package org.glassfish.webservices;
+import static java.util.logging.Level.WARNING;
+import static org.glassfish.webservices.LogUtils.DEPLOYMENT_FAILED;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import com.sun.enterprise.container.common.spi.util.ComponentEnvManager;
import com.sun.enterprise.container.common.spi.util.InjectionException;
import com.sun.enterprise.container.common.spi.util.InjectionManager;
-import com.sun.enterprise.deployment.*;
-import com.sun.enterprise.deployment.util.DOLUtils;
+import com.sun.enterprise.deployment.Addressing;
+import com.sun.enterprise.deployment.BundleDescriptor;
+import com.sun.enterprise.deployment.JndiNameEnvironment;
+import com.sun.enterprise.deployment.RespectBinding;
+import com.sun.enterprise.deployment.WebBundleDescriptor;
+import com.sun.enterprise.deployment.WebServiceEndpoint;
+import com.sun.enterprise.deployment.WebServicesDescriptor;
import com.sun.enterprise.deployment.runtime.ws.ReliabilityConfig;
+import com.sun.enterprise.deployment.util.DOLUtils;
import com.sun.xml.ws.api.BindingID;
import com.sun.xml.ws.api.WSBinding;
-import com.sun.xml.ws.api.server.*;
+import com.sun.xml.ws.api.server.Adapter;
+import com.sun.xml.ws.api.server.InstanceResolver;
+import com.sun.xml.ws.api.server.Invoker;
+import com.sun.xml.ws.api.server.SDDocumentSource;
+import com.sun.xml.ws.api.server.WSEndpoint;
import com.sun.xml.ws.developer.SchemaValidationFeature;
import com.sun.xml.ws.developer.StreamingAttachmentFeature;
import com.sun.xml.ws.rx.rm.api.ReliableMessagingFeature;
@@ -33,26 +54,18 @@
import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
import com.sun.xml.ws.transport.http.servlet.ServletAdapterList;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletContextEvent;
+import jakarta.servlet.ServletContextListener;
import jakarta.xml.ws.RespectBindingFeature;
import jakarta.xml.ws.WebServiceException;
import jakarta.xml.ws.WebServiceFeature;
+import jakarta.xml.ws.handler.Handler;
import jakarta.xml.ws.soap.AddressingFeature;
import jakarta.xml.ws.soap.MTOMFeature;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import jakarta.xml.ws.handler.Handler;
/**
- * This class serves for initialization of JAX-WS WSEndpoints when the context
- * is initialized on deployment.
+ * This class serves for initialization of JAX-WS WSEndpoints when the context is initialized on deployment.
*
* @author Rama Pulavarthi
*/
@@ -68,12 +81,12 @@
ComponentEnvManager compEnvManager = wscImpl.getComponentEnvManager();
JndiNameEnvironment jndiNameEnv = compEnvManager.getCurrentJndiNameEnvironment();
WebBundleDescriptor webBundle = null;
- if (jndiNameEnv != null && jndiNameEnv instanceof BundleDescriptor
- && ((BundleDescriptor) jndiNameEnv).getModuleType().equals(DOLUtils.warType())) {
+ if (jndiNameEnv != null && jndiNameEnv instanceof BundleDescriptor && ((BundleDescriptor) jndiNameEnv).getModuleType().equals(DOLUtils.warType())) {
webBundle = ((WebBundleDescriptor) jndiNameEnv);
} else {
throw new WebServiceException("Cannot intialize the JAXWSServlet for " + jndiNameEnv);
}
+
contextRoot = webBundle.getContextRoot();
WebServicesDescriptor webServices = webBundle.getWebServices();
try {
@@ -81,10 +94,9 @@
registerEndpoint(endpoint, sce.getServletContext());
}
} catch (Throwable t) {
- logger.log(Level.WARNING, LogUtils.DEPLOYMENT_FAILED, t);//TODO Fix Rama
+ logger.log(WARNING, DEPLOYMENT_FAILED, t);// TODO Fix Rama
sce.getServletContext().removeAttribute("ADAPTER_LIST");
- throw new RuntimeException("Servlet web service endpoint '"
- + "' failure", t);
+ throw new RuntimeException("Servlet web service endpoint '" + "' failure", t);
}
}
@@ -92,12 +104,11 @@
ClassLoader classLoader = servletContext.getClassLoader();
WsUtil wsu = new WsUtil();
// Complete all the injections that are required
- Class serviceEndpointClass =
- Class.forName(endpoint.getServletImplClass(), true, classLoader);
+ Class serviceEndpointClass = Class.forName(endpoint.getServletImplClass(), true, classLoader);
// Get the proper binding using BindingID
String givenBinding = endpoint.getProtocolBinding();
- //TODO Rama
+ // TODO Rama
// if(endpoint.getWsdlExposed() != null) {
// wsdlExposed = Boolean.parseBoolean(endpoint.getWsdlExposed());
// }
@@ -106,7 +117,6 @@
Collection docs = null;
if (endpoint.getWebService().hasWsdlFile()) {
-
URL pkgedWsdl = null;
try {
pkgedWsdl = servletContext.getResource('/' + endpoint.getWebService().getWsdlFileUri());
@@ -122,8 +132,7 @@
docs = wsu.getWsdlsAndSchemas(pkgedWsdl);
if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE, LogUtils.CREATING_ENDPOINT_FROM_PACKAGED_WSDL,
- primaryWsdl.getSystemId().toString());
+ logger.log(Level.FINE, LogUtils.CREATING_ENDPOINT_FROM_PACKAGED_WSDL, primaryWsdl.getSystemId().toString());
logger.log(Level.FINE, LogUtils.METADATA_DOCS);
for (Object source : docs) {
logger.log(Level.FINE, ((SDDocumentSource) source).getSystemId().toString());
@@ -133,11 +142,11 @@
}
// Create a Container to pass ServletContext and also inserting the pipe
- JAXWSContainer container = new JAXWSContainer(servletContext,
- endpoint);
+ JAXWSContainer container = new JAXWSContainer(servletContext, endpoint);
// Get catalog info
- java.net.URL catalogURL = servletContext.getResource('/' + endpoint.getBundleDescriptor().getDeploymentDescriptorDir() + File.separator + "jax-ws-catalog.xml");
+ java.net.URL catalogURL = servletContext
+ .getResource('/' + endpoint.getBundleDescriptor().getDeploymentDescriptorDir() + File.separator + "jax-ws-catalog.xml");
// Create Binding and set service side handlers on this binding
boolean mtomEnabled = wsu.getMtom(endpoint);
@@ -153,8 +162,8 @@
Addressing addressing = endpoint.getAddressing();
if (addressing != null) {
- AddressingFeature addressingFeature = new AddressingFeature(addressing.isEnabled(),
- addressing.isRequired(), getResponse(addressing.getResponses()));
+ AddressingFeature addressingFeature = new AddressingFeature(addressing.isEnabled(), addressing.isRequired(),
+ getResponse(addressing.getResponses()));
wsFeatures.add(addressingFeature);
}
RespectBinding rb = endpoint.getRespectBinding();
@@ -164,20 +173,23 @@
}
if (endpoint.getValidateRequest() != null && Boolean.parseBoolean(endpoint.getValidateRequest())) {
- //enable SchemaValidationFeature
+ // enable SchemaValidationFeature
wsFeatures.add(new SchemaValidationFeature());
}
if (endpoint.getStreamAttachments() != null && Boolean.parseBoolean(endpoint.getStreamAttachments())) {
- //enable StreamingAttachmentsFeature
+ // enable StreamingAttachmentsFeature
wsFeatures.add(new StreamingAttachmentFeature());
}
if (endpoint.getReliabilityConfig() != null) {
// TODO Revisit later after Metro provides generic method to pass partial configuration to Metro runtime.
- // Only partial configuration is specified in webservices DD, but the information for creating complete RM feature should be gathered
- // from wsdl policy, annotation or metro configuration file. For ex: RmProtocolVersion would be decided by policy assertion.
- // For now, the feature would be constructed from default values, overriding any configuration specified in wsdl or metro configuration file..
+ // Only partial configuration is specified in webservices DD, but the information for creating complete RM feature
+ // should be gathered
+ // from wsdl policy, annotation or metro configuration file. For ex: RmProtocolVersion would be decided by policy
+ // assertion.
+ // For now, the feature would be constructed from default values, overriding any configuration specified in wsdl or
+ // metro configuration file..
ReliabilityConfig rxConfig = endpoint.getReliabilityConfig();
ReliableMessagingFeatureBuilder rmbuilder = new ReliableMessagingFeatureBuilder(RmProtocolVersion.getDefault());
@@ -194,30 +206,28 @@
rmbuilder.messageRetransmissionInterval(Long.parseLong(rxConfig.getBaseRetransmissionInterval().trim()));
}
if (rxConfig.getRetransmissionExponentialBackoff() != null) {
- rmbuilder.retransmissionBackoffAlgorithm(Boolean.parseBoolean(rxConfig.getRetransmissionExponentialBackoff())
- ? ReliableMessagingFeature.BackoffAlgorithm.EXPONENTIAL
- : ReliableMessagingFeature.BackoffAlgorithm.getDefault());
+ rmbuilder.retransmissionBackoffAlgorithm(
+ Boolean.parseBoolean(rxConfig.getRetransmissionExponentialBackoff()) ? ReliableMessagingFeature.BackoffAlgorithm.EXPONENTIAL
+ : ReliableMessagingFeature.BackoffAlgorithm.getDefault());
}
if (rxConfig.getAcknowledgementInterval() != null) {
rmbuilder.acknowledgementTransmissionInterval(Long.parseLong(rxConfig.getAcknowledgementInterval().trim()));
}
if (rxConfig.getSequenceExpiration() != null) {
- logger.log(Level.INFO, LogUtils.CONFIGURATION_IGNORE_IN_WLSWS,
- new Object[]{endpoint.getEndpointName(), "<sequence-expiration>"});
+ logger.log(Level.INFO, LogUtils.CONFIGURATION_IGNORE_IN_WLSWS, new Object[] { endpoint.getEndpointName(), "<sequence-expiration>" });
}
if (rxConfig.getBufferRetryCount() != null) {
rmbuilder.maxMessageRetransmissionCount(Long.parseLong(rxConfig.getBufferRetryCount().trim()));
}
if (rxConfig.getBufferRetryDelay() != null) {
- logger.log(Level.INFO, LogUtils.CONFIGURATION_IGNORE_IN_WLSWS,
- new Object[]{endpoint.getEndpointName(), "<buffer-retry-delay>"});
+ logger.log(Level.INFO, LogUtils.CONFIGURATION_IGNORE_IN_WLSWS, new Object[] { endpoint.getEndpointName(), "<buffer-retry-delay>" });
}
wsFeatures.add(rmbuilder.build());
} else {
if (endpoint.getHttpResponseBufferSize() != null) {
- logger.log(Level.WARNING, LogUtils.CONFIGURATION_UNSUPPORTED_IN_WLSWS,
- new Object[]{endpoint.getEndpointName(), "<http-response-buffersize>"});
+ logger.log(WARNING, LogUtils.CONFIGURATION_UNSUPPORTED_IN_WLSWS,
+ new Object[] { endpoint.getEndpointName(), "<http-response-buffersize>" });
}
}
@@ -227,25 +237,22 @@
binding = BindingID.parse(givenBinding).createBinding();
}
- wsu.configureJAXWSServiceHandlers(endpoint, givenBinding,
- binding);
+ wsu.configureJAXWSServiceHandlers(endpoint, givenBinding, binding);
// See if it is configured with JAX-WS extension InstanceResolver annotation like
// @com.sun.xml.ws.developer.servlet.HttpSessionScope or @com.sun.xml.ws.developer.Stateful
InstanceResolver ir = InstanceResolver.createFromInstanceResolverAnnotation(serviceEndpointClass);
- //TODO - Implement 109 StatefulInstanceResolver ??
+ // TODO - Implement 109 StatefulInstanceResolver ??
if (ir == null) {
- //use our own InstanceResolver that does not call @PostConstuct method before
- //@Resource injections have happened.
+ // use our own InstanceResolver that does not call @PostConstuct method before
+ // @Resource injections have happened.
ir = new InstanceResolverImpl(serviceEndpointClass);
}
Invoker inv = ir.createInvoker();
- WSEndpoint wsep = WSEndpoint.create(
- serviceEndpointClass, // The endpoint class
+ WSEndpoint wsep = WSEndpoint.create(serviceEndpointClass, // The endpoint class
false, // we do not want JAXWS to process @HandlerChain
- inv,
- endpoint.getServiceName(), // the service QName
+ inv, endpoint.getServiceName(), // the service QName
endpoint.getWsdlPort(), // the port
container, // Our container with info on security/monitoring pipe
binding, // Derive binding
@@ -253,11 +260,11 @@
docs, // Collection of imported WSDLs and schema
catalogURL);
- //Fix for 6852 Add the ServletAdapter which implements the BoundEndpoint
+ // Fix for 6852 Add the ServletAdapter which implements the BoundEndpoint
// container.addEndpoint(wsep);
// For web components, this will be relative to the web app
- // context root. Make sure there is a leading slash.
+ // context root. Make sure there is a leading slash.
String uri = endpoint.getEndpointAddressUri();
String urlPattern = uri.startsWith("/") ? uri : "/" + uri;
@@ -265,8 +272,7 @@
// This is to enable JAXWS publish WSDLs with proper addresses
ServletAdapter adapter = null;
synchronized (this) {
- ServletAdapterList list =
- (ServletAdapterList) servletContext.getAttribute("ADAPTER_LIST");
+ ServletAdapterList list = (ServletAdapterList) servletContext.getAttribute("ADAPTER_LIST");
if (list == null) {
list = new ServletAdapterList();
servletContext.setAttribute("ADAPTER_LIST", list);
@@ -298,8 +304,7 @@
ServletContext servletContext = sce.getServletContext();
synchronized (this) {
- ServletAdapterList list =
- (ServletAdapterList) servletContext.getAttribute("ADAPTER_LIST");
+ ServletAdapterList list = (ServletAdapterList) servletContext.getAttribute("ADAPTER_LIST");
if (list != null) {
for (ServletAdapter x : list) {
x.getEndpoint().dispose();
@@ -309,24 +314,20 @@
InjectionManager injManager = wscImpl.getInjectionManager();
injManager.destroyManagedObject(handler);
} catch (InjectionException e) {
- logger.log(Level.WARNING, LogUtils.DESTORY_ON_HANDLER_FAILED,
- new Object[]{handler.getClass(), x.getEndpoint().getServiceName(), e.getMessage()});
+ logger.log(WARNING, LogUtils.DESTORY_ON_HANDLER_FAILED,
+ new Object[] { handler.getClass(), x.getEndpoint().getServiceName(), e.getMessage() });
continue;
}
- }
- }
+ }
+ }
servletContext.removeAttribute("ADAPTER_LIST");
}
JAXWSAdapterRegistry.getInstance().removeAdapter(contextRoot);
- /*
- Fix for bug 3932/4052 since the x.getEndpoint().dispose is being
- called above we do not need to call this explicitly
- try {
- (new WsUtil()).doPreDestroy(endpoint, classLoader);
- } catch (Throwable t) {
- logger.log(Level.WARNING, "@PreDestroy lifecycle call failed for service"
- + endpoint.getName(), t);
- }*/
+ /*
+ * Fix for bug 3932/4052 since the x.getEndpoint().dispose is being called above we do not need to call this explicitly
+ * try { (new WsUtil()).doPreDestroy(endpoint, classLoader); } catch (Throwable t) { logger.log(Level.WARNING,
+ * "@PreDestroy lifecycle call failed for service" + endpoint.getName(), t); }
+ */
}
JAXWSServletModule.destroy(contextRoot);
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WebServicesDeployer.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WebServicesDeployer.java
index 685cbc9..3a5ca69 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WebServicesDeployer.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WebServicesDeployer.java
@@ -16,31 +16,58 @@
package org.glassfish.webservices;
+import static java.util.logging.Level.FINE;
+import static java.util.logging.Level.SEVERE;
+import static org.glassfish.webservices.LogUtils.DIR_EXISTS;
+import static org.glassfish.webservices.LogUtils.ERROR_OCCURED;
+import static org.glassfish.webservices.LogUtils.ERROR_RESOLVING_CATALOG;
+import static org.glassfish.webservices.LogUtils.EXCEPTION_THROWN;
+import static org.glassfish.webservices.LogUtils.FAILED_LOADING_DD;
+import static org.glassfish.webservices.LogUtils.FILE_EXISTS;
+import static org.glassfish.webservices.LogUtils.PARSING_ERROR;
+import static org.glassfish.webservices.LogUtils.WSDL_PARSING_ERROR;
-import com.sun.enterprise.deployment.*;
-import com.sun.enterprise.deployment.util.DOLUtils;
-import com.sun.enterprise.deployment.archivist.Archivist;
-import org.glassfish.api.deployment.archive.ArchiveType;
-import com.sun.enterprise.deployment.web.AppListenerDescriptor;
-import com.sun.enterprise.util.io.FileUtils;
-import com.sun.enterprise.deploy.shared.FileArchive;
-import com.sun.enterprise.deploy.shared.ArchiveFactory;
-import com.sun.tools.ws.util.xml.XmlUtil;
-import org.glassfish.api.deployment.UndeployCommandParameters;
-import org.glassfish.loader.util.ASClassLoaderUtil;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.channels.FileChannel;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.glassfish.api.container.RequestDispatcher;
import org.glassfish.api.deployment.DeploymentContext;
import org.glassfish.api.deployment.MetaData;
+import org.glassfish.api.deployment.UndeployCommandParameters;
+import org.glassfish.api.deployment.archive.ArchiveType;
import org.glassfish.api.deployment.archive.ReadableArchive;
import org.glassfish.api.deployment.archive.WritableArchive;
-import org.glassfish.api.container.RequestDispatcher;
import org.glassfish.deployment.common.DeploymentException;
+import org.glassfish.javaee.core.deployment.JavaEEDeployer;
+import org.glassfish.loader.util.ASClassLoaderUtil;
import org.glassfish.web.deployment.descriptor.AppListenerDescriptorImpl;
import org.glassfish.web.deployment.util.WebServerInfo;
import org.glassfish.webservices.deployment.WebServicesDeploymentMBean;
-import org.glassfish.javaee.core.deployment.JavaEEDeployer;
-import org.glassfish.internal.api.JAXRPCCodeGenFacade;
import org.jvnet.hk2.annotations.Service;
-import jakarta.inject.Inject;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -48,20 +75,24 @@
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.servlet.SingleThreadModel;
-import java.io.*;
-import java.net.*;
-import java.nio.channels.FileChannel;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import com.sun.enterprise.deploy.shared.ArchiveFactory;
+import com.sun.enterprise.deploy.shared.FileArchive;
+import com.sun.enterprise.deployment.Application;
+import com.sun.enterprise.deployment.BundleDescriptor;
+import com.sun.enterprise.deployment.EjbBundleDescriptor;
+import com.sun.enterprise.deployment.ServiceReferenceDescriptor;
+import com.sun.enterprise.deployment.WebBundleDescriptor;
+import com.sun.enterprise.deployment.WebComponentDescriptor;
+import com.sun.enterprise.deployment.WebService;
+import com.sun.enterprise.deployment.WebServiceEndpoint;
+import com.sun.enterprise.deployment.WebServicesDescriptor;
+import com.sun.enterprise.deployment.archivist.Archivist;
+import com.sun.enterprise.deployment.util.DOLUtils;
+import com.sun.enterprise.deployment.web.AppListenerDescriptor;
+import com.sun.enterprise.util.io.FileUtils;
+import com.sun.tools.ws.util.xml.XmlUtil;
+import jakarta.inject.Inject;
/**
* Webservices module deployer. This is loaded from WebservicesContainer
@@ -70,9 +101,8 @@
* @author Rama Pulavarthi
*/
@Service
-public class WebServicesDeployer extends JavaEEDeployer<WebServicesContainer,WebServicesApplication> {
- public static final WebServiceDeploymentNotifier deploymentNotifier =
- new WebServiceDeploymentNotifierImpl();
+public class WebServicesDeployer extends JavaEEDeployer<WebServicesContainer, WebServicesApplication> {
+ public static final WebServiceDeploymentNotifier deploymentNotifier = new WebServiceDeploymentNotifierImpl();
public static WebServiceDeploymentNotifier getDeploymentNotifier() {
return deploymentNotifier;
@@ -94,20 +124,14 @@
public WebServicesDeployer() {
}
-
protected void cleanArtifacts(DeploymentContext deploymentContext) throws DeploymentException {
}
-
-
/**
- * Prepares the application bits for running in the application server.
- * For certain cases, this is exploding the jar file to a format the
- * ContractProvider instance is expecting, generating non portable
- * artifacts and other application specific tasks.
- * Failure to prepare should throw an exception which will cause the overall
- * deployment to fail.
+ * Prepares the application bits for running in the application server. For certain cases, this is exploding the jar
+ * file to a format the ContractProvider instance is expecting, generating non portable artifacts and other application
+ * specific tasks. Failure to prepare should throw an exception which will cause the overall deployment to fail.
*
* @param dc deployment context
* @return true if the prepare phase was successful
@@ -118,9 +142,9 @@
try {
Application app = dc.getModuleMetaData(Application.class);
- if (app==null) {
+ if (app == null) {
// hopefully the DOL gave a good message of the failure...
- logger.log(Level.SEVERE, LogUtils.FAILED_LOADING_DD);
+ logger.log(SEVERE, FAILED_LOADING_DD);
return false;
}
BundleDescriptor bundle = DOLUtils.getCurrentBundleForContext(dc);
@@ -135,18 +159,17 @@
}
});
-
Thread.currentThread().setContextClassLoader(newCl);
WebServicesDescriptor wsDesc = bundle.getWebServices();
for (WebService ws : wsDesc.getWebServices()) {
- setupJaxWSServiceForDeployment(dc, ws);
+ setupJaxWSServiceForDeployment(dc, ws);
}
- doWebServicesDeployment(app,dc);
+ doWebServicesDeployment(app, dc);
Thread.currentThread().setContextClassLoader(oldCl);
WebServicesContainer container = habitat.getService(WebServicesContainer.class);
WebServicesDeploymentMBean bean = container.getDeploymentBean();
WebServiceDeploymentNotifier notifier = getDeploymentNotifier();
- bean.deploy(wsDesc,notifier);
+ bean.deploy(wsDesc, notifier);
return true;
} catch (Exception ex) {
RuntimeException re = new RuntimeException(ex.getMessage());
@@ -155,36 +178,30 @@
}
}
-
protected void setupJaxWSServiceForDeployment(DeploymentContext dc, WebService ws) throws DeploymentException {
-
BundleDescriptor bundle = dc.getModuleMetaData(BundleDescriptor.class);
// for modules this is domains/<domain-name>/j2ee-modules/<module-name>
// for apps this is domains/<domain-name>/j2ee-apps/<app-name>/<foo_war> (in case of embedded wars)
- // or domains/<domain-name>/j2ee-apps/<app-name>/<foo_jar> (in case of embedded jars)
+ // or domains/<domain-name>/j2ee-apps/<app-name>/<foo_jar> (in case of embedded jars)
File moduleDir = dc.getSourceDir();
- //For modules this is domains/<domain-name>/generated/xml
- //Check with Hong about j2ee-modules
+ // For modules this is domains/<domain-name>/generated/xml
+ // Check with Hong about j2ee-modules
File wsdlDir = dc.getScratchDir("xml");
mkDirs(wsdlDir);
-
- //For modules this is domains/<domain-name>/generated/xml
- //Check with Hong about j2ee-modules
+ // For modules this is domains/<domain-name>/generated/xml
+ // Check with Hong about j2ee-modules
File stubsDir = dc.getScratchDir("ejb");
mkDirs(stubsDir);
-
- if (!DOLUtils.warType().equals(bundle.getModuleType()) &&
- !DOLUtils.ejbType().equals(bundle.getModuleType())) {
+ if (!DOLUtils.warType().equals(bundle.getModuleType()) && !DOLUtils.ejbType().equals(bundle.getModuleType())) {
// unknown module type with @WebService, just ignore...
return;
}
-
- wsdlDir = new File(wsdlDir, bundle.getWsdlDir().replaceAll("/", "\\"+File.separator));
+ wsdlDir = new File(wsdlDir, bundle.getWsdlDir().replaceAll("/", "\\" + File.separator));
// Check if catalog file is present, if so get mapped WSDLs
String wsdlFileUri;
@@ -192,27 +209,27 @@
try {
checkCatalog(bundle, ws, moduleDir);
} catch (DeploymentException e) {
- logger.log(Level.SEVERE, LogUtils.ERROR_RESOLVING_CATALOG);
+ logger.log(SEVERE, ERROR_RESOLVING_CATALOG);
}
if (ws.hasWsdlFile()) {
// If wsdl file is an http URL, download that WSDL and all embedded relative wsdls, schemas
if (ws.getWsdlFileUri().startsWith("http")) {
try {
- wsdlFileUri = downloadWsdlsAndSchemas( new URL(ws.getWsdlFileUri()), wsdlDir);
- } catch(Exception e) {
+ wsdlFileUri = downloadWsdlsAndSchemas(new URL(ws.getWsdlFileUri()), wsdlDir);
+ } catch (Exception e) {
throw new DeploymentException(e.toString(), e);
}
wsdlFile = new File(wsdlDir, wsdlFileUri);
} else {
wsdlFileUri = ws.getWsdlFileUri();
File wsdlFileAbs = new File(wsdlFileUri);
- wsdlFile = wsdlFileAbs.isAbsolute()? wsdlFileAbs : new File(moduleDir, wsdlFileUri);
+ wsdlFile = wsdlFileAbs.isAbsolute() ? wsdlFileAbs : new File(moduleDir, wsdlFileUri);
}
if (!wsdlFile.exists()) {
- String errorMessage = format(logger.getResourceBundle().getString(LogUtils.WSDL_NOT_FOUND),
- ws.getWsdlFileUri(), bundle.getModuleDescriptor().getArchiveUri());
- logger.log(Level.SEVERE, errorMessage);
+ String errorMessage = format(logger.getResourceBundle().getString(LogUtils.WSDL_NOT_FOUND), ws.getWsdlFileUri(),
+ bundle.getModuleDescriptor().getArchiveUri());
+ logger.log(SEVERE, errorMessage);
throw new DeploymentException(errorMessage);
}
}
@@ -225,10 +242,10 @@
*/
@Override
public Object loadMetaData(Class type, DeploymentContext dc) {
- //Moved the doWebServicesDeployment back to prepare after discussing with
- //Jerome
- //see this bug https://glassfish.dev.java.net/issues/show_bug.cgi?id=8080
- return true;
+ // Moved the doWebServicesDeployment back to prepare after discussing with
+ // Jerome
+ // see this bug https://glassfish.dev.java.net/issues/show_bug.cgi?id=8080
+ return true;
}
/**
@@ -238,22 +255,23 @@
*/
@Override
public MetaData getMetaData() {
- return new MetaData(false, null, new Class[] {Application.class});
+ return new MetaData(false, null, new Class[] { Application.class });
}
/**
- * This method downloads the main wsdl/schema and its imports in to the directory specified and returns the name of downloaded root
- * document.
+ * This method downloads the main wsdl/schema and its imports in to the directory specified and returns the name of
+ * downloaded root document.
+ *
* @param httpUrl
* @param wsdlDir
* @return Returns the name of the root file downloaded with the invocation.
* @throws Exception
*/
- private String downloadWsdlsAndSchemas( URL httpUrl, File wsdlDir) throws Exception {
+ private String downloadWsdlsAndSchemas(URL httpUrl, File wsdlDir) throws Exception {
// First make required directories and download this wsdl file
mkDirs(wsdlDir);
- String fileName = httpUrl.toString().substring(httpUrl.toString().lastIndexOf("/")+1);
- File toFile = new File(wsdlDir.getAbsolutePath()+File.separator+fileName);
+ String fileName = httpUrl.toString().substring(httpUrl.toString().lastIndexOf("/") + 1);
+ File toFile = new File(wsdlDir.getAbsolutePath() + File.separator + fileName);
downloadFile(httpUrl, toFile);
// Get a list of wsdl and schema relative imports in this wsdl
@@ -261,49 +279,43 @@
HashSet<Import> schemaRelativeImports = new HashSet<Import>();
HashSet<Import> wsdlIncludes = new HashSet<Import>();
HashSet<Import> schemaIncludes = new HashSet<Import>();
- parseRelativeImports(httpUrl, wsdlRelativeImports, wsdlIncludes,
- schemaRelativeImports, schemaIncludes);
+ parseRelativeImports(httpUrl, wsdlRelativeImports, wsdlIncludes, schemaRelativeImports, schemaIncludes);
wsdlRelativeImports.addAll(wsdlIncludes);
schemaRelativeImports.addAll(schemaIncludes);
// Download all schema relative imports
String urlWithoutFileName = httpUrl.toString().substring(0, httpUrl.toString().lastIndexOf("/"));
- for(Import next : schemaRelativeImports) {
+ for (Import next : schemaRelativeImports) {
String location = next.getLocation();
- location = location.replaceAll("/", "\\"+File.separator);
- if(location.lastIndexOf(File.separator) != -1) {
- File newDir = new File(wsdlDir.getAbsolutePath()+File.separator+
- location.substring(0, location.lastIndexOf(File.separator)));
+ location = location.replaceAll("/", "\\" + File.separator);
+ if (location.lastIndexOf(File.separator) != -1) {
+ File newDir = new File(wsdlDir.getAbsolutePath() + File.separator + location.substring(0, location.lastIndexOf(File.separator)));
mkDirs(newDir);
}
- downloadFile(new URL(urlWithoutFileName+"/"+next.getLocation()),
- new File(wsdlDir.getAbsolutePath()+File.separator+location));
+ downloadFile(new URL(urlWithoutFileName + "/" + next.getLocation()), new File(wsdlDir.getAbsolutePath() + File.separator + location));
}
// Download all wsdl relative imports
- for(Import next : wsdlRelativeImports) {
+ for (Import next : wsdlRelativeImports) {
String newWsdlLocation = next.getLocation();
- newWsdlLocation = newWsdlLocation.replaceAll("/", "\\"+File.separator);
+ newWsdlLocation = newWsdlLocation.replaceAll("/", "\\" + File.separator);
File newWsdlDir;
- if(newWsdlLocation.lastIndexOf(File.separator) != -1) {
- newWsdlDir = new File(wsdlDir.getAbsolutePath() + File.separator +
- newWsdlLocation.substring(0, newWsdlLocation.lastIndexOf(File.separator)));
+ if (newWsdlLocation.lastIndexOf(File.separator) != -1) {
+ newWsdlDir = new File(wsdlDir.getAbsolutePath() + File.separator + newWsdlLocation.substring(0, newWsdlLocation.lastIndexOf(File.separator)));
} else {
newWsdlDir = wsdlDir;
}
- downloadWsdlsAndSchemas( new URL(urlWithoutFileName+"/"+next.getLocation()), newWsdlDir);
+ downloadWsdlsAndSchemas(new URL(urlWithoutFileName + "/" + next.getLocation()), newWsdlDir);
}
return fileName;
}
+
// If catalog file is present, get the mapped WSDL for given WSDL and replace the value in
// the given WebService object
- private void checkCatalog(BundleDescriptor bundle, WebService ws, File moduleDir)
- throws DeploymentException {
+ private void checkCatalog(BundleDescriptor bundle, WebService ws, File moduleDir) throws DeploymentException {
// If no catalog file is present, return
- File catalogFile = new File(moduleDir,
- bundle.getDeploymentDescriptorDir() +
- File.separator + "jax-ws-catalog.xml");
- if(!catalogFile.exists()) {
+ File catalogFile = new File(moduleDir, bundle.getDeploymentDescriptorDir() + File.separator + "jax-ws-catalog.xml");
+ if (!catalogFile.exists()) {
return;
}
resolveCatalog(catalogFile, ws.getWsdlFileUri(), ws);
@@ -313,29 +325,27 @@
try {
-
- URL retVal = null;
+ URL retVal = null;
// Get an entity resolver
- org.xml.sax.EntityResolver resolver =
- XmlUtil.createEntityResolver(catalogFile.toURL());
+ org.xml.sax.EntityResolver resolver = XmlUtil.createEntityResolver(catalogFile.toURL());
org.xml.sax.InputSource source = resolver.resolveEntity(null, wsdlFile);
- if(source != null) {
+ if (source != null) {
String mappedEntry = source.getSystemId();
// For entries with relative paths, Entity resolver always
// return file://<absolute path
- if(mappedEntry.startsWith("file:")) {
- File f = new File(mappedEntry.substring(mappedEntry.indexOf(":")+1));
- if(!f.exists()) {
+ if (mappedEntry.startsWith("file:")) {
+ File f = new File(mappedEntry.substring(mappedEntry.indexOf(":") + 1));
+ if (!f.exists()) {
throw new DeploymentException(format(rb.getString(LogUtils.CATALOG_RESOLVER_ERROR), mappedEntry));
}
retVal = f.toURI().toURL();
- if(ws != null) {
+ if (ws != null) {
ws.setWsdlFileUri(f.getAbsolutePath());
ws.setWsdlFileUrl(retVal);
}
- } else if(mappedEntry.startsWith("http")) {
+ } else if (mappedEntry.startsWith("http")) {
retVal = new URL(mappedEntry);
- if(ws != null) {
+ if (ws != null) {
ws.setWsdlFileUrl(retVal);
}
}
@@ -343,10 +353,9 @@
return retVal;
} catch (Throwable t) {
- throw new DeploymentException(format(rb.getString(LogUtils.CATALOG_ERROR),
- catalogFile.getAbsolutePath(), t.getMessage()));
+ throw new DeploymentException(format(rb.getString(LogUtils.CATALOG_ERROR), catalogFile.getAbsolutePath(), t.getMessage()));
}
-
+
}
/**
@@ -368,8 +377,7 @@
srcChannel = new FileInputStream(src).getChannel();
destChannel = new FileOutputStream(dest).getChannel();
destChannel.transferFrom(srcChannel, 0, srcChannel.size());
- }
- finally {
+ } finally {
if (srcChannel != null) {
srcChannel.close();
}
@@ -383,7 +391,7 @@
InputStream is = null;
FileOutputStream os = null;
try {
- if(!toFile.createNewFile()) {
+ if (!toFile.createNewFile()) {
throw new Exception(format(rb.getString(LogUtils.FILECREATION_ERROR), toFile.getAbsolutePath()));
}
is = httpUrl.openStream();
@@ -391,9 +399,9 @@
os = new FileOutputStream(toFile, true);
int readCount;
byte[] buffer = new byte[10240]; // Read 10KB at a time
- while(true) {
+ while (true) {
readCount = is.read(buffer, 0, 10240);
- if(readCount != -1) {
+ if (readCount != -1) {
os.write(buffer, 0, readCount);
} else {
break;
@@ -417,24 +425,18 @@
* Collect all relative imports from a web service's main wsdl document.
*
* @param wsdlFileUrl
- * @param wsdlRelativeImports output param in which wsdl relative imports
- * will be added
+ * @param wsdlRelativeImports output param in which wsdl relative imports will be added
*
- * @param schemaRelativeImports output param in which schema relative
- * imports will be added
+ * @param schemaRelativeImports output param in which schema relative imports will be added
* @param schemaIncludes output param in which schema includes will be added
*/
- private void parseRelativeImports(URL wsdlFileUrl,
- Collection wsdlRelativeImports,
- Collection wsdlIncludes,
- Collection schemaRelativeImports,
- Collection schemaIncludes)
- throws Exception {
+ private void parseRelativeImports(URL wsdlFileUrl, Collection wsdlRelativeImports, Collection wsdlIncludes, Collection schemaRelativeImports,
+ Collection schemaIncludes) throws Exception {
// We will use our little parser rather than using JAXRPC's heavy weight WSDL parser
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
- //Validation is not needed as we want to be too strict in processing wsdls that are generated by buggy tools.
+ // Validation is not needed as we want to be too strict in processing wsdls that are generated by buggy tools.
factory.setExpandEntityReferences(false);
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
InputStream is = null;
@@ -448,76 +450,66 @@
procesWsdlIncludes(document, wsdlIncludes);
} catch (SAXParseException spe) {
// Error generated by the parser
- logger.log(Level.SEVERE, LogUtils.PARSING_ERROR,
- new Object[] {spe.getLineNumber() ,spe.getSystemId()});
+ logger.log(SEVERE, PARSING_ERROR, new Object[] { spe.getLineNumber(), spe.getSystemId() });
// Use the contained exception, if any
Exception x = spe;
if (spe.getException() != null) {
x = spe.getException();
}
- logger.log(Level.SEVERE, LogUtils.ERROR_OCCURED, x);
+ logger.log(SEVERE, ERROR_OCCURED, x);
} catch (Exception sxe) {
- logger.log(Level.SEVERE, LogUtils.WSDL_PARSING_ERROR, sxe.getMessage());
+ logger.log(SEVERE, WSDL_PARSING_ERROR, sxe.getMessage());
} finally {
try {
- if(is != null) {
+ if (is != null) {
is.close();
}
} catch (IOException io) {
- if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE, LogUtils.EXCEPTION_THROWN, io.getMessage());
+ if (logger.isLoggable(FINE)) {
+ logger.log(FINE, EXCEPTION_THROWN, io.getMessage());
}
}
}
}
- private void procesSchemaImports(Document document, Collection schemaImportCollection) throws SAXException,
- ParserConfigurationException, IOException {
- NodeList schemaImports =
- document.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "import");
+ private void procesSchemaImports(Document document, Collection schemaImportCollection) throws SAXException, ParserConfigurationException, IOException {
+ NodeList schemaImports = document.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "import");
addImportsAndIncludes(schemaImports, schemaImportCollection, "namespace", "schemaLocation");
}
- private void procesWsdlImports(Document document, Collection wsdlImportCollection) throws SAXException,
- ParserConfigurationException, IOException {
- NodeList wsdlImports =
- document.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "import");
+ private void procesWsdlImports(Document document, Collection wsdlImportCollection) throws SAXException, ParserConfigurationException, IOException {
+ NodeList wsdlImports = document.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "import");
addImportsAndIncludes(wsdlImports, wsdlImportCollection, "namespace", "location");
}
- private void procesSchemaIncludes(Document document, Collection schemaIncludeCollection) throws SAXException,
- ParserConfigurationException, IOException {
- NodeList schemaIncludes =
- document.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "include");
+ private void procesSchemaIncludes(Document document, Collection schemaIncludeCollection) throws SAXException, ParserConfigurationException, IOException {
+ NodeList schemaIncludes = document.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "include");
addImportsAndIncludes(schemaIncludes, schemaIncludeCollection, null, "schemaLocation");
}
- private void procesWsdlIncludes(Document document, Collection wsdlIncludesCollection) throws SAXException,
- ParserConfigurationException, IOException {
- NodeList wsdlIncludes =
- document.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "include");
+ private void procesWsdlIncludes(Document document, Collection wsdlIncludesCollection) throws SAXException, ParserConfigurationException, IOException {
+ NodeList wsdlIncludes = document.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "include");
addImportsAndIncludes(wsdlIncludes, wsdlIncludesCollection, null, "location");
}
- private void addImportsAndIncludes(NodeList list, Collection result,
- String namespace, String location) throws SAXException,
- ParserConfigurationException, IOException {
- for(int i=0; i<list.getLength(); i++) {
+ private void addImportsAndIncludes(NodeList list, Collection result, String namespace, String location)
+ throws SAXException, ParserConfigurationException, IOException {
+ for (int i = 0; i < list.getLength(); i++) {
String givenLocation = null;
Node element = list.item(i);
NamedNodeMap attrs = element.getAttributes();
- Node n= attrs.getNamedItem(location);
- if(n != null) {
+ Node n = attrs.getNamedItem(location);
+ if (n != null) {
givenLocation = n.getNodeValue();
}
- if(givenLocation == null || givenLocation.startsWith("http")) {
+ if (givenLocation == null || givenLocation.startsWith("http")) {
continue;
}
Import imp = new Import();
imp.setLocation(givenLocation);
- if(namespace != null) {
+ if (namespace != null) {
n = attrs.getNamedItem(namespace);
- if(n != null) {
+ if (n != null) {
imp.setNamespace(n.getNodeValue());
}
}
@@ -527,68 +519,63 @@
}
/**
- * Processes all the web services in the module and prepares for deployment.
- * The tasks include composing the endpoint publish url and generating WSDL in to the application repository
- * directory.
+ * Processes all the web services in the module and prepares for deployment. The tasks include composing the endpoint
+ * publish url and generating WSDL in to the application repository directory.
*
- * In JAX-WS, WSDL files are generated dynamically, hence skips the wsdl generation step unless explicitly requested
- * for WSDL file publishing via DD.
+ * In JAX-WS, WSDL files are generated dynamically, hence skips the wsdl generation step unless explicitly requested for
+ * WSDL file publishing via DD.
*
* @param app
* @param dc
* @throws Exception
*/
- private void doWebServicesDeployment(Application app, DeploymentContext dc)
- throws Exception{
-
+ private void doWebServicesDeployment(Application app, DeploymentContext dc) throws Exception {
Collection<WebService> webServices = new HashSet<WebService>();
// when there are multiple sub modules in ear, we only want to handle the ones local to this deployment context
- //First get the web services associated with module bundle descriptor.
+ // First get the web services associated with module bundle descriptor.
WebServicesDescriptor wsDesc = dc.getModuleMetaData(WebServicesDescriptor.class);
if (wsDesc != null && wsDesc.getWebServices().size() > 0) {
- if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE, LogUtils.WS_LOCAL,
- new Object[] {wsDesc.getWebServices().size(), getWebServiceDescriptors(app).size()});
+ if (logger.isLoggable(FINE)) {
+ logger.log(FINE, LogUtils.WS_LOCAL, new Object[] { wsDesc.getWebServices().size(), getWebServiceDescriptors(app).size() });
}
webServices.addAll(wsDesc.getWebServices());
}
- //Now get the web services associated with extension descriptors,ex: EJB WS in war.
+ // Now get the web services associated with extension descriptors,ex: EJB WS in war.
WebBundleDescriptor webBundleDesc = dc.getModuleMetaData(WebBundleDescriptor.class);
if (webBundleDesc != null) {
Collection<EjbBundleDescriptor> ejbBundleDescriptors = webBundleDesc.getExtensionsDescriptors(EjbBundleDescriptor.class);
for (EjbBundleDescriptor ejbBundleDescriptor : ejbBundleDescriptors) {
Collection wsInExtnDesc = ejbBundleDescriptor.getWebServices().getWebServices();
webServices.addAll(wsInExtnDesc);
- if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE, LogUtils.WS_VIA_EXT, wsInExtnDesc);
+ if (logger.isLoggable(FINE)) {
+ logger.log(FINE, LogUtils.WS_VIA_EXT, wsInExtnDesc);
}
}
}
// swap the deployment descriptors context-root with the one
// provided in the deployment request.
- //do not do for ejb in war case
- if (webBundleDesc!= null && webBundleDesc.getExtensionsDescriptors(EjbBundleDescriptor.class).size()==0) {
- if (dc.getAppProps().get("context-root") != null &&
- app.isVirtual() ) {
+ // do not do for ejb in war case
+ if (webBundleDesc != null && webBundleDesc.getExtensionsDescriptors(EjbBundleDescriptor.class).size() == 0) {
+ if (dc.getAppProps().get("context-root") != null && app.isVirtual()) {
- String contextRoot = ((String)dc.getAppProps().get("context-root"));
+ String contextRoot = ((String) dc.getAppProps().get("context-root"));
webBundleDesc.setContextRoot(contextRoot);
}
}
// Generate final wsdls for all web services and store them in
// the application repository directory.
- for(WebService next : webServices) {
+ for (WebService next : webServices) {
WsUtil wsUtil = new WsUtil();
// For JAXWS services, we rely on JAXWS RI to do WSL gen and publishing
// For JAXRPC we do it here in 109
- //however it is needed for file publishing for jaxws
- if(!next.hasFilePublishing()) {
- for(WebServiceEndpoint wsep : next.getEndpoints()) {
+ // however it is needed for file publishing for jaxws
+ if (!next.hasFilePublishing()) {
+ for (WebServiceEndpoint wsep : next.getEndpoints()) {
URL finalWsdlURL = wsep.composeFinalWsdlUrl(wsUtil.getWebServerInfoForDAS().getWebServerRootURL(wsep.isSecure()));
Set<ServiceReferenceDescriptor> serviceRefs = new HashSet<ServiceReferenceDescriptor>();
if (webBundleDesc != null) {
@@ -598,11 +585,10 @@
if (ejbBundleDesc != null) {
serviceRefs = ejbBundleDesc.getEjbServiceReferenceDescriptors();
} else {
- logger.log(Level.SEVERE, LogUtils.UNSUPPORTED_MODULE_TYPE,
- DOLUtils.getCurrentBundleForContext(dc).getModuleType());
+ logger.log(SEVERE, LogUtils.UNSUPPORTED_MODULE_TYPE, DOLUtils.getCurrentBundleForContext(dc).getModuleType());
}
}
- //if there's service-ref to this service update its
+ // if there's service-ref to this service update its
// wsdl-file value to point to the just exposed URL
for (ServiceReferenceDescriptor srd : serviceRefs) {
if (srd.getServiceName().equals(wsep.getServiceName())
@@ -615,20 +601,20 @@
// Even if deployer specified a wsdl file
// publish location, server can't assume it can access that
- // file system. Plus, it's cleaner to depend on a file stored
+ // file system. Plus, it's cleaner to depend on a file stored
// within the application repository rather than one directly
// exposed to the deployer. Name of final wsdl is derived based
- // on the location of its associated module. This prevents us
+ // on the location of its associated module. This prevents us
// from having write the module to disk in order to store the
// modified runtime info.
URL url = next.getWsdlFileUrl();
- if (url == null ) {
- File f = new File(dc.getSourceDir(),next.getWsdlFileUri()) ;
+ if (url == null) {
+ File f = new File(dc.getSourceDir(), next.getWsdlFileUri());
url = f.toURL();
}
// Create the generated WSDL in the generated directory; for that create the directories first
- File genXmlDir = dc.getScratchDir("xml");
+ File genXmlDir = dc.getScratchDir("xml");
String wsdlFileDir = next.getWsdlFileUri().substring(0, next.getWsdlFileUri().lastIndexOf('/'));
mkDirs(new File(genXmlDir, wsdlFileDir));
@@ -636,7 +622,7 @@
wsUtil.generateFinalWsdl(url, next, wsUtil.getWebServerInfoForDAS(), genWsdlFile);
}
}
- //Swap the servlet class name with a real servlet processing the SOAP requests.
+ // Swap the servlet class name with a real servlet processing the SOAP requests.
if (webBundleDesc != null) {
doWebServiceDeployment(webBundleDesc);
}
@@ -645,31 +631,24 @@
/**
* Prepares the servlet based web services specified in web.xml for deployment.
*
- * Swap the application written servlet implementation class for
- * one provided by the container. The original class is stored
- * as runtime information since it will be used as the servant at
- * dispatch time.
+ * Swap the application written servlet implementation class for one provided by the container. The original class is
+ * stored as runtime information since it will be used as the servant at dispatch time.
*/
- private void doWebServiceDeployment(WebBundleDescriptor webBunDesc)
- throws DeploymentException, MalformedURLException {
+ private void doWebServiceDeployment(WebBundleDescriptor webBunDesc) throws DeploymentException, MalformedURLException {
/**
- * Combining code from <code>com.sun.enterprise.deployment.backend.WebServiceDeployer</code>
- * in v2
+ * Combining code from <code>com.sun.enterprise.deployment.backend.WebServiceDeployer</code> in v2
*/
- Collection<WebServiceEndpoint> endpoints =
- webBunDesc.getWebServices().getEndpoints();
+ Collection<WebServiceEndpoint> endpoints = webBunDesc.getWebServices().getEndpoints();
ClassLoader cl = webBunDesc.getClassLoader();
WsUtil wsutil = new WsUtil();
- for(WebServiceEndpoint nextEndpoint : endpoints) {
+ for (WebServiceEndpoint nextEndpoint : endpoints) {
WebComponentDescriptor webComp = nextEndpoint.getWebComponentImpl();
- if( !nextEndpoint.hasServletImplClass() ) {
- throw new DeploymentException( format(rb.getString(
- LogUtils.DEPLOYMENT_BACKEND_CANNOT_FIND_SERVLET),
- nextEndpoint.getEndpointName()));
+ if (!nextEndpoint.hasServletImplClass()) {
+ throw new DeploymentException(format(rb.getString(LogUtils.DEPLOYMENT_BACKEND_CANNOT_FIND_SERVLET), nextEndpoint.getEndpointName()));
}
if (nextEndpoint.hasEndpointAddressUri()) {
@@ -677,10 +656,9 @@
webComp.addUrlPattern(nextEndpoint.getEndpointAddressUri());
}
- if( !nextEndpoint.getWebService().hasFilePublishing() ) {
+ if (!nextEndpoint.getWebService().hasFilePublishing()) {
String publishingUri = nextEndpoint.getPublishingUri();
- String publishingUrlPattern =
- (publishingUri.charAt(0) == '/') ?publishingUri : "/" + publishingUri + "/*";
+ String publishingUrlPattern = (publishingUri.charAt(0) == '/') ? publishingUri : "/" + publishingUri + "/*";
webComp.addUrlPattern(publishingUrlPattern);
}
@@ -693,39 +671,37 @@
* Now trying to figure the address from <code>com.sun.enterprise.webservice.WsUtil.java</code>
*/
// Get a URL for the root of the webserver, where the host portion
- // is a canonical host name. Since this will be used to compose the
+ // is a canonical host name. Since this will be used to compose the
// endpoint address that is written into WSDL, it's better to use
// hostname as opposed to IP address.
// The protocol and port will be based on whether the endpoint
// has a transport guarantee of INTEGRAL or CONFIDENTIAL.
- // If yes, https will be used. Otherwise, http will be used.
+ // If yes, https will be used. Otherwise, http will be used.
WebServerInfo wsi = new WsUtil().getWebServerInfoForDAS();
URL rootURL = wsi.getWebServerRootURL(nextEndpoint.isSecure());
String contextRoot = webBunDesc.getContextRoot();
URL actualAddress = nextEndpoint.composeEndpointAddress(rootURL, contextRoot);
- if (wsi.getHttpVS() != null && wsi.getHttpVS().getPort()!=0) {
- logger.log(Level.INFO, LogUtils.ENDPOINT_REGISTRATION,
- new Object[] {nextEndpoint.getEndpointName(), actualAddress});
+ if (wsi.getHttpVS() != null && wsi.getHttpVS().getPort() != 0) {
+ logger.log(Level.INFO, LogUtils.ENDPOINT_REGISTRATION, new Object[] { nextEndpoint.getEndpointName(), actualAddress });
}
}
}
private void addWSServletContextListener(WebBundleDescriptor webBunDesc) {
- for(AppListenerDescriptor appListner: webBunDesc.getAppListenerDescriptors()) {
- if(appListner.getListener().equals(WSServletContextListener.class.getName())) {
- //already registered
+ for (AppListenerDescriptor appListner : webBunDesc.getAppListenerDescriptors()) {
+ if (appListner.getListener().equals(WSServletContextListener.class.getName())) {
+ // already registered
return;
}
}
webBunDesc.addAppListenerDescriptor(new AppListenerDescriptorImpl(WSServletContextListener.class.getName()));
}
-
- private String format(String key, String ... values){
- return MessageFormat.format(key, (Object [])values);
+
+ private String format(String key, String... values) {
+ return MessageFormat.format(key, (Object[]) values);
}
- public static void moveFile(String sourceFile, String destFile)
- throws IOException {
+ public static void moveFile(String sourceFile, String destFile) throws IOException {
FileUtils.copy(sourceFile, destFile);
FileUtils.deleteFile(new File(sourceFile));
}
@@ -735,15 +711,15 @@
final WebServiceDeploymentNotifier notifier = getDeploymentNotifier();
deletePublishedFiles(container.getPublishedFiles());
Application app = container.getApplication();
- if ( app == null ) {
- // load uses context.getModuleMetaData(Application.class) to get the Application. If there's a deployment
+ if (app == null) {
+ // load uses context.getModuleMetaData(Application.class) to get the Application. If there's a deployment
// failure then "container" may not have initialized the application and container.getApplication() returns
- // null and we get NPE. So use context.getModuleMetaData(Application.class) always.
+ // null and we get NPE. So use context.getModuleMetaData(Application.class) always.
app = context.getModuleMetaData(Application.class);
}
- if ( app != null ) {
- for(WebService svc : getWebServiceDescriptors(app)) {
- for(WebServiceEndpoint endpoint : svc.getEndpoints()) {
+ if (app != null) {
+ for (WebService svc : getWebServiceDescriptors(app)) {
+ for (WebServiceEndpoint endpoint : svc.getEndpoints()) {
if (notifier != null) {
notifier.notifyUndeployed(endpoint);
}
@@ -759,7 +735,7 @@
WebServicesContainer container = habitat.getService(WebServicesContainer.class);
WebServicesDeploymentMBean bean = container.getDeploymentBean();
UndeployCommandParameters params = dc.getCommandParameters(UndeployCommandParameters.class);
- if (params != null) {
+ if (params != null) {
bean.undeploy(params.name);
}
}
@@ -770,23 +746,20 @@
Application app = context.getModuleMetaData(Application.class);
try {
publishedFiles = populateWsdlFilesForPublish(context, getWebServiceDescriptors(app));
- } catch(Exception e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
-
- return new WebServicesApplication(context, dispatcher, publishedFiles);
+ return new WebServicesApplication(context, dispatcher, publishedFiles);
}
/**
- * Populate the wsdl files entries to download (if any) (Only for webservices which
- * use file publishing).
+ * Populate the wsdl files entries to download (if any) (Only for webservices which use file publishing).
*
- * TODO File publishing currently works only for wsdls packaged in the application for jax-ws.
- * Need to publish the dynamically generated wsdls as well. Lazy creation of WSEndpoint objects prohibits it now.
+ * TODO File publishing currently works only for wsdls packaged in the application for jax-ws. Need to publish the
+ * dynamically generated wsdls as well. Lazy creation of WSEndpoint objects prohibits it now.
*/
- private Set<String> populateWsdlFilesForPublish(
- DeploymentContext dc, Set<WebService> webservices) throws IOException {
+ private Set<String> populateWsdlFilesForPublish(DeploymentContext dc, Set<WebService> webservices) throws IOException {
Set<String> publishedFiles = new HashSet<String>();
for (WebService webService : webservices) {
@@ -798,26 +771,24 @@
BundleDescriptor bundle = webService.getBundleDescriptor();
ArchiveType moduleType = bundle.getModuleType();
- //only EAR, WAR and EJB archives could contain wsdl files for publish
- if (moduleType==null || !(moduleType.equals(DOLUtils.earType()) ||
- moduleType.equals(DOLUtils.warType()) ||
- moduleType.equals(DOLUtils.ejbType()))) {
+ // only EAR, WAR and EJB archives could contain wsdl files for publish
+ if (moduleType == null
+ || !(moduleType.equals(DOLUtils.earType()) || moduleType.equals(DOLUtils.warType()) || moduleType.equals(DOLUtils.ejbType()))) {
return publishedFiles;
}
-
File sourceDir = dc.getScratchDir("xml");
File parent;
try {
URI clientPublishURI = webService.getClientPublishUrl().toURI();
- if(!clientPublishURI.isOpaque()) {
+ if (!clientPublishURI.isOpaque()) {
parent = new File(clientPublishURI);
} else {
- parent = new File(webService.getClientPublishUrl().getPath());
+ parent = new File(webService.getClientPublishUrl().getPath());
}
} catch (URISyntaxException e) {
- logger.log(Level.WARNING, LogUtils.EXCEPTION_THROWN, e);
+ logger.log(Level.WARNING, EXCEPTION_THROWN, e);
parent = new File(webService.getClientPublishUrl().getPath());
}
@@ -826,10 +797,8 @@
FileArchive archive = new FileArchive();
archive.open(sourceDir.toURI());
-
Enumeration entries = archive.entries(bundle.getWsdlDir());
-
while (entries.hasMoreElements()) {
String name = (String) entries.nextElement();
String wsdlName = stripWsdlDir(name, bundle);
@@ -851,7 +820,7 @@
private void deletePublishedFiles(Set<String> publishedFiles) {
if (publishedFiles != null) {
- for (String path: publishedFiles) {
+ for (String path : publishedFiles) {
File f = new File(path);
if (f.exists()) {
FileUtils.deleteFile(f);
@@ -859,23 +828,22 @@
}
}
}
+
/**
- * This is to be used for file publishing only. In case of wsdlImports and wsdlIncludes
- * we need to copy the nested wsdls from applications folder to the generated/xml folder
+ * This is to be used for file publishing only. In case of wsdlImports and wsdlIncludes we need to copy the nested wsdls
+ * from applications folder to the generated/xml folder
*
*/
- private void copyExtraFilesToGeneratedFolder( DeploymentContext context) throws IOException{
+ private void copyExtraFilesToGeneratedFolder(DeploymentContext context) throws IOException {
Archivist archivist = habitat.getService(Archivist.class);
- ReadableArchive archive = archiveFactory.openArchive(
- context.getSourceDir());
+ ReadableArchive archive = archiveFactory.openArchive(context.getSourceDir());
- WritableArchive archive2 = archiveFactory.createArchive(
- context.getScratchDir("xml"));
+ WritableArchive archive2 = archiveFactory.createArchive(context.getScratchDir("xml"));
// copy the additional webservice elements etc
archivist.copyExtraElements(archive, archive2);
-
+
}
/**
@@ -883,35 +851,30 @@
*/
private String stripWsdlDir(String entry, BundleDescriptor bundle) {
String wsdlDir = bundle.getWsdlDir();
- return entry.substring(wsdlDir.length()+1);
+ return entry.substring(wsdlDir.length() + 1);
}
/**
- * Return a set of all com.sun.enterprise.deployment.WebService
- * descriptors in the application.
+ * Return a set of all com.sun.enterprise.deployment.WebService descriptors in the application.
*/
private Set<WebService> getWebServiceDescriptors(Application app) {
Set<WebService> webServiceDescriptors = new HashSet<WebService>();
for (BundleDescriptor next : app.getBundleDescriptors()) {
- WebServicesDescriptor webServicesDesc =
- next.getWebServices();
+ WebServicesDescriptor webServicesDesc = next.getWebServices();
webServiceDescriptors.addAll(webServicesDesc.getWebServices());
}
return webServiceDescriptors;
}
private static void mkDirs(File f) {
- if (!f.mkdirs() && logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE, LogUtils.DIR_EXISTS, f);
+ if (!f.mkdirs() && logger.isLoggable(FINE)) {
+ logger.log(FINE, DIR_EXISTS, f);
}
}
private static void mkFile(File f) throws IOException {
- if (!f.createNewFile() && logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE, LogUtils.FILE_EXISTS, f);
+ if (!f.createNewFile() && logger.isLoggable(FINE)) {
+ logger.log(FINE, FILE_EXISTS, f);
}
}
}
-
-
-
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WsUtil.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WsUtil.java
index b590fae..05ee71b 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WsUtil.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WsUtil.java
@@ -32,10 +32,9 @@
import com.sun.enterprise.config.serverbeans.Config;
import com.sun.enterprise.util.LocalStringManagerImpl;
-import javax.servlet.http.*;
+import jakarta.servlet.http.*;
import javax.xml.namespace.QName;
-
import java.util.*;
import java.net.*;
import java.util.logging.Logger;
@@ -51,7 +50,7 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import org.glassfish.web.deployment.util.WebServerInfo;
import org.glassfish.web.deployment.util.VirtualServerInfo;
@@ -71,7 +70,6 @@
import org.xml.sax.SAXParseException;
import org.glassfish.api.admin.ServerEnvironment;
-
/**
* Web service related utilities.
*
@@ -80,26 +78,18 @@
public class WsUtil {
// proprietary property for enabling logging of stub requests/responses
- public static final String CLIENT_TRANSPORT_LOG_PROPERTY =
- "com.sun.enterprise.webservice.client.transport.log";
+ public static final String CLIENT_TRANSPORT_LOG_PROPERTY = "com.sun.enterprise.webservice.client.transport.log";
// xslt processing parameters for final wsdl transformation
- public static final String ENDPOINT_ADDRESS_PARAM_NAME =
- "endpointAddressParam";
+ public static final String ENDPOINT_ADDRESS_PARAM_NAME = "endpointAddressParam";
- public final String WSDL_IMPORT_NAMESPACE_PARAM_NAME =
- "wsdlImportNamespaceParam";
- public static final String WSDL_IMPORT_LOCATION_PARAM_NAME =
- "wsdlImportLocationParam";
- public static final String WSDL_INCLUDE_LOCATION_PARAM_NAME =
- "wsdlIncludeLocationParam";
+ public final String WSDL_IMPORT_NAMESPACE_PARAM_NAME = "wsdlImportNamespaceParam";
+ public static final String WSDL_IMPORT_LOCATION_PARAM_NAME = "wsdlImportLocationParam";
+ public static final String WSDL_INCLUDE_LOCATION_PARAM_NAME = "wsdlIncludeLocationParam";
- public final String SCHEMA_IMPORT_NAMESPACE_PARAM_NAME =
- "schemaImportNamespaceParam";
- public static final String SCHEMA_IMPORT_LOCATION_PARAM_NAME =
- "schemaImportLocationParam";
- public static final String SCHEMA_INCLUDE_LOCATION_PARAM_NAME =
- "schemaIncludeLocationParam";
+ public final String SCHEMA_IMPORT_NAMESPACE_PARAM_NAME = "schemaImportNamespaceParam";
+ public static final String SCHEMA_IMPORT_LOCATION_PARAM_NAME = "schemaImportLocationParam";
+ public static final String SCHEMA_INCLUDE_LOCATION_PARAM_NAME = "schemaIncludeLocationParam";
private Config config = null;
private List<NetworkListener> networkListeners = null;
@@ -108,86 +98,78 @@
config = WebServiceContractImpl.getInstance().getConfig();
}
- private static final String SECURITY_POLICY_NAMESPACE_URI =
- "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
+ private static final String SECURITY_POLICY_NAMESPACE_URI = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
private static final Logger logger = LogUtils.getLogger();
-
/**
* Serve up the FINAL wsdl associated with this web service.
+ *
* @return true for success, false for failure
*/
- public boolean handleGet(HttpServletRequest request,
- HttpServletResponse response,
- WebServiceEndpoint endpoint) throws IOException {
+ public boolean handleGet(HttpServletRequest request, HttpServletResponse response, WebServiceEndpoint endpoint) throws IOException {
MimeHeaders headers = getHeaders(request);
- if( hasSomeTextXmlContent(headers) ) {
- String message = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.GET_RECEIVED),
- endpoint.getEndpointName(), endpoint.getEndpointAddressUri());
+ if (hasSomeTextXmlContent(headers)) {
+ String message = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.GET_RECEIVED), endpoint.getEndpointName(),
+ endpoint.getEndpointAddressUri());
writeInvalidMethodType(response, message);
-
+
logger.info(message);
-
+
return false;
}
-
+
URL wsdlUrl = null;
String requestUriRaw = request.getRequestURI();
- String requestUri = (requestUriRaw.charAt(0) == '/') ?
- requestUriRaw.substring(1) : requestUriRaw;
+ String requestUri = (requestUriRaw.charAt(0) == '/') ? requestUriRaw.substring(1) : requestUriRaw;
String queryString = request.getQueryString();
WebService webService = endpoint.getWebService();
- if( queryString == null ) {
+ if (queryString == null) {
// Get portion of request uri representing location within a module
String wsdlPath = endpoint.getWsdlContentPath(requestUri);
- if( wsdlPath != null) {
- ModuleDescriptor module =
- webService.getBundleDescriptor().getModuleDescriptor();
+ if (wsdlPath != null) {
+ ModuleDescriptor module = webService.getBundleDescriptor().getModuleDescriptor();
- if( wsdlPath.equals(webService.getWsdlFileUri())){
+ if (wsdlPath.equals(webService.getWsdlFileUri())) {
// If the request is for the main wsdl document, return
// the final wsdl instead of the wsdl from the module.
wsdlUrl = webService.getWsdlFileUrl();
- } else if( isWsdlContent(wsdlPath,
- webService.getBundleDescriptor()) ) {
+ } else if (isWsdlContent(wsdlPath, webService.getBundleDescriptor())) {
// For relative document imports. These documents do not
// require modification during deployment, so serve them
- // up directly from the packaged module. isWsdlContent()
+ // up directly from the packaged module. isWsdlContent()
// check ensures we don't serve up arbitrary content from
// the module.
URL finalWsdlUrl = webService.getWsdlFileUrl();
String finalWsdlPath = finalWsdlUrl.getPath();
// remove the final wsdl uri from the above path
- String wsdlDirPath = finalWsdlPath.substring(0, finalWsdlPath.length()-webService.getWsdlFileUri().length());
+ String wsdlDirPath = finalWsdlPath.substring(0, finalWsdlPath.length() - webService.getWsdlFileUri().length());
File wsdlDir = new File(wsdlDirPath);
File wsdlFile = new File(wsdlDir, wsdlPath.replace('/', File.separatorChar));
try {
wsdlUrl = wsdlFile.toURL();
- } catch(MalformedURLException mue) {
- String msg = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.FAILURE_SERVING_WSDL),
- webService.getName());
+ } catch (MalformedURLException mue) {
+ String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.FAILURE_SERVING_WSDL), webService.getName());
logger.log(Level.INFO, msg, mue);
- }
-
+ }
+
}
}
- } else if( queryString.equalsIgnoreCase("WSDL") ) {
+ } else if (queryString.equalsIgnoreCase("WSDL")) {
wsdlUrl = webService.getWsdlFileUrl();
}
boolean success = false;
- if( wsdlUrl != null ) {
-
+ if (wsdlUrl != null) {
+
InputStream is = null;
try {
response.setContentType("text/xml");
@@ -201,20 +183,20 @@
if (wsdlUrl.toURI().equals(webService.getWsdlFileUrl().toURI())) {
// get the application module ID
try {
-
+
WebServerInfo wsi = getWebServerInfoForDAS();
URL url = webService.getWsdlFileUrl();
- File originalWsdlFile = new File(url.getPath()+"__orig");
- if(!originalWsdlFile.exists()) {
+ File originalWsdlFile = new File(url.getPath() + "__orig");
+ if (!originalWsdlFile.exists()) {
originalWsdlFile = new File(url.getPath());
}
generateFinalWsdl(originalWsdlFile.toURL(), webService, wsi, response.getOutputStream());
- } catch(Exception e) {
- // if this fail, we revert to service the untouched
+ } catch (Exception e) {
+ // if this fail, we revert to service the untouched
// repository item.
URLConnection urlCon = wsdlUrl.openConnection();
urlCon.setUseCaches(false);
- is = urlCon.getInputStream();
+ is = urlCon.getInputStream();
copyIsToOs(is, response.getOutputStream());
}
} else {
@@ -222,39 +204,35 @@
// caching problem.
URLConnection urlCon = wsdlUrl.openConnection();
urlCon.setUseCaches(false);
- is = urlCon.getInputStream();
+ is = urlCon.getInputStream();
copyIsToOs(is, response.getOutputStream());
}
success = true;
- if( logger.isLoggable(Level.FINE) ) {
+ if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, LogUtils.SERVING_FINAL_WSDL,
- new Object[] {wsdlUrl, request.getRequestURL() + (queryString != null ? ("?"+queryString) : "")});
+ new Object[] { wsdlUrl, request.getRequestURL() + (queryString != null ? ("?" + queryString) : "") });
}
- } catch(Exception e) {
- String msg = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.FAILURE_SERVING_WSDL),
- webService.getName());
+ } catch (Exception e) {
+ String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.FAILURE_SERVING_WSDL), webService.getName());
logger.log(Level.INFO, msg, e);
} finally {
- if(is != null) {
+ if (is != null) {
try {
is.close();
- } catch(IOException ex) {}
+ } catch (IOException ex) {
+ }
}
}
}
- if( !success ) {
- String message = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.INVALID_WSDL_REQUEST),
- request.getRequestURL() + (queryString != null ? ("?"+queryString) : ""),
- webService.getName()
- );
+ if (!success) {
+ String message = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.INVALID_WSDL_REQUEST),
+ request.getRequestURL() + (queryString != null ? ("?" + queryString) : ""), webService.getName());
logger.info(message);
writeInvalidMethodType(response, message);
}
-
+
return success;
}
@@ -264,11 +242,11 @@
while (len != -1) {
try {
len = is.read(buf, 0, buf.length);
- } catch (EOFException eof){
+ } catch (EOFException eof) {
break;
}
- if(len != -1) {
+ if (len != -1) {
os.write(buf, 0, len);
}
}
@@ -278,8 +256,8 @@
}
/**
- * All wsdl files and wsdl imported files live under a well-known
- * wsdl directory.
+ * All wsdl files and wsdl imported files live under a well-known wsdl directory.
+ *
* @param uri module uri
*/
public boolean isWsdlContent(String uri, BundleDescriptor bundle) {
@@ -288,41 +266,33 @@
}
/**
- * @return module-specific dedicated wsdl directory
+ * @return module-specific dedicated wsdl directory
*/
public String getWsdlDir(BundleDescriptor bundle) {
boolean isWar = bundle.getModuleType().equals(DOLUtils.warType());
return isWar ? "WEB-INF/wsdl" : "META-INF/wsdl";
}
-
-
/**
* Collect all relative imports from a web service's main wsdl document.
*
- *@param wsdlRelativeImports outupt param in which wsdl relative imports
- * will be added
+ * @param wsdlRelativeImports outupt param in which wsdl relative imports will be added
*
- *@param schemaRelativeImports outupt param in which schema relative
- * imports will be added
+ * @param schemaRelativeImports outupt param in which schema relative imports will be added
*/
- private void parseRelativeImports(URL wsdlFileUrl,
- Collection wsdlRelativeImports,
- Collection wsdlIncludes,
- Collection schemaRelativeImports,
- Collection schemaIncludes) {
+ private void parseRelativeImports(URL wsdlFileUrl, Collection wsdlRelativeImports, Collection wsdlIncludes, Collection schemaRelativeImports,
+ Collection schemaIncludes) {
// We will use our little parser rather than using JAXRPC's heavy weight WSDL parser
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
- //Validation is not needed as we don't want to be too strict in processing wsdls that could be generated by buggy tools.
+ // Validation is not needed as we don't want to be too strict in processing wsdls that could be generated by buggy
+ // tools.
factory.setExpandEntityReferences(false);
try {
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
} catch (ParserConfigurationException pce) {
logger.log(Level.FINE, LogUtils.PARSER_UNSUPPORTED_FEATURE,
- new Object[] {factory.getClass().getName(),
- "http://apache.org/xml/features/disallow-doctype-decl"
- });
+ new Object[] { factory.getClass().getName(), "http://apache.org/xml/features/disallow-doctype-decl" });
}
InputStream is = null;
try {
@@ -335,8 +305,7 @@
procesWsdlIncludes(document, wsdlIncludes);
} catch (SAXParseException spe) {
// Error generated by the parser
- logger.log(Level.SEVERE, LogUtils.PARSING_ERROR,
- new Object[] {spe.getLineNumber() ,spe.getSystemId()});
+ logger.log(Level.SEVERE, LogUtils.PARSING_ERROR, new Object[] { spe.getLineNumber(), spe.getSystemId() });
// Use the contained exception, if any
Exception x = spe;
if (spe.getException() != null) {
@@ -347,103 +316,88 @@
logger.log(Level.SEVERE, LogUtils.WSDL_PARSING_ERROR, sxe);
} finally {
try {
- if(is != null) {
+ if (is != null) {
is.close();
}
- } catch (IOException io) {}
+ } catch (IOException io) {
+ }
}
}
- private void addImportsAndIncludes(NodeList list, Collection result,
- String namespace, String location) throws SAXException,
- ParserConfigurationException, IOException, SAXParseException {
- for(int i=0; i<list.getLength(); i++) {
+ private void addImportsAndIncludes(NodeList list, Collection result, String namespace, String location)
+ throws SAXException, ParserConfigurationException, IOException, SAXParseException {
+ for (int i = 0; i < list.getLength(); i++) {
String givenLocation = null;
Node element = list.item(i);
NamedNodeMap attrs = element.getAttributes();
- Node n= attrs.getNamedItem(location);
- if(n != null) {
+ Node n = attrs.getNamedItem(location);
+ if (n != null) {
givenLocation = n.getNodeValue();
}
- if((givenLocation == null) ||
- (givenLocation.startsWith("http"))) {
+ if ((givenLocation == null) || (givenLocation.startsWith("http"))) {
continue;
}
Import imp = new Import();
imp.setLocation(givenLocation);
- if(namespace != null) {
+ if (namespace != null) {
n = attrs.getNamedItem(namespace);
- if(n != null) {
+ if (n != null) {
imp.setNamespace(n.getNodeValue());
}
}
result.add(imp);
- }
+ }
return;
}
-
- private void procesSchemaImports(Document document, Collection schemaImportCollection) throws SAXException,
- ParserConfigurationException, IOException {
- NodeList schemaImports =
- document.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "import");
+
+ private void procesSchemaImports(Document document, Collection schemaImportCollection) throws SAXException, ParserConfigurationException, IOException {
+ NodeList schemaImports = document.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "import");
addImportsAndIncludes(schemaImports, schemaImportCollection, "namespace", "schemaLocation");
}
- private void procesWsdlImports(Document document, Collection wsdlImportCollection) throws SAXException,
- ParserConfigurationException, IOException {
- NodeList wsdlImports =
- document.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "import");
+ private void procesWsdlImports(Document document, Collection wsdlImportCollection) throws SAXException, ParserConfigurationException, IOException {
+ NodeList wsdlImports = document.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "import");
addImportsAndIncludes(wsdlImports, wsdlImportCollection, "namespace", "location");
- }
+ }
- private void procesSchemaIncludes(Document document, Collection schemaIncludeCollection) throws SAXException,
- ParserConfigurationException, IOException{
- NodeList schemaIncludes =
- document.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "include");
+ private void procesSchemaIncludes(Document document, Collection schemaIncludeCollection) throws SAXException, ParserConfigurationException, IOException {
+ NodeList schemaIncludes = document.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "include");
addImportsAndIncludes(schemaIncludes, schemaIncludeCollection, null, "schemaLocation");
}
- private void procesWsdlIncludes(Document document, Collection wsdlIncludesCollection) throws SAXException,
- ParserConfigurationException, IOException{
- NodeList wsdlIncludes =
- document.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "include");
+ private void procesWsdlIncludes(Document document, Collection wsdlIncludesCollection) throws SAXException, ParserConfigurationException, IOException {
+ NodeList wsdlIncludes = document.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "include");
addImportsAndIncludes(wsdlIncludes, wsdlIncludesCollection, null, "location");
}
/**
- * Transform the deployed WSDL document for a given webservice by
- * replacing the ENDPOINT ADDRESS for each port with the actual
- * endpoint address on which it will be listening.
+ * Transform the deployed WSDL document for a given webservice by replacing the ENDPOINT ADDRESS for each port with the
+ * actual endpoint address on which it will be listening.
*
*/
- public void generateFinalWsdl(URL wsdlFileUrl, WebService webService, WebServerInfo wsi,
- File finalWsdlFile) throws Exception {
- OutputStream outputStream =
- new BufferedOutputStream(new FileOutputStream(finalWsdlFile));
+ public void generateFinalWsdl(URL wsdlFileUrl, WebService webService, WebServerInfo wsi, File finalWsdlFile) throws Exception {
+ OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(finalWsdlFile));
generateFinalWsdl(wsdlFileUrl, webService, wsi, outputStream);
-
+
}
-
- public void generateFinalWsdl(URL wsdlFileUrl, WebService webService, WebServerInfo wsi,
- OutputStream outputStream) throws Exception {
-
+
+ public void generateFinalWsdl(URL wsdlFileUrl, WebService webService, WebServerInfo wsi, OutputStream outputStream) throws Exception {
Collection wsdlRelativeImports = new HashSet();
Collection wsdlIncludes = new HashSet();
Collection schemaRelativeImports = new HashSet();
Collection schemaIncludes = new HashSet();
- if( webService.hasUrlPublishing() ) {
- parseRelativeImports(wsdlFileUrl, wsdlRelativeImports,
- wsdlIncludes, schemaRelativeImports, schemaIncludes);
+ if (webService.hasUrlPublishing()) {
+ parseRelativeImports(wsdlFileUrl, wsdlRelativeImports, wsdlIncludes, schemaRelativeImports, schemaIncludes);
}
-
+
Collection endpoints = webService.getEndpoints();
// a WSDL file can contain several ports associated to a service.
- // however Deployment descriptors can be expressed in two ways
+ // however Deployment descriptors can be expressed in two ways
// to describe such a scenario in webservices.xml :
- // - One webservice-description with 2 port-components
- // - Two webservice-description with 1 port-component
+ // - One webservice-description with 2 port-components
+ // - Two webservice-description with 1 port-component
// The issue with #1, is that we need to configure the XSL with
// the two ports so that the resulting unique WSDL has the correct
// endpoint information and the JAXRPC stubs generated correctly.
@@ -451,125 +405,103 @@
// descriptor pointing to the same WSDL file...
Collection endpointsCopy = new ArrayList();
endpointsCopy.addAll(endpoints);
-
+
BundleDescriptor bundle = webService.getBundleDescriptor();
WebServicesDescriptor wsd = bundle.getWebServices();
Collection webServices = wsd.getWebServices();
- if (webServices.size()>1) {
- for (Iterator wsIter = webServices.iterator();wsIter.hasNext();) {
+ if (webServices.size() > 1) {
+ for (Iterator wsIter = webServices.iterator(); wsIter.hasNext();) {
WebService aWS = (WebService) wsIter.next();
if (webService.getName().equals(aWS.getName())) {
continue;
}
// this is another web service defined in the same bundle.
// let's check if it points to the same WSDL file
- if ((webService.getWsdlFileUri() != null) &&
- (aWS.getWsdlFileUri() != null) &&
- (webService.getWsdlFileUri().equals(aWS.getWsdlFileUri()))) {
+ if ((webService.getWsdlFileUri() != null) && (aWS.getWsdlFileUri() != null) && (webService.getWsdlFileUri().equals(aWS.getWsdlFileUri()))) {
endpointsCopy.addAll(aWS.getEndpoints());
- } else if ((webService.getWsdlFileUrl() != null) &&
- (aWS.getWsdlFileUrl() != null) &&
- ((webService.getWsdlFileUrl().toString())
- .equals(aWS.getWsdlFileUrl().toString()))) {
+ } else if ((webService.getWsdlFileUrl() != null) && (aWS.getWsdlFileUrl() != null)
+ && ((webService.getWsdlFileUrl().toString()).equals(aWS.getWsdlFileUrl().toString()))) {
endpointsCopy.addAll(aWS.getEndpoints());
}
}
}
-
- // Load the wsdl file bytes with caching turned off. This is
+ // Load the wsdl file bytes with caching turned off. This is
// to avoid a jar url consistency problem that can arise if we
// overwrite the module file later on in deployment.
InputStream wsdlInputStream = new BufferedInputStream(wsdlFileUrl.openStream());
Source XsltWsdlDocument = new StreamSource(wsdlInputStream);
- Templates templates = createTemplatesFor
- (endpointsCopy, wsdlRelativeImports, wsdlIncludes,
- schemaRelativeImports, schemaIncludes);
-
- Transformer transformer = templates.newTransformer();
+ Templates templates = createTemplatesFor(endpointsCopy, wsdlRelativeImports, wsdlIncludes, schemaRelativeImports, schemaIncludes);
+ Transformer transformer = templates.newTransformer();
// WSDL is associated with webservice, but url is endpoint-specific,
// so let WebService choose which endpoint to use.
- WebServiceEndpoint endpointForImport =
- webService.pickEndpointForRelativeImports();
- URL root= wsi.getWebServerRootURL(endpointForImport.isSecure());
+ WebServiceEndpoint endpointForImport = webService.pickEndpointForRelativeImports();
+ URL root = wsi.getWebServerRootURL(endpointForImport.isSecure());
URL finalWsdlUrl = endpointForImport.composeFinalWsdlUrl(root);
-
+
int wsdlImportNum = 0;
- for(Iterator iter = wsdlRelativeImports.iterator(); iter.hasNext();){
+ for (Iterator iter = wsdlRelativeImports.iterator(); iter.hasNext();) {
Import next = (Import) iter.next();
- transformer.setParameter
- (WSDL_IMPORT_NAMESPACE_PARAM_NAME + wsdlImportNum,
- next.getNamespace());
-
+ transformer.setParameter(WSDL_IMPORT_NAMESPACE_PARAM_NAME + wsdlImportNum, next.getNamespace());
+
// Convert each relative import into an absolute import, using
// the final wsdl's Url as the context
- URL relativeUrl = new URL(finalWsdlUrl, next.getLocation());
- transformer.setParameter
- (WSDL_IMPORT_LOCATION_PARAM_NAME + wsdlImportNum, relativeUrl);
-
+ URL relativeUrl = new URL(finalWsdlUrl, next.getLocation());
+ transformer.setParameter(WSDL_IMPORT_LOCATION_PARAM_NAME + wsdlImportNum, relativeUrl);
+
wsdlImportNum++;
}
int schemaImportNum = 0;
- for(Iterator iter = schemaRelativeImports.iterator(); iter.hasNext();){
+ for (Iterator iter = schemaRelativeImports.iterator(); iter.hasNext();) {
Import next = (Import) iter.next();
- transformer.setParameter
- (SCHEMA_IMPORT_NAMESPACE_PARAM_NAME + schemaImportNum,
- next.getNamespace());
-
+ transformer.setParameter(SCHEMA_IMPORT_NAMESPACE_PARAM_NAME + schemaImportNum, next.getNamespace());
+
// Convert each relative import into an absolute import, using
// the final wsdl's Url as the context
- URL relativeUrl = new URL(finalWsdlUrl, next.getLocation());
- transformer.setParameter
- (SCHEMA_IMPORT_LOCATION_PARAM_NAME + schemaImportNum,
- relativeUrl);
-
+ URL relativeUrl = new URL(finalWsdlUrl, next.getLocation());
+ transformer.setParameter(SCHEMA_IMPORT_LOCATION_PARAM_NAME + schemaImportNum, relativeUrl);
+
schemaImportNum++;
- }
+ }
int wsdlIncludeNum = 0;
- for(Iterator iter = wsdlIncludes.iterator(); iter.hasNext();){
+ for (Iterator iter = wsdlIncludes.iterator(); iter.hasNext();) {
Import next = (Import) iter.next();
- URL relativeUrl = new URL(finalWsdlUrl, next.getLocation());
- transformer.setParameter
- (WSDL_INCLUDE_LOCATION_PARAM_NAME + wsdlIncludeNum, relativeUrl);
+ URL relativeUrl = new URL(finalWsdlUrl, next.getLocation());
+ transformer.setParameter(WSDL_INCLUDE_LOCATION_PARAM_NAME + wsdlIncludeNum, relativeUrl);
wsdlIncludeNum++;
}
int schemaIncludeNum = 0;
- for(Iterator iter = schemaIncludes.iterator(); iter.hasNext();){
+ for (Iterator iter = schemaIncludes.iterator(); iter.hasNext();) {
Import next = (Import) iter.next();
- URL relativeUrl = new URL(finalWsdlUrl, next.getLocation());
- transformer.setParameter
- (SCHEMA_INCLUDE_LOCATION_PARAM_NAME + schemaIncludeNum,
- relativeUrl);
+ URL relativeUrl = new URL(finalWsdlUrl, next.getLocation());
+ transformer.setParameter(SCHEMA_INCLUDE_LOCATION_PARAM_NAME + schemaIncludeNum, relativeUrl);
schemaIncludeNum++;
- }
+ }
int endpointNum = 0;
- for(Iterator iter = endpointsCopy.iterator(); iter.hasNext();) {
+ for (Iterator iter = endpointsCopy.iterator(); iter.hasNext();) {
WebServiceEndpoint next = (WebServiceEndpoint) iter.next();
// Get a URL for the root of the webserver, where the host portion
- // is a canonical host name. Since this will be used to compose the
+ // is a canonical host name. Since this will be used to compose the
// endpoint address that is written into WSDL, it's better to use
// hostname as opposed to IP address.
- // The protocol and port will be based on whether the endpoint
+ // The protocol and port will be based on whether the endpoint
// has a transport guarantee of INTEGRAL or CONFIDENTIAL.
- // If yes, https will be used. Otherwise, http will be used.
+ // If yes, https will be used. Otherwise, http will be used.
URL rootURL = wsi.getWebServerRootURL(next.isSecure());
URL actualAddress = next.composeEndpointAddress(rootURL);
- transformer.setParameter(ENDPOINT_ADDRESS_PARAM_NAME + endpointNum,
- actualAddress.toExternalForm());
+ transformer.setParameter(ENDPOINT_ADDRESS_PARAM_NAME + endpointNum, actualAddress.toExternalForm());
- String endpointType = next.implementedByEjbComponent() ?
- "EJB" : "Servlet";
- logger.log(Level.INFO, LogUtils.ENDPOINT_REGISTRATION,
- new Object[] {"[" + endpointType + "] " + next.getEndpointName(), actualAddress});
+ String endpointType = next.implementedByEjbComponent() ? "EJB" : "Servlet";
+ logger.log(Level.INFO, LogUtils.ENDPOINT_REGISTRATION, new Object[] { "[" + endpointType + "] " + next.getEndpointName(), actualAddress });
endpointNum++;
}
@@ -581,61 +513,58 @@
return;
}
- /**
- * Accessing wsdl URL might involve file system access, so wrap
- * operation in a doPrivileged block.
+ /**
+ * Accessing wsdl URL might involve file system access, so wrap operation in a doPrivileged block.
*/
- public URL privilegedGetServiceRefWsdl
- (ServiceReferenceDescriptor desc) throws Exception {
+ public URL privilegedGetServiceRefWsdl(ServiceReferenceDescriptor desc) throws Exception {
URL wsdlFileURL;
try {
final ServiceReferenceDescriptor serviceRef = desc;
- wsdlFileURL = (URL) java.security.AccessController.doPrivileged
- (new java.security.PrivilegedExceptionAction() {
- public java.lang.Object run() throws Exception {
- URL retVal;
- if(serviceRef.hasWsdlOverride()) {
- retVal = serviceRef.getWsdlOverride();
+ wsdlFileURL = (URL) java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction() {
+ public java.lang.Object run() throws Exception {
+ URL retVal;
+ if (serviceRef.hasWsdlOverride()) {
+ retVal = serviceRef.getWsdlOverride();
+ } else {
+ // Upon server restart, wsdlfileURL can be null
+ // check that and return value from wsdlFileURI
+ if (serviceRef.getWsdlFileUrl() != null) {
+ retVal = serviceRef.getWsdlFileUrl();
+ } else {
+ if (serviceRef.getWsdlFileUri().startsWith("http")) {
+ retVal = new URL(serviceRef.getWsdlFileUri());
} else {
- // Upon server restart, wsdlfileURL can be null
- // check that and return value from wsdlFileURI
- if(serviceRef.getWsdlFileUrl() != null) {
- retVal = serviceRef.getWsdlFileUrl();
- } else {
- if(serviceRef.getWsdlFileUri().startsWith("http")) {
- retVal = new URL(serviceRef.getWsdlFileUri());
+ if ((serviceRef.getWsdlFileUri().startsWith("WEB-INF") || serviceRef.getWsdlFileUri().startsWith("META-INF"))) {
+
+ // This can be the case when the toURL fails
+ // because in its implementation it looks for user.dir
+ // which sometimes can vary based on where vm is launched
+ // so in this case
+ // resolve from application path
+ WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
+ ServerEnvironment se = wscImpl.getServerEnvironment();
+
+ File appFile = new File(se.getApplicationRepositoryPath(), serviceRef.getBundleDescriptor().getApplication().getAppName());
+ if (appFile.exists()) {
+ retVal = new File(appFile, serviceRef.getWsdlFileUri()).toURL();
} else {
- if ((serviceRef.getWsdlFileUri().startsWith("WEB-INF")|| serviceRef.getWsdlFileUri().startsWith("META-INF"))) {
+ // Fix for 6853656 and 6868695
+ // In case of appclients the wsdl will be in the classpath
+ // This will work for launches using the appclient command and
+ // for Java Web Start launches
- //This can be the case when the toURL fails
- //because in its implementation it looks for user.dir
- // which sometimes can vary based on where vm is launched
- // so in this case
- //resolve from application path
- WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
- ServerEnvironment se = wscImpl.getServerEnvironment();
-
- File appFile = new File(se.getApplicationRepositoryPath(),serviceRef.getBundleDescriptor().getApplication().getAppName());
- if (appFile.exists()) {
- retVal = new File(appFile,serviceRef.getWsdlFileUri()).toURL();
- } else {
- //Fix for 6853656 and 6868695
- //In case of appclients the wsdl will be in the classpath
- //This will work for launches using the appclient command and
- // for Java Web Start launches
-
- retVal = Thread.currentThread().getContextClassLoader().getResource(serviceRef.getWsdlFileUri()) ;
- }
- }else {
- retVal = new File(serviceRef.getWsdlFileUri()).toURL();
- }
+ retVal = Thread.currentThread().getContextClassLoader().getResource(serviceRef.getWsdlFileUri());
}
+ } else {
+ retVal = new File(serviceRef.getWsdlFileUri()).toURL();
}
}
- return retVal;
}
- });
- } catch(PrivilegedActionException pae) {
+ }
+ return retVal;
+ }
+ });
+ } catch (PrivilegedActionException pae) {
logger.log(Level.WARNING, LogUtils.EXCEPTION_THROWN, pae);
Exception e = new Exception();
e.initCause(pae.getCause());
@@ -645,29 +574,24 @@
}
/**
- * Create an xslt template for transforming the packaged webservice
- * WSDL to a final WSDL.
+ * Create an xslt template for transforming the packaged webservice WSDL to a final WSDL.
*/
- private Templates createTemplatesFor(Collection endpoints,
- Collection wsdlRelativeImports,
- Collection wsdlIncludes,
- Collection schemaRelativeImports,
- Collection schemaIncludes) throws Exception {
+ private Templates createTemplatesFor(Collection endpoints, Collection wsdlRelativeImports, Collection wsdlIncludes, Collection schemaRelativeImports,
+ Collection schemaIncludes) throws Exception {
// create the stylesheet
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStreamWriter writer = new OutputStreamWriter(bos, "UTF-8");
- writer.write("<xsl:transform version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:soap12=\"http://schemas.xmlsoap.org/wsdl/soap12/\">\n");
+ writer.write(
+ "<xsl:transform version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:soap12=\"http://schemas.xmlsoap.org/wsdl/soap12/\">\n");
int wsdlImportNum = 0;
- for(Iterator iter = wsdlRelativeImports.iterator(); iter.hasNext();) {
+ for (Iterator iter = wsdlRelativeImports.iterator(); iter.hasNext();) {
Import next = (Import) iter.next();
- String importNamespaceParam =
- WSDL_IMPORT_NAMESPACE_PARAM_NAME + wsdlImportNum;
- String importLocationParam =
- WSDL_IMPORT_LOCATION_PARAM_NAME + wsdlImportNum;
+ String importNamespaceParam = WSDL_IMPORT_NAMESPACE_PARAM_NAME + wsdlImportNum;
+ String importLocationParam = WSDL_IMPORT_LOCATION_PARAM_NAME + wsdlImportNum;
writer.write("<xsl:param name=\"" + importNamespaceParam + "\"/>\n");
writer.write("<xsl:param name=\"" + importLocationParam + "\"/>\n");
@@ -686,11 +610,10 @@
}
int wsdlIncludeNum = 0;
- for(Iterator iter = wsdlIncludes.iterator(); iter.hasNext();) {
+ for (Iterator iter = wsdlIncludes.iterator(); iter.hasNext();) {
Import next = (Import) iter.next();
- String importLocationParam =
- WSDL_INCLUDE_LOCATION_PARAM_NAME + wsdlIncludeNum;
+ String importLocationParam = WSDL_INCLUDE_LOCATION_PARAM_NAME + wsdlIncludeNum;
writer.write("<xsl:param name=\"" + importLocationParam + "\"/>\n");
writer.write("<xsl:template match=\"/\"><xsl:apply-templates mode=\"copy\"/></xsl:template>\n");
@@ -706,13 +629,11 @@
}
int schemaImportNum = 0;
- for(Iterator iter = schemaRelativeImports.iterator(); iter.hasNext();) {
+ for (Iterator iter = schemaRelativeImports.iterator(); iter.hasNext();) {
Import next = (Import) iter.next();
- String importNamespaceParam =
- SCHEMA_IMPORT_NAMESPACE_PARAM_NAME + schemaImportNum;
- String importLocationParam =
- SCHEMA_IMPORT_LOCATION_PARAM_NAME + schemaImportNum;
+ String importNamespaceParam = SCHEMA_IMPORT_NAMESPACE_PARAM_NAME + schemaImportNum;
+ String importLocationParam = SCHEMA_IMPORT_LOCATION_PARAM_NAME + schemaImportNum;
writer.write("<xsl:param name=\"" + importNamespaceParam + "\"/>\n");
writer.write("<xsl:param name=\"" + importLocationParam + "\"/>\n");
@@ -731,11 +652,10 @@
}
int schemaIncludeNum = 0;
- for(Iterator iter = schemaIncludes.iterator(); iter.hasNext();) {
+ for (Iterator iter = schemaIncludes.iterator(); iter.hasNext();) {
Import next = (Import) iter.next();
- String importLocationParam =
- SCHEMA_INCLUDE_LOCATION_PARAM_NAME + schemaIncludeNum;
+ String importLocationParam = SCHEMA_INCLUDE_LOCATION_PARAM_NAME + schemaIncludeNum;
writer.write("<xsl:param name=\"" + importLocationParam + "\"/>\n");
writer.write("<xsl:template match=\"/\"><xsl:apply-templates mode=\"copy\"/></xsl:template>\n");
@@ -751,21 +671,17 @@
}
int endpointNum = 0;
- for(Iterator iter = endpoints.iterator(); iter.hasNext();) {
+ for (Iterator iter = endpoints.iterator(); iter.hasNext();) {
WebServiceEndpoint endpoint = (WebServiceEndpoint) iter.next();
- if( !endpoint.hasWsdlPort() ) {
- throw new Exception("No WSDL port specified for endpoint " +
- endpoint.getEndpointName());
+ if (!endpoint.hasWsdlPort()) {
+ throw new Exception("No WSDL port specified for endpoint " + endpoint.getEndpointName());
}
- if( !endpoint.hasServiceName() ) {
- throw new Exception("Runtime settings error. Cannot find " +
- "service name for endpoint " +
- endpoint.getEndpointName());
+ if (!endpoint.hasServiceName()) {
+ throw new Exception("Runtime settings error. Cannot find " + "service name for endpoint " + endpoint.getEndpointName());
}
- String actualAddressParam =
- ENDPOINT_ADDRESS_PARAM_NAME + endpointNum;
+ String actualAddressParam = ENDPOINT_ADDRESS_PARAM_NAME + endpointNum;
writer.write("<xsl:param name=\"" + actualAddressParam + "\"/>\n");
@@ -777,86 +693,60 @@
writer.write(endpoint.getServiceName().getLocalPart());
writer.write("']/wsdl:port[@name='");
writer.write(endpoint.getWsdlPort().getLocalPart());
- writer.write("']/"+endpoint.getSoapAddressPrefix()+":address\" mode=\"copy\">");
- writer.write("<"+endpoint.getSoapAddressPrefix()+":address><xsl:attribute name=\"location\"><xsl:value-of select=\"$" + actualAddressParam + "\"/>");
- writer.write("</xsl:attribute></"+endpoint.getSoapAddressPrefix()+":address></xsl:template>");
+ writer.write("']/" + endpoint.getSoapAddressPrefix() + ":address\" mode=\"copy\">");
+ writer.write(
+ "<" + endpoint.getSoapAddressPrefix() + ":address><xsl:attribute name=\"location\"><xsl:value-of select=\"$" + actualAddressParam + "\"/>");
+ writer.write("</xsl:attribute></" + endpoint.getSoapAddressPrefix() + ":address></xsl:template>");
endpointNum++;
}
- writer.write("<xsl:template match=\"@*|node()\" mode=\"copy\"><xsl:copy><xsl:apply-templates select=\"@*\" mode=\"copy\"/><xsl:apply-templates mode=\"copy\"/></xsl:copy></xsl:template>\n");
+ writer.write(
+ "<xsl:template match=\"@*|node()\" mode=\"copy\"><xsl:copy><xsl:apply-templates select=\"@*\" mode=\"copy\"/><xsl:apply-templates mode=\"copy\"/></xsl:copy></xsl:template>\n");
writer.write("</xsl:transform>\n");
writer.close();
byte[] stylesheet = bos.toByteArray();
- if( logger.isLoggable(Level.FINE) ) {
+ if (logger.isLoggable(Level.FINE)) {
logger.fine(new String(stylesheet));
}
- Source stylesheetSource =
- new StreamSource(new ByteArrayInputStream(stylesheet));
- TransformerFactory transformerFactory= TransformerFactory.newInstance();
+ Source stylesheetSource = new StreamSource(new ByteArrayInputStream(stylesheet));
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
Templates templates = transformerFactory.newTemplates(stylesheetSource);
return templates;
}
- /* *//**
- * Called from client side deployment object on receipt of final
- * wsdl from server.
- *
- *@param clientPublishUrl Url of directory on local file system to which
- * wsdl is published
- *
- *@param finalWsdlUri location relative to publish directory where final
- * wsdl should be written, in uri form.
- *
- *@return file to which final wsdl was written
- *//*
- public File publishFinalWsdl(URL clientPublishUrl, String finalWsdlUri,
- byte[] finalWsdlBytes)
- throws Exception
- {
- File finalWsdlFile = null;
- FileOutputStream fos = null;
- try {
- finalWsdlFile = new File
- (clientPublishUrl.getFile(),
- finalWsdlUri.replace('/', File.separatorChar));
- File parent = finalWsdlFile.getParentFile();
- if( !parent.exists() ) {
- boolean madeDirs = parent.mkdirs();
- if( !madeDirs ) {
- throw new IOException("Error creating " + parent);
- }
- }
- fos = new FileOutputStream(finalWsdlFile);
- fos.write(finalWsdlBytes, 0, finalWsdlBytes.length);
- } finally {
- if( fos != null ) {
- try {
- fos.close();
- } catch(IOException ioe) {
- logger.log(Level.INFO, "", ioe);
- }
- }
- }
- return finalWsdlFile;
- }
- */
+ /* *//**
+ * Called from client side deployment object on receipt of final wsdl from server.
+ *
+ * @param clientPublishUrl Url of directory on local file system to which wsdl is published
+ *
+ * @param finalWsdlUri location relative to publish directory where final wsdl should be written, in uri form.
+ *
+ * @return file to which final wsdl was written
+ *//*
+ * public File publishFinalWsdl(URL clientPublishUrl, String finalWsdlUri, byte[] finalWsdlBytes) throws Exception {
+ * File finalWsdlFile = null; FileOutputStream fos = null; try { finalWsdlFile = new File (clientPublishUrl.getFile(),
+ * finalWsdlUri.replace('/', File.separatorChar)); File parent = finalWsdlFile.getParentFile(); if( !parent.exists() ) {
+ * boolean madeDirs = parent.mkdirs(); if( !madeDirs ) { throw new IOException("Error creating " + parent); } } fos =
+ * new FileOutputStream(finalWsdlFile); fos.write(finalWsdlBytes, 0, finalWsdlBytes.length); } finally { if( fos != null
+ * ) { try { fos.close(); } catch(IOException ioe) { logger.log(Level.INFO, "", ioe); } } } return finalWsdlFile; }
+ */
- private static void putHeaders(MimeHeaders headers,
- HttpServletResponse response) {
+ private static void putHeaders(MimeHeaders headers, HttpServletResponse response) {
headers.removeHeader("Content-Type");
headers.removeHeader("Content-Length");
Iterator it = headers.getAllHeaders();
while (it.hasNext()) {
- MimeHeader header = (MimeHeader)it.next();
+ MimeHeader header = (MimeHeader) it.next();
response.setHeader(header.getName(), header.getValue());
}
}
+
public static void raiseException(HttpServletResponse resp, String binding, String faultString) {
-
+
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
if (HTTPBinding.HTTP_BINDING.equals(binding)) {
@@ -864,7 +754,7 @@
try {
PrintWriter writer = new PrintWriter(resp.getOutputStream());
writer.println("<error>" + faultString + "</error>");
- } catch(IOException ioe) {
+ } catch (IOException ioe) {
logger.log(Level.WARNING, LogUtils.CANNOT_WRITE_HTTPXML, ioe.getMessage());
}
} else {
@@ -875,26 +765,26 @@
protocol = jakarta.xml.soap.SOAPConstants.SOAP_1_1_PROTOCOL;
}
SOAPMessage fault = WsUtil.getSOAPFault(protocol, faultString);
-
- if (fault!=null) {
+
+ if (fault != null) {
resp.setContentType("text/xml");
try {
fault.writeTo(resp.getOutputStream());
- } catch(Exception ex) {
+ } catch (Exception ex) {
logger.log(Level.WARNING, LogUtils.CANNOT_WRITE_SOAPFAULT, ex);
}
}
}
}
-
+
public static SOAPMessage getSOAPFault(String protocol, String faultString) {
- if (protocol==null) {
+ if (protocol == null) {
protocol = jakarta.xml.soap.SOAPConstants.SOAP_1_1_PROTOCOL;
}
try {
MessageFactory factory = MessageFactory.newInstance(protocol);
- if (factory==null) {
+ if (factory == null) {
factory = MessageFactory.newInstance();
}
SOAPMessage message = factory.createMessage();
@@ -906,54 +796,48 @@
QName faultCode = new QName(envelopeNamespace, "Server", "env");
fault.setFaultCode(faultCode);
return message;
- } catch(SOAPException e) {
+ } catch (SOAPException e) {
logger.log(Level.WARNING, LogUtils.CANNOT_CREATE_SOAPFAULT, faultString);
}
return null;
}
- void writeInvalidContentType(HttpServletResponse response)
- throws SOAPException, IOException {
- //bad client content-type
- response.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
-
+ void writeInvalidContentType(HttpServletResponse response) throws SOAPException, IOException {
+ // bad client content-type
+ response.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
+
setContentTypeAndFlush(response);
}
- void writeInvalidMethodType(HttpServletResponse response,
- String message) throws IOException {
+ void writeInvalidMethodType(HttpServletResponse response, String message) throws IOException {
response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>");
-
+
out.println("Invalid Method Type");
out.println("</title></head>");
out.println("<body>");
out.println(HtmlEntityEncoder.encodeXSS(message));
out.println("</body>");
out.println("</html>");
-
- }
-
+ }
/*
* Used to send back the message after a 4XX response code has been set
*/
- private void setContentTypeAndFlush(HttpServletResponse response)
- throws IOException {
+ private void setContentTypeAndFlush(HttpServletResponse response) throws IOException {
response.setContentType("text/xml");
response.flushBuffer(); // prevent html message in response
response.getWriter().close();
}
-
+
boolean hasSomeTextXmlContent(MimeHeaders headers) {
- return ( hasTextXmlContentType(headers) &&
- (getContentLength(headers) > 0) );
+ return (hasTextXmlContentType(headers) && (getContentLength(headers) > 0));
}
-
+
private int getContentLength(MimeHeaders headers) {
String[] contentLength = headers.getHeader("Content-Length");
@@ -967,10 +851,10 @@
}
boolean hasTextXmlContentType(MimeHeaders headers) {
-
+
String[] contentTypes = headers.getHeader("Content-Type");
- if ((contentTypes != null) && (contentTypes.length >= 1)){
- if (contentTypes[0].indexOf("text/xml") != -1){
+ if ((contentTypes != null) && (contentTypes.length >= 1)) {
+ if (contentTypes[0].indexOf("text/xml") != -1) {
return true;
}
}
@@ -982,22 +866,21 @@
MimeHeaders headers = new MimeHeaders();
while (e.hasMoreElements()) {
- String headerName = (String)e.nextElement();
+ String headerName = (String) e.nextElement();
String headerValue = request.getHeader(headerName);
headers.addHeader(headerName, headerValue);
}
return headers;
- }
-
+ }
+
public WebServerInfo getWebServerInfoForDAS() {
WebServerInfo wsi = new WebServerInfo();
- if(this.networkListeners == null) {
+ if (this.networkListeners == null) {
List<Integer> adminPorts = new ArrayList<Integer>();
- for (org.glassfish.api.container.Adapter subAdapter :
- WebServiceContractImpl.getInstance().getAdapters()) {
+ for (org.glassfish.api.container.Adapter subAdapter : WebServiceContractImpl.getInstance().getAdapters()) {
if (subAdapter instanceof AdminAdapter) {
AdminAdapter aa = (AdminAdapter) subAdapter;
adminPorts.add(aa.getListenPort());
@@ -1009,8 +892,8 @@
for (NetworkListener nl : config.getNetworkConfig().getNetworkListeners().getNetworkListener()) {
- if(!adminPorts.contains(Integer.valueOf(nl.getPort()))) { // get rid of admin ports
- if(networkListeners == null)
+ if (!adminPorts.contains(Integer.valueOf(nl.getPort()))) { // get rid of admin ports
+ if (networkListeners == null)
networkListeners = new ArrayList<NetworkListener>();
networkListeners.add(nl);
@@ -1018,20 +901,20 @@
}
}
- //Fix for issue 13107490
- if ((networkListeners!=null) && (! networkListeners.isEmpty())) {
- for(NetworkListener listener : networkListeners) {
+ // Fix for issue 13107490
+ if ((networkListeners != null) && (!networkListeners.isEmpty())) {
+ for (NetworkListener listener : networkListeners) {
String host = listener.getAddress();
- if(listener.getAddress().equals("0.0.0.0"))
+ if (listener.getAddress().equals("0.0.0.0"))
try {
host = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
- host="localhost"; //fallback
+ host = "localhost"; // fallback
}
- if(listener.findHttpProtocol().getSecurityEnabled().equals("false"))
+ if (listener.findHttpProtocol().getSecurityEnabled().equals("false"))
wsi.setHttpVS(new VirtualServerInfo("http", host, Integer.parseInt(listener.getPort())));
- else if(listener.findHttpProtocol().getSecurityEnabled().equals("true"))
+ else if (listener.findHttpProtocol().getSecurityEnabled().equals("true"))
wsi.setHttpsVS(new VirtualServerInfo("https", host, Integer.parseInt(listener.getPort())));
}
} else {
@@ -1046,12 +929,11 @@
*/
public static Logger getDefaultLogger() {
return logger;
- }
+ }
// resources...
- static LocalStringManagerImpl localStrings =
- new LocalStringManagerImpl(WsUtil.class);
-
+ static LocalStringManagerImpl localStrings = new LocalStringManagerImpl(WsUtil.class);
+
public static LocalStringManagerImpl getDefaultStringManager() {
return localStrings;
}
@@ -1060,56 +942,47 @@
EjbDescriptor ejbDescriptor = ejbEndpoint.getEjbComponentImpl();
BundleDescriptor bundle = ejbDescriptor.getEjbBundleDescriptor();
WebServicesDescriptor webServices = bundle.getWebServices();
- Collection endpoints =
- webServices.getEndpointsImplementedBy(ejbDescriptor);
- if( endpoints.size() == 1 ) {
- if( ejbDescriptor.hasWebServiceEndpointInterface() ) {
- if(!ejbEndpoint.getServiceEndpointInterface().equals
- (ejbDescriptor.getWebServiceEndpointInterfaceName())) {
- String msg = "Ejb " + ejbDescriptor.getName() +
- " service endpoint interface does not match " +
- " port component " + ejbEndpoint.getEndpointName();
+ Collection endpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
+ if (endpoints.size() == 1) {
+ if (ejbDescriptor.hasWebServiceEndpointInterface()) {
+ if (!ejbEndpoint.getServiceEndpointInterface().equals(ejbDescriptor.getWebServiceEndpointInterfaceName())) {
+ String msg = "Ejb " + ejbDescriptor.getName() + " service endpoint interface does not match " + " port component "
+ + ejbEndpoint.getEndpointName();
throw new IllegalStateException(msg);
}
} else {
- String msg = "Ejb " + ejbDescriptor.getName() +
- " must declare <service-endpoint> interface";
+ String msg = "Ejb " + ejbDescriptor.getName() + " must declare <service-endpoint> interface";
throw new IllegalStateException(msg);
}
- } else if( endpoints.size() > 1 ) {
- String msg = "Ejb " + ejbDescriptor.getName() +
- " implements " + endpoints.size() + " web service endpoints " +
- " but must only implement 1";
+ } else if (endpoints.size() > 1) {
+ String msg = "Ejb " + ejbDescriptor.getName() + " implements " + endpoints.size() + " web service endpoints " + " but must only implement 1";
throw new IllegalStateException(msg);
}
}
public void updateServletEndpointRuntime(WebServiceEndpoint endpoint) {
-
+
// Copy the value of the servlet impl bean class into
- // the runtime information. This way, we'll still
- // remember it after the servlet-class element has been
+ // the runtime information. This way, we'll still
+ // remember it after the servlet-class element has been
// replaced with the name of the container's servlet class.
endpoint.saveServletImplClass();
- WebComponentDescriptor webComp =
- (WebComponentDescriptor) endpoint.getWebComponentImpl();
+ WebComponentDescriptor webComp = (WebComponentDescriptor) endpoint.getWebComponentImpl();
WebBundleDescriptor bundle = webComp.getWebBundleDescriptor();
WebServicesDescriptor webServices = bundle.getWebServices();
- Collection endpoints =
- webServices.getEndpointsImplementedBy(webComp);
+ Collection endpoints = webServices.getEndpointsImplementedBy(webComp);
- if( endpoints.size() > 1 ) {
- String msg = "Servlet " + endpoint.getWebComponentLink() +
- " implements " + endpoints.size() + " web service endpoints " +
- " but must only implement 1";
+ if (endpoints.size() > 1) {
+ String msg = "Servlet " + endpoint.getWebComponentLink() + " implements " + endpoints.size() + " web service endpoints "
+ + " but must only implement 1";
throw new IllegalStateException(msg);
}
- if( endpoint.getEndpointAddressUri() == null ) {
+ if (endpoint.getEndpointAddressUri() == null) {
Set urlPatterns = webComp.getUrlPatternsSet();
- if( urlPatterns.size() == 1 ) {
+ if (urlPatterns.size() == 1) {
// Set endpoint-address-uri runtime info to uri.
// Final endpoint address will still be relative to context roo
@@ -1117,111 +990,80 @@
String uri = (String) urlPatterns.iterator().next();
endpoint.setEndpointAddressUri(uri);
- // Set transport guarantee in runtime info if transport
- // guarantee is INTEGRAL or CONDIFIDENTIAL for any
+ // Set transport guarantee in runtime info if transport
+ // guarantee is INTEGRAL or CONDIFIDENTIAL for any
// security constraint with this url-pattern.
- Collection constraints =
- bundle.getSecurityConstraintsForUrlPattern(uri);
- for(Iterator i = constraints.iterator(); i.hasNext();) {
+ Collection constraints = bundle.getSecurityConstraintsForUrlPattern(uri);
+ for (Iterator i = constraints.iterator(); i.hasNext();) {
SecurityConstraint next = (SecurityConstraint) i.next();
-
- UserDataConstraint dataConstraint =
- next.getUserDataConstraint();
- String guarantee = (dataConstraint != null) ?
- dataConstraint.getTransportGuarantee() : null;
- if( (guarantee != null) &&
- ( guarantee.equals
- (UserDataConstraint.INTEGRAL_TRANSPORT) ||
- guarantee.equals
- (UserDataConstraint.CONFIDENTIAL_TRANSPORT) ) ) {
+ UserDataConstraint dataConstraint = next.getUserDataConstraint();
+ String guarantee = (dataConstraint != null) ? dataConstraint.getTransportGuarantee() : null;
+
+ if ((guarantee != null)
+ && (guarantee.equals(UserDataConstraint.INTEGRAL_TRANSPORT) || guarantee.equals(UserDataConstraint.CONFIDENTIAL_TRANSPORT))) {
endpoint.setTransportGuarantee(guarantee);
break;
}
}
} else {
- String msg = "Endpoint " + endpoint.getEndpointName() +
- " has not been assigned an endpoint address " +
- " and is associated with servlet " +
- webComp.getCanonicalName() + " , which has " +
- urlPatterns.size() + " url patterns";
+ String msg = "Endpoint " + endpoint.getEndpointName() + " has not been assigned an endpoint address " + " and is associated with servlet "
+ + webComp.getCanonicalName() + " , which has " + urlPatterns.size() + " url patterns";
throw new IllegalStateException(msg);
- }
- }
- }
-
-
-
- /*public void downloadFile(URL httpUrl, File toFile) throws Exception {
- InputStream is = null;
- FileOutputStream os = null;
- try {
- if(!toFile.createNewFile()) {
- throw new Exception("Unable to create new File " + toFile.getAbsolutePath());
- }
- is = httpUrl.openStream();
-
- os = new FileOutputStream(toFile, true);
- int readCount;
- byte[] buffer = new byte[10240]; // Read 10KB at a time
- while(true) {
- readCount = is.read(buffer, 0, 10240);
- if(readCount != -1) {
- os.write(buffer, 0, readCount);
- } else {
- break;
- }
- }
- } finally {
- if(is != null) {
- is.close();
- }
- if(os != null) {
- os.flush();
- os.close();
}
}
- } */
-
+ }
+
+ /*
+ * public void downloadFile(URL httpUrl, File toFile) throws Exception { InputStream is = null; FileOutputStream os =
+ * null; try { if(!toFile.createNewFile()) { throw new Exception("Unable to create new File " +
+ * toFile.getAbsolutePath()); } is = httpUrl.openStream();
+ *
+ * os = new FileOutputStream(toFile, true); int readCount; byte[] buffer = new byte[10240]; // Read 10KB at a time
+ * while(true) { readCount = is.read(buffer, 0, 10240); if(readCount != -1) { os.write(buffer, 0, readCount); } else {
+ * break; } } } finally { if(is != null) { is.close(); } if(os != null) { os.flush(); os.close(); } } }
+ */
+
public Collection getWsdlsAndSchemas(File pkgedWsdl) throws Exception {
-
- ArrayList<SDDocumentSource> cumulative = new ArrayList<SDDocumentSource>();
+
+ ArrayList<SDDocumentSource> cumulative = new ArrayList<SDDocumentSource>();
getWsdlsAndSchemas(pkgedWsdl, cumulative);
-
- //if there are circular imports of wsdls, the original wsdl might
- //be in this Collection of imported metadata documents. If so, remove it.
+
+ // if there are circular imports of wsdls, the original wsdl might
+ // be in this Collection of imported metadata documents. If so, remove it.
URL id = pkgedWsdl.toURL();
SDDocumentSource toRemove = null;
-
- for (SDDocumentSource source: cumulative) {
+
+ for (SDDocumentSource source : cumulative) {
if ((id.toString()).equals(source.getSystemId().toString())) {
toRemove = source;
}
- }
+ }
if (toRemove != null) {
cumulative.remove(toRemove);
}
-
+
return cumulative;
}
/**
- * This implementation is similar to #getWsdlsAndSchemas(File pkgedWsdl, except that this works on URL which makes
- * it easy when the wsdl is loaded from the archive.
+ * This implementation is similar to #getWsdlsAndSchemas(File pkgedWsdl, except that this works on URL which makes it
+ * easy when the wsdl is loaded from the archive.
+ *
* @param pkgedWsdl URL
* @return
* @throws Exception
*/
public Collection getWsdlsAndSchemas(URL pkgedWsdl) throws Exception {
- ArrayList<SDDocumentSource> cumulative = new ArrayList<SDDocumentSource>();
+ ArrayList<SDDocumentSource> cumulative = new ArrayList<SDDocumentSource>();
getWsdlsAndSchemas(pkgedWsdl, cumulative);
- //if there are circular imports of wsdls, the original wsdl might
- //be in this Collection of imported metadata documents. If so, remove it.
+ // if there are circular imports of wsdls, the original wsdl might
+ // be in this Collection of imported metadata documents. If so, remove it.
SDDocumentSource toRemove = null;
- for (SDDocumentSource source: cumulative) {
+ for (SDDocumentSource source : cumulative) {
if ((pkgedWsdl.toString()).equals(source.getSystemId().toString())) {
toRemove = source;
}
@@ -1241,35 +1083,31 @@
Collection<Import> wsdlIncludes = new HashSet();
Collection<Import> schemaIncludes = new HashSet();
- parseRelativeImports(wsdlRoot, wsdlRelativeImports, wsdlIncludes,
- schemaRelativeImports, schemaIncludes);
+ parseRelativeImports(wsdlRoot, wsdlRelativeImports, wsdlIncludes, schemaRelativeImports, schemaIncludes);
wsdlRelativeImports.addAll(wsdlIncludes);
schemaRelativeImports.addAll(schemaIncludes);
-
// List of all schema relative imports
- for(Import next : schemaRelativeImports) {
+ for (Import next : schemaRelativeImports) {
addFileAndDecendents(wsdlRoot.toURI().resolve(new URI(null, next.getLocation(), null).toASCIIString()).toURL(), cumulative);
}
// List of all wsdl relative imports
- for(Import next : wsdlRelativeImports) {
+ for (Import next : wsdlRelativeImports) {
addFileAndDecendents(wsdlRoot.toURI().resolve(new URI(null, next.getLocation(), null).toASCIIString()).toURL(), cumulative);
}
}
/*
- * Add the File and wsdls and schemas imported by it to a list of metadata
- * documents used to initialize an endpoint. Canonicalize the paths and check
- * whether the documents have already been added to the list.
+ * Add the File and wsdls and schemas imported by it to a list of metadata documents used to initialize an endpoint.
+ * Canonicalize the paths and check whether the documents have already been added to the list.
*/
- private void addFileAndDecendents(URL fileUrl,
- ArrayList<SDDocumentSource> cumulative) throws Exception {
+ private void addFileAndDecendents(URL fileUrl, ArrayList<SDDocumentSource> cumulative) throws Exception {
- //make sure we have not processed this file before
+ // make sure we have not processed this file before
boolean alreadyProcessed = false;
- for (SDDocumentSource source: cumulative) {
+ for (SDDocumentSource source : cumulative) {
if ((fileUrl.toString()).equals(source.getSystemId().toString())) {
alreadyProcessed = true;
break;
@@ -1282,9 +1120,8 @@
}
- public void getWsdlsAndSchemas(File wsdl,
- ArrayList<SDDocumentSource> cumulative) throws Exception {
-
+ public void getWsdlsAndSchemas(File wsdl, ArrayList<SDDocumentSource> cumulative) throws Exception {
+
// Get a list of wsdl and schema relative imports in this wsdl
Collection<Import> wsdlRelativeImports = new HashSet();
Collection<Import> schemaRelativeImports = new HashSet();
@@ -1292,52 +1129,46 @@
Collection<Import> schemaIncludes = new HashSet();
String wsdlRoot = wsdl.getParent();
- parseRelativeImports(wsdl.toURL(), wsdlRelativeImports, wsdlIncludes,
- schemaRelativeImports, schemaIncludes);
-
+ parseRelativeImports(wsdl.toURL(), wsdlRelativeImports, wsdlIncludes, schemaRelativeImports, schemaIncludes);
+
wsdlRelativeImports.addAll(wsdlIncludes);
schemaRelativeImports.addAll(schemaIncludes);
-
// List of all schema relative imports
- for(Import next : schemaRelativeImports) {
+ for (Import next : schemaRelativeImports) {
String location = next.getLocation();
- location = location.replaceAll("/", "\\"+File.separator);
- File file = new File(wsdlRoot + File.separator + location)
- .getCanonicalFile();
+ location = location.replaceAll("/", "\\" + File.separator);
+ File file = new File(wsdlRoot + File.separator + location).getCanonicalFile();
addFileAndDecendents(file, cumulative);
}
// List of all wsdl relative imports
- for(Import next : wsdlRelativeImports) {
+ for (Import next : wsdlRelativeImports) {
String location = next.getLocation();
- location = location.replaceAll("/", "\\"+File.separator);
+ location = location.replaceAll("/", "\\" + File.separator);
- File currentWsdlFile = new File(wsdlRoot+File.separator+location)
- .getCanonicalFile();
- addFileAndDecendents(currentWsdlFile, cumulative);
+ File currentWsdlFile = new File(wsdlRoot + File.separator + location).getCanonicalFile();
+ addFileAndDecendents(currentWsdlFile, cumulative);
}
}
/*
- * Add the File and wsdls and schemas imported by it to a list of metadata
- * documents used to initialize an endpoint. Canonicalize the paths and check
- * whether the documents have already been added to the list.
+ * Add the File and wsdls and schemas imported by it to a list of metadata documents used to initialize an endpoint.
+ * Canonicalize the paths and check whether the documents have already been added to the list.
*/
- private void addFileAndDecendents(File file,
- ArrayList<SDDocumentSource> cumulative) throws Exception {
+ private void addFileAndDecendents(File file, ArrayList<SDDocumentSource> cumulative) throws Exception {
try {
- //JAX-WS has trouble with "..'s" in paths here
+ // JAX-WS has trouble with "..'s" in paths here
file = file.getCanonicalFile();
} catch (IOException e) {
- //hope JAX-WS can deal with the original path
+ // hope JAX-WS can deal with the original path
}
- //make sure we have not processed this file before
+ // make sure we have not processed this file before
URL id = file.toURL();
boolean alreadyProcessed = false;
- for (SDDocumentSource source: cumulative) {
+ for (SDDocumentSource source : cumulative) {
if ((id.toString()).equals(source.getSystemId().toString())) {
alreadyProcessed = true;
break;
@@ -1349,59 +1180,47 @@
}
}
-
/*
* Calls @PostConstruct method in the implementor
*/
public void doPostConstruct(Class impl, Object implObj) {
- invokeServiceMethod(jakarta.annotation.PostConstruct.class, impl,
- implObj);
+ invokeServiceMethod(jakarta.annotation.PostConstruct.class, impl, implObj);
}
-
+
/*
* Calls @PreDestroy method in the implementor
*/
public void doPreDestroy(WebServiceEndpoint ep, ClassLoader loader) {
// Call @PreDestroy in endpoint, if any
try {
- Class impl = Class.forName(ep.getServletImplClass(),
- true, loader);
- invokeServiceMethod(jakarta.annotation.PreDestroy.class, impl,
- impl.newInstance());
+ Class impl = Class.forName(ep.getServletImplClass(), true, loader);
+ invokeServiceMethod(jakarta.annotation.PreDestroy.class, impl, impl.newInstance());
} catch (Throwable ex) {
- String msg = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.CLASS_NOT_FOUND_IN_PREDESTROY),
- ep.getServletImplClass());
+ String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.CLASS_NOT_FOUND_IN_PREDESTROY), ep.getServletImplClass());
logger.log(Level.SEVERE, msg, ex);
}
-
+
// Call @PreDestroy in the handlers if any
- if(!ep.hasHandlerChain()) {
+ if (!ep.hasHandlerChain()) {
return;
}
- for(Iterator<WebServiceHandlerChain> hc = ep.getHandlerChain().iterator();
- hc.hasNext();) {
+ for (Iterator<WebServiceHandlerChain> hc = ep.getHandlerChain().iterator(); hc.hasNext();) {
WebServiceHandlerChain thisHc = hc.next();
- for(Iterator<WebServiceHandler> h = thisHc.getHandlers().iterator();
- h.hasNext();) {
+ for (Iterator<WebServiceHandler> h = thisHc.getHandlers().iterator(); h.hasNext();) {
WebServiceHandler thisHandler = h.next();
try {
- Class handlerClass = Class.forName(thisHandler.getHandlerClass(),
- true, loader);
- invokeServiceMethod(jakarta.annotation.PreDestroy.class, handlerClass,
- handlerClass.newInstance());
+ Class handlerClass = Class.forName(thisHandler.getHandlerClass(), true, loader);
+ invokeServiceMethod(jakarta.annotation.PreDestroy.class, handlerClass, handlerClass.newInstance());
} catch (Throwable ex) {
- String msg = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.HANDLER_NOT_FOUND_IN_PREDESTROY),
+ String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.HANDLER_NOT_FOUND_IN_PREDESTROY),
thisHandler.getHandlerClass());
logger.log(Level.SEVERE, msg, ex);
}
}
- }
+ }
}
-
/*
* Calls the PostConstruct / PreDestroy method
*/
@@ -1409,12 +1228,11 @@
Method[] methods = impl.getDeclaredMethods();
// Only one method can have @PostConstruct / @PreDestroy
// Call the first method with this annotation and return
- for(final Method method : methods) {
+ for (final Method method : methods) {
if (method.getAnnotation(annType) != null) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IllegalAccessException,
- InvocationTargetException {
+ public Object run() throws IllegalAccessException, InvocationTargetException {
if (!method.isAccessible()) {
method.setAccessible(true);
}
@@ -1422,79 +1240,73 @@
return null;
}
});
- } catch(Throwable e) {
+ } catch (Throwable e) {
// Should we log or throw an exception
logger.log(Level.SEVERE, LogUtils.FAILURE_CALLING_POST_PRE, e);
}
break;
- }
+ }
}
}
-
- private boolean matchQNamePatterns(QName cfgQName, QName givenPattern) {
- if (givenPattern.getNamespaceURI().equals(cfgQName.getNamespaceURI())) {
- String expr = givenPattern.getLocalPart().replaceAll("\\*", ".*");
- return java.util.regex.Pattern.matches(expr, cfgQName.getLocalPart());
- }
- return false;
- }
- private boolean patternsMatch(WebServiceHandlerChain hc, QName svcName,
- QName portName, String bindingId) {
+ private boolean matchQNamePatterns(QName cfgQName, QName givenPattern) {
+ if (givenPattern.getNamespaceURI().equals(cfgQName.getNamespaceURI())) {
+ String expr = givenPattern.getLocalPart().replaceAll("\\*", ".*");
+ return java.util.regex.Pattern.matches(expr, cfgQName.getLocalPart());
+ }
+ return false;
+ }
+
+ private boolean patternsMatch(WebServiceHandlerChain hc, QName svcName, QName portName, String bindingId) {
// If service name pattern in handler chain does not match the service name
// for this endpoint, skip handler processing
- if(hc.getServiceNamePattern() != null && svcName != null) {
+ if (hc.getServiceNamePattern() != null && svcName != null) {
QName svcPattern = QName.valueOf(hc.getServiceNamePattern());
- if(!matchQNamePatterns(svcName, svcPattern)) {
+ if (!matchQNamePatterns(svcName, svcPattern)) {
return false;
}
}
// If port name pattern in handler chain does not match the port name
// for this endpoint, skip handler processing
- if(hc.getPortNamePattern() != null && portName != null) {
+ if (hc.getPortNamePattern() != null && portName != null) {
QName portPattern = QName.valueOf(hc.getPortNamePattern());
- if(!matchQNamePatterns(portName, portPattern)) {
+ if (!matchQNamePatterns(portName, portPattern)) {
return false;
}
}
// Check if the binding protocol for this endpoint is present
// as part of the protocol-bindings list
- if(hc.getProtocolBindings() != null && bindingId != null) {
+ if (hc.getProtocolBindings() != null && bindingId != null) {
String givenBindings = hc.getProtocolBindings();
- if( (bindingId.equals(HTTPBinding.HTTP_BINDING)) &&
- ((givenBindings.indexOf(HTTPBinding.HTTP_BINDING) != -1) ||
- (givenBindings.indexOf(WebServiceEndpoint.XML_TOKEN) != -1))) {
+ if ((bindingId.equals(HTTPBinding.HTTP_BINDING))
+ && ((givenBindings.indexOf(HTTPBinding.HTTP_BINDING) != -1) || (givenBindings.indexOf(WebServiceEndpoint.XML_TOKEN) != -1))) {
return true;
}
- if( (bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING)) &&
- ((givenBindings.indexOf(SOAPBinding.SOAP11HTTP_BINDING) != -1) ||
- (givenBindings.indexOf(WebServiceEndpoint.SOAP11_TOKEN) != -1))) {
+ if ((bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING))
+ && ((givenBindings.indexOf(SOAPBinding.SOAP11HTTP_BINDING) != -1) || (givenBindings.indexOf(WebServiceEndpoint.SOAP11_TOKEN) != -1))) {
return true;
}
- if( (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)) &&
- ((givenBindings.indexOf(SOAPBinding.SOAP12HTTP_BINDING) != -1) ||
- (givenBindings.indexOf(WebServiceEndpoint.SOAP12_TOKEN) != -1))) {
+ if ((bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING))
+ && ((givenBindings.indexOf(SOAPBinding.SOAP12HTTP_BINDING) != -1) || (givenBindings.indexOf(WebServiceEndpoint.SOAP12_TOKEN) != -1))) {
return true;
}
- if( (bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) &&
- ((givenBindings.indexOf(SOAPBinding.SOAP11HTTP_MTOM_BINDING) != -1) ||
- (givenBindings.indexOf(WebServiceEndpoint.SOAP11_MTOM_TOKEN) != -1))) {
+ if ((bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) && ((givenBindings.indexOf(SOAPBinding.SOAP11HTTP_MTOM_BINDING) != -1)
+ || (givenBindings.indexOf(WebServiceEndpoint.SOAP11_MTOM_TOKEN) != -1))) {
return true;
}
- if( (bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) &&
- ((givenBindings.indexOf(SOAPBinding.SOAP12HTTP_MTOM_BINDING) != -1) ||
- (givenBindings.indexOf(WebServiceEndpoint.SOAP12_MTOM_TOKEN) != -1))) {
+ if ((bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) && ((givenBindings.indexOf(SOAPBinding.SOAP12HTTP_MTOM_BINDING) != -1)
+ || (givenBindings.indexOf(WebServiceEndpoint.SOAP12_MTOM_TOKEN) != -1))) {
return true;
}
}
return true;
}
-
+
private List<Handler> processConfiguredHandlers(List<WebServiceHandler> handlersList, Set<String> roles) {
List<Handler> handlerChain = new ArrayList<Handler>();
- for(WebServiceHandler h : handlersList) {
+ for (WebServiceHandler h : handlersList) {
Handler handler = null;
ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -1503,50 +1315,46 @@
try {
handlerClass = Class.forName(h.getHandlerClass(), true, loader);
} catch (Throwable t) {
- String msg = MessageFormat.format(
- logger.getResourceBundle().getString(LogUtils.HANDLER_UNABLE_TO_ADD),
- h.getHandlerClass());
+ String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.HANDLER_UNABLE_TO_ADD), h.getHandlerClass());
logger.log(Level.SEVERE, msg, t);
-
+
continue;
}
-
+
// perform injection
- try {
+ try {
WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
- InjectionManager injManager = wscImpl.getInjectionManager();
- //PostConstruct is invoked by createManagedObject as well
+ InjectionManager injManager = wscImpl.getInjectionManager();
+ // PostConstruct is invoked by createManagedObject as well
handler = (Handler) injManager.createManagedObject(handlerClass);
- } catch(InjectionException e) {
- logger.log(Level.SEVERE, LogUtils.HANDLER_INJECTION_FAILED,
- new Object[] {h.getHandlerClass(), e.getMessage()});
+ } catch (InjectionException e) {
+ logger.log(Level.SEVERE, LogUtils.HANDLER_INJECTION_FAILED, new Object[] { h.getHandlerClass(), e.getMessage() });
continue;
}
-
+
// Add soap-roles
Collection<String> rolesColl = h.getSoapRoles();
roles.addAll(rolesColl);
-
+
// Add this handler to the mail list
handlerChain.add(handler);
}
return handlerChain;
- }
-
- public void configureJAXWSServiceHandlers(WebServiceEndpoint ep,
- String bindingId, WSBinding bindingObj) {
+ }
+
+ public void configureJAXWSServiceHandlers(WebServiceEndpoint ep, String bindingId, WSBinding bindingObj) {
// No handler chains; do nothing
- if(!ep.hasHandlerChain()) {
+ if (!ep.hasHandlerChain()) {
return;
}
LinkedList handlerChainList = ep.getHandlerChain();
List<Handler> finalHandlerList = new ArrayList<Handler>();
Set<String> roles = new HashSet();
- for(Iterator<WebServiceHandlerChain> i = handlerChainList.iterator(); i.hasNext();) {
+ for (Iterator<WebServiceHandlerChain> i = handlerChainList.iterator(); i.hasNext();) {
WebServiceHandlerChain hc = i.next();
// Apply the serviceName / portName / bindings filter to ensure
// that the handlers are for this endpoint
- if(!patternsMatch(hc, ep.getServiceName(), ep.getWsdlPort(), bindingId)) {
+ if (!patternsMatch(hc, ep.getServiceName(), ep.getWsdlPort(), bindingId)) {
continue;
}
// OK - this handler has to be configured for this endpoint
@@ -1554,13 +1362,13 @@
List<Handler> handlerInfo = processConfiguredHandlers(hc.getHandlers(), roles);
finalHandlerList.addAll(handlerInfo);
}
- // Processing of all handlers over;
+ // Processing of all handlers over;
// set final list of handler in RuntimeEndpointInfo
bindingObj.setHandlerChain(finalHandlerList);
// Set soap roles for soap bindings only
- if(bindingObj instanceof jakarta.xml.ws.soap.SOAPBinding) {
- ((jakarta.xml.ws.soap.SOAPBinding)bindingObj).setRoles(roles);
- }
+ if (bindingObj instanceof jakarta.xml.ws.soap.SOAPBinding) {
+ ((jakarta.xml.ws.soap.SOAPBinding) bindingObj).setRoles(roles);
+ }
}
public void configureJAXWSClientHandlers(jakarta.xml.ws.Service svcClass, ServiceReferenceDescriptor desc) {
@@ -1570,23 +1378,23 @@
HandlerResolverImpl resolver = new HandlerResolverImpl();
Set<String> roles = new HashSet();
-
+
Iterator<QName> ports = svcClass.getPorts();
// Set handler chain for each port of this service
- while(ports.hasNext()) {
+ while (ports.hasNext()) {
QName nextPort = ports.next();
LinkedList handlerChainList = desc.getHandlerChain();
- for(Iterator<WebServiceHandlerChain> i = handlerChainList.iterator(); i.hasNext();) {
+ for (Iterator<WebServiceHandlerChain> i = handlerChainList.iterator(); i.hasNext();) {
WebServiceHandlerChain hc = i.next();
// Apply the serviceName / portName filter to ensure
// that the handlers are for this service and this port
- if(!patternsMatch(hc, desc.getServiceName(), nextPort, null)) {
+ if (!patternsMatch(hc, desc.getServiceName(), nextPort, null)) {
continue;
}
// Decide for what all protocols this handler should be applied
ArrayList<String> protocols = new ArrayList<String>();
- if(hc.getProtocolBindings() == null) {
+ if (hc.getProtocolBindings() == null) {
// No protocol bindings given in descriptor; apply this handler
// for all protocols
protocols.add(HTTPBinding.HTTP_BINDING);
@@ -1597,35 +1405,33 @@
} else {
// protocols specified; handlers are for only these protocols
String specifiedProtocols = hc.getProtocolBindings();
- if((specifiedProtocols.indexOf(HTTPBinding.HTTP_BINDING) != -1) ||
- (specifiedProtocols.indexOf(WebServiceEndpoint.XML_TOKEN) != -1)) {
+ if ((specifiedProtocols.indexOf(HTTPBinding.HTTP_BINDING) != -1) || (specifiedProtocols.indexOf(WebServiceEndpoint.XML_TOKEN) != -1)) {
protocols.add(HTTPBinding.HTTP_BINDING);
}
- if((specifiedProtocols.indexOf(SOAPBinding.SOAP11HTTP_BINDING) != -1) ||
- (specifiedProtocols.indexOf(WebServiceEndpoint.SOAP11_TOKEN) != -1)) {
+ if ((specifiedProtocols.indexOf(SOAPBinding.SOAP11HTTP_BINDING) != -1)
+ || (specifiedProtocols.indexOf(WebServiceEndpoint.SOAP11_TOKEN) != -1)) {
protocols.add(SOAPBinding.SOAP11HTTP_BINDING);
}
- if((specifiedProtocols.indexOf(SOAPBinding.SOAP12HTTP_BINDING) != -1) ||
- (specifiedProtocols.indexOf(WebServiceEndpoint.SOAP12_TOKEN) != -1)) {
+ if ((specifiedProtocols.indexOf(SOAPBinding.SOAP12HTTP_BINDING) != -1)
+ || (specifiedProtocols.indexOf(WebServiceEndpoint.SOAP12_TOKEN) != -1)) {
protocols.add(SOAPBinding.SOAP12HTTP_BINDING);
- }
- if((specifiedProtocols.indexOf(SOAPBinding.SOAP11HTTP_MTOM_BINDING) != -1) ||
- (specifiedProtocols.indexOf(WebServiceEndpoint.SOAP11_MTOM_TOKEN) != -1)) {
+ }
+ if ((specifiedProtocols.indexOf(SOAPBinding.SOAP11HTTP_MTOM_BINDING) != -1)
+ || (specifiedProtocols.indexOf(WebServiceEndpoint.SOAP11_MTOM_TOKEN) != -1)) {
protocols.add(SOAPBinding.SOAP11HTTP_MTOM_BINDING);
}
- if((specifiedProtocols.indexOf(SOAPBinding.SOAP12HTTP_MTOM_BINDING) != -1) ||
- (specifiedProtocols.indexOf(WebServiceEndpoint.SOAP12_MTOM_TOKEN) != -1)) {
+ if ((specifiedProtocols.indexOf(SOAPBinding.SOAP12HTTP_MTOM_BINDING) != -1)
+ || (specifiedProtocols.indexOf(WebServiceEndpoint.SOAP12_MTOM_TOKEN) != -1)) {
protocols.add(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
- }
+ }
}
// Iterate through all handlers that have been configured
List<WebServiceHandler> handlersList = hc.getHandlers();
// From this list, remove those handlers that have port-name that is different
// than the current port
- for(WebServiceHandler thisOne : handlersList) {
+ for (WebServiceHandler thisOne : handlersList) {
Collection portNames = thisOne.getPortNames();
- if(!portNames.isEmpty() &&
- !portNames.contains(nextPort.getLocalPart())) {
+ if (!portNames.isEmpty() && !portNames.contains(nextPort.getLocalPart())) {
handlersList.remove(thisOne);
}
}
@@ -1633,45 +1439,38 @@
List<Handler> handlerInfo = processConfiguredHandlers(handlersList, roles);
// Now you have the handler list; Set it in resolver;
// one set for each protocol
- for(Iterator<String> s = protocols.iterator(); s.hasNext();) {
+ for (Iterator<String> s = protocols.iterator(); s.hasNext();) {
jakarta.xml.ws.handler.PortInfo portInfo;
- portInfo = new PortInfoImpl(BindingID.parse(s.next()),
- nextPort, desc.getServiceName());
+ portInfo = new PortInfoImpl(BindingID.parse(s.next()), nextPort, desc.getServiceName());
resolver.setHandlerChain(portInfo, handlerInfo);
}
}
}
- // Now that processing of all handlers is over, set HandlerResolver for
- // the service
+ // Now that processing of all handlers is over, set HandlerResolver for
+ // the service
svcClass.setHandlerResolver(resolver);
-
- //XXX TODO : What to do with soap roles on client side ?
+
+ // XXX TODO : What to do with soap roles on client side ?
}
- /* This util is to implement the jaxws table that defines how MTOM is set
- *
- * BindingType - enable-mtom in DD - final MTOM value
- *
- * SOAPXX_BINDING none false
- * SOAPXX_BINDING false false
- * SOAPXX_BINDING true true
- * SOAPXX_MTOM_BINDING none true
- * SOAPXX_MTOM_BINDING false false
- * SOAPXX_MTOM_BINDING true true
- */
+ /*
+ * This util is to implement the jaxws table that defines how MTOM is set
+ *
+ * BindingType - enable-mtom in DD - final MTOM value
+ *
+ * SOAPXX_BINDING none false SOAPXX_BINDING false false SOAPXX_BINDING true true SOAPXX_MTOM_BINDING none true
+ * SOAPXX_MTOM_BINDING false false SOAPXX_MTOM_BINDING true true
+ */
public boolean getMtom(WebServiceEndpoint ep) {
String currentBinding = ep.getProtocolBinding();
- if((ep.getMtomEnabled() == null) &&
- (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(currentBinding) ||
- SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(currentBinding))) {
+ if ((ep.getMtomEnabled() == null)
+ && (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(currentBinding) || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(currentBinding))) {
return true;
}
- if(( Boolean.valueOf(ep.getMtomEnabled())).booleanValue() &&
- (SOAPBinding.SOAP11HTTP_BINDING.equals(currentBinding) ||
- SOAPBinding.SOAP12HTTP_BINDING.equals(currentBinding) ||
- SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(currentBinding) ||
- SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(currentBinding))) {
+ if ((Boolean.valueOf(ep.getMtomEnabled())).booleanValue()
+ && (SOAPBinding.SOAP11HTTP_BINDING.equals(currentBinding) || SOAPBinding.SOAP12HTTP_BINDING.equals(currentBinding)
+ || SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(currentBinding) || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(currentBinding))) {
return true;
}
return false;
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpRequestInfo.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpRequestInfo.java
index d502514..43de7ed 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpRequestInfo.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpRequestInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,13 +16,14 @@
package org.glassfish.webservices.monitoring;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
public interface HttpRequestInfo {
/**
- * Return the Http request instance
- * @return the http request
- */
- public HttpServletRequest getRequest();
-
+ * Return the Http request instance
+ *
+ * @return the http request
+ */
+ HttpServletRequest getRequest();
+
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpRequestInfoImpl.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpRequestInfoImpl.java
index 9b00edf..e5633dc 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpRequestInfoImpl.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpRequestInfoImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,22 +16,20 @@
package org.glassfish.webservices.monitoring;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
/**
*
* @author dochez
*/
-public class HttpRequestInfoImpl extends HttpTransportInfo
- implements HttpRequestInfo {
-
- final HttpServletRequest request;
-
- /** Creates a new instance of HttpRequestInfoImpl */
+public class HttpRequestInfoImpl extends HttpTransportInfo implements HttpRequestInfo {
+
+ private final HttpServletRequest request;
+
public HttpRequestInfoImpl(HttpServletRequest request) {
this.request = request;
}
-
+
/**
* @return the http servlet request
*/
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpResponseInfo.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpResponseInfo.java
index 5e14b3f..91baa0f 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpResponseInfo.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpResponseInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,9 +16,8 @@
package org.glassfish.webservices.monitoring;
-import javax.servlet.http.HttpServletResponse;
-
+import jakarta.servlet.http.HttpServletResponse;
public interface HttpResponseInfo {
- public HttpServletResponse getResponse();
+ HttpServletResponse getResponse();
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpResponseInfoImpl.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpResponseInfoImpl.java
index c38b4c8..7bf4db6 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpResponseInfoImpl.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/HttpResponseInfoImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,24 +16,21 @@
package org.glassfish.webservices.monitoring;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
/**
* Implementation of the HttpResponseInfo interface
*
* @author Jerome Dochez
*/
-public class HttpResponseInfoImpl extends HttpTransportInfo
- implements HttpResponseInfo {
-
-
- final HttpServletResponse response;
-
- /** Creates a new instance of HttpResponseInfoImpl */
+public class HttpResponseInfoImpl extends HttpTransportInfo implements HttpResponseInfo {
+
+ private final HttpServletResponse response;
+
public HttpResponseInfoImpl(HttpServletResponse response) {
- this.response =response;
+ this.response = response;
}
-
+
/**
* @return the http servlet response
*/
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/JAXWSEndpointImpl.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/JAXWSEndpointImpl.java
index b23ec26..a7df29e 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/JAXWSEndpointImpl.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/JAXWSEndpointImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,13 +16,14 @@
package org.glassfish.webservices.monitoring;
-import java.util.logging.Level;
-import javax.servlet.http.HttpServletRequest;
-import jakarta.xml.ws.handler.MessageContext;
-
-import org.glassfish.webservices.SOAPMessageContext;
+import static java.util.logging.Level.WARNING;
+import static org.glassfish.webservices.LogUtils.EXCEPTION_TRACING_RESPONSE;
import org.glassfish.webservices.LogUtils;
+import org.glassfish.webservices.SOAPMessageContext;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.xml.ws.handler.MessageContext;
public class JAXWSEndpointImpl extends EndpointImpl {
@@ -30,73 +31,72 @@
JAXWSEndpointImpl(String endpointSelector, EndpointType type) {
super(endpointSelector, type);
}
-
- public boolean processRequest(SOAPMessageContext messageContext)
- throws Exception {
- boolean status = true;
+ public boolean processRequest(SOAPMessageContext messageContext) throws Exception {
+
+ boolean status = true;
// let's get our thread local context
WebServiceEngineImpl wsEngine = WebServiceEngineImpl.getInstance();
- try {
+ try {
if (!listeners.isEmpty() || wsEngine.hasGlobalMessageListener()) {
- String messageID = (String) messageContext.get(EndpointImpl.MESSAGE_ID);
-
+ String messageID = (String) messageContext.get(MESSAGE_ID);
+
// someone is listening ?
- if (messageID!=null) {
+ if (messageID != null) {
HttpServletRequest httpReq = (HttpServletRequest) messageContext.get(MessageContext.SERVLET_REQUEST);
HttpRequestInfoImpl info = new HttpRequestInfoImpl(httpReq);
wsEngine.processRequest(messageID, messageContext, info);
- }
-
+ }
+
// any local listeners ?
if (!listeners.isEmpty()) {
// create the message trace and save it to our message context
MessageTraceImpl request = new MessageTraceImpl();
request.setEndpoint(this);
- request.setMessageContext(messageContext);
+ request.setMessageContext(messageContext);
HttpServletRequest httpReq = (HttpServletRequest) messageContext.get(MessageContext.SERVLET_REQUEST);
request.setTransportInfo(new HttpRequestInfoImpl(httpReq));
- messageContext.put(EndpointImpl.REQUEST_TRACE, request);
+ messageContext.put(EndpointImpl.REQUEST_TRACE, request);
}
}
- } catch(Exception e) {
- WebServiceEngineImpl.sLogger.log(Level.WARNING, LogUtils.EXCEPTION_TRACING_REQUEST, e.getMessage());
- throw e;
+ } catch (Exception e) {
+ WebServiceEngineImpl.sLogger.log(WARNING, LogUtils.EXCEPTION_TRACING_REQUEST, e.getMessage());
+ throw e;
}
return status;
}
- public void processResponse(SOAPMessageContext messageContext) throws Exception {
-
+ public void processResponse(SOAPMessageContext messageContext) throws Exception {
+
// let's get our thread local context
WebServiceEngineImpl wsEngine = WebServiceEngineImpl.getInstance();
try {
-
+
if (wsEngine.hasGlobalMessageListener() || !listeners.isEmpty()) {
-
- String messageID = (String) messageContext.get(EndpointImpl.MESSAGE_ID);
+
+ String messageID = (String) messageContext.get(MESSAGE_ID);
// do we have a global listener ?
- if (messageID!=null) {
- wsEngine.processResponse(messageID, messageContext);
+ if (messageID != null) {
+ wsEngine.processResponse(messageID, messageContext);
}
-
+
// local listeners
if (!listeners.isEmpty()) {
MessageTraceImpl response = new MessageTraceImpl();
response.setEndpoint(this);
response.setMessageContext(messageContext);
- //TODO BM check regarding this method
+ // TODO BM check regarding this method
for (org.glassfish.webservices.monitoring.MessageListener listener : listeners) {
listener.invocationProcessed((MessageTrace) messageContext.get(REQUEST_TRACE), response);
}
}
}
- } catch(Exception e) {
- WebServiceEngineImpl.sLogger.log(Level.WARNING, LogUtils.EXCEPTION_TRACING_RESPONSE, e.getMessage());
- throw e;
- }
+ } catch (Exception e) {
+ WebServiceEngineImpl.sLogger.log(WARNING, EXCEPTION_TRACING_RESPONSE, e.getMessage());
+ throw e;
+ }
}
-
+
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/ThreadLocalInfo.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/ThreadLocalInfo.java
index 86507bb..3f0de0a 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/ThreadLocalInfo.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/ThreadLocalInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,9 +16,7 @@
package org.glassfish.webservices.monitoring;
-import org.glassfish.webservices.monitoring.MessageTraceImpl;
-
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
/**
* This class encapsulates all information contained in the thread local
@@ -27,32 +25,30 @@
* @author Jerome Dochez
*/
public class ThreadLocalInfo {
-
- final private String messageId;
- final private HttpServletRequest request;
+
+ private final String messageId;
+ private final HttpServletRequest request;
private MessageTraceImpl requestMessageTrace;
-
- /** Creates a new instance of ServletThreadLocalConfiguration */
+
public ThreadLocalInfo(String messageId, HttpServletRequest request) {
this.messageId = messageId;
this.request = request;
}
-
+
public String getMessageId() {
return messageId;
}
-
+
public HttpServletRequest getRequest() {
return request;
}
-
+
public void setRequestMessageTrace(MessageTraceImpl trace) {
requestMessageTrace = trace;
}
-
+
public MessageTraceImpl getRequestMessageTrace() {
return requestMessageTrace;
}
-
-
+
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/WebServiceStatsProvider.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/WebServiceStatsProvider.java
index c29538a..e85de61 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/WebServiceStatsProvider.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/WebServiceStatsProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,46 +16,53 @@
package org.glassfish.webservices.monitoring;
-import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
+import static java.util.logging.Level.SEVERE;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.glassfish.external.probe.provider.annotations.ProbeListener;
import org.glassfish.external.probe.provider.annotations.ProbeParam;
import org.glassfish.external.statistics.Statistic;
import org.glassfish.external.statistics.Stats;
-import org.glassfish.gmbal.*;
+import org.glassfish.gmbal.AMXMetadata;
+import org.glassfish.gmbal.Description;
+import org.glassfish.gmbal.ManagedAttribute;
+import org.glassfish.gmbal.ManagedData;
+import org.glassfish.gmbal.ManagedObject;
+import org.glassfish.gmbal.ManagedOperation;
+import org.glassfish.webservices.LogUtils;
import org.glassfish.webservices.deployment.DeployedEndpointData;
-import javax.servlet.ServletContext;
-import java.util.*;
-import java.util.logging.Level;
-import org.glassfish.webservices.LogUtils;
+import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
/**
* Provides statistics for Web Service endpoints.
*
- * For deployment - keeps track of 109 and sun-jaxws.xml style deployed
- * applications.
+ * For deployment - keeps track of 109 and sun-jaxws.xml style deployed applications.
*
* @author Jitendra Kotamraju
*/
-@AMXMetadata(type="web-service-mon", group="monitoring")
+@AMXMetadata(type = "web-service-mon", group = "monitoring")
@ManagedObject
@Description("Stats for Web Services deployed")
public class WebServiceStatsProvider {
// path (context path+url-pattern) --> deployed data
- private final Map<String, DeployedEndpointData> endpoints =
- new HashMap<String, DeployedEndpointData>();
+ private final Map<String, DeployedEndpointData> endpoints = new HashMap<String, DeployedEndpointData>();
// Only RI endpoints
- private final Map<String, List<DeployedEndpointData>> riEndpoints =
- new HashMap<String, List<DeployedEndpointData>>();
+ private final Map<String, List<DeployedEndpointData>> riEndpoints = new HashMap<String, List<DeployedEndpointData>>();
// sun-jaxws.xml deployment
@ProbeListener("glassfish:webservices:deployment-ri:deploy")
- public synchronized void riDeploy(@ProbeParam("adapter")ServletAdapter adapter) {
+ public synchronized void riDeploy(@ProbeParam("adapter") ServletAdapter adapter) {
String contextPath = adapter.getServletContext().getContextPath();
- String path = contextPath+adapter.getValidPath();
+ String path = contextPath + adapter.getValidPath();
DeployedEndpointData data = endpoints.get(path);
if (data == null) {
data = new DeployedEndpointData(path, adapter);
@@ -72,20 +79,8 @@
// sun-jaxws.xml undeployment
@ProbeListener("glassfish:webservices:deployment-ri:undeploy")
- public synchronized void riUndeploy(@ProbeParam("adapter")ServletAdapter adapter) {
- LogUtils.getLogger().log(Level.SEVERE, "!!! TODO: UNCOMMENT LINE(S) BELLOW !!! ({0})", WebServiceStatsProvider.class.getName());
-// ServletContext ctxt = adapter.getServletContext();
-// String name = ctxt.getContextPath()+adapter.getValidPath();
-// DeployedEndpointData data = endpoints.remove(name);
-//
-// String contextPath = adapter.getServletContext().getContextPath();
-// List<DeployedEndpointData> ri = riEndpoints.get(contextPath);
-// if (ri != null) {
-// ri.remove(data);
-// if (ri.isEmpty()) {
-// riEndpoints.remove(contextPath);
-// }
-// }
+ public synchronized void riUndeploy(@ProbeParam("adapter") ServletAdapter adapter) {
+ LogUtils.getLogger().log(SEVERE, "!!! TODO: UNCOMMENT LINE(S) BELLOW !!! ({0})", WebServiceStatsProvider.class.getName());
}
// admin CLI doesn't pick-up Collection<DeployedEndpointData>. Hence
@@ -102,10 +97,11 @@
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
List<DeployedEndpointData> ri = riEndpoints.get(contextPath);
if (ri != null) {
- for(DeployedEndpointData de : ri) {
+ for (DeployedEndpointData de : ri) {
list.add(de.getStaticAsMap());
}
}
+
return list;
}
@@ -116,7 +112,7 @@
final DeployedEndpointData[] data;
MyStats(Map<String, DeployedEndpointData> curEndpoints) {
- endpoints.putAll(curEndpoints); // Take a snapshot of current endpoints
+ endpoints.putAll(curEndpoints); // Take a snapshot of current endpoints
data = this.endpoints.values().toArray(new DeployedEndpointData[endpoints.size()]);
}
diff --git a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/WebServiceTesterServlet.java b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/WebServiceTesterServlet.java
index f519ff6..4509283 100644
--- a/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/WebServiceTesterServlet.java
+++ b/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/monitoring/WebServiceTesterServlet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -22,36 +22,43 @@
package org.glassfish.webservices.monitoring;
-import com.sun.enterprise.deployment.WebServiceEndpoint;
-import com.sun.enterprise.util.LocalStringManagerImpl;
-import com.sun.tools.ws.spi.WSToolsObjectFactory;
-import org.glassfish.jaxb.runtime.api.JAXBRIContext;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.Logger;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import javax.xml.namespace.QName;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+
+import org.glassfish.jaxb.runtime.api.JAXBRIContext;
+import org.glassfish.webservices.LogUtils;
+
+import com.sun.enterprise.deployment.WebServiceEndpoint;
+import com.sun.enterprise.util.LocalStringManagerImpl;
+import com.sun.tools.ws.spi.WSToolsObjectFactory;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import jakarta.xml.ws.Service;
import jakarta.xml.ws.WebEndpoint;
-import java.io.*;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLDecoder;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.glassfish.webservices.WebServiceContractImpl;
-import com.sun.enterprise.module.*;
-import org.glassfish.webservices.LogUtils;
/**
* This servlet is responsible for testing web-services.
diff --git a/appserver/webservices/pom.xml b/appserver/webservices/pom.xml
index 8d65adf..2ded55b 100755
--- a/appserver/webservices/pom.xml
+++ b/appserver/webservices/pom.xml
@@ -25,14 +25,16 @@
<version>6.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
+
<groupId>org.glassfish.main.webservices</groupId>
<artifactId>webservices</artifactId>
<packaging>pom</packaging>
- <name>GlassFish Web Services related modules</name>
+ <name>GlassFish Web Services related modules</name>
+
<modules>
<module>metro-fragments</module>
<module>metro-glue</module>
- <module>connector</module>
+ <module>connector</module>
<module>jsr109-impl</module>
<module>soap-tcp</module>
<module>webservices-scripts</module>
diff --git a/nucleus/parent/pom.xml b/nucleus/parent/pom.xml
index 76304a1..2ff24de 100644
--- a/nucleus/parent/pom.xml
+++ b/nucleus/parent/pom.xml
@@ -85,7 +85,7 @@
<slf4j.version>1.7.21</slf4j.version>
<management-api.version>1.1-rev-1</management-api.version>
<servlet-api.version>5.0.0-M1</servlet-api.version>
- <grizzly.version>2.4.4</grizzly.version>
+ <grizzly.version>3.0.0-M1</grizzly.version>
<grizzly.npn.version>1.9</grizzly.npn.version>
<jboss.logging.annotation.version>2.2.1.Final</jboss.logging.annotation.version>
<jakarta.validation.version>3.0.0-M1</jakarta.validation.version>