You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/10/25 19:50:53 UTC
svn commit: r1188829 - in /cxf/branches/2.4.x-fixes: ./
rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/
rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/
rt/transports/http/src/main/resources/META-INF/spr...
Author: dkulp
Date: Tue Oct 25 17:50:52 2011
New Revision: 1188829
URL: http://svn.apache.org/viewvc?rev=1188829&view=rev
Log:
Merged revisions 1188646 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1188646 | sergeyb | 2011-10-25 09:19:43 -0400 (Tue, 25 Oct 2011) | 1 line
[CXF-3877] Updating services pages handler to optionally ignore endpoints with non-matching contexts, patch on behalf of Johan Edstrom applied with few mofifications
........
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/ServiceListGeneratorServlet.java
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml
Propchange: cxf/branches/2.4.x-fixes/
('svn:mergeinfo' removed)
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=1188829&r1=1188828&r2=1188829&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Tue Oct 25 17:50:52 2011
@@ -49,8 +49,6 @@ public class ServletController {
protected boolean isHideServiceList;
protected boolean disableAddressUpdates;
protected String forcedBaseAddress;
- protected String serviceListStyleSheet;
- protected String title;
protected String serviceListRelativePath = DEFAULT_LISTINGS_CLASSIFIER;
protected ServletConfig servletConfig;
protected DestinationRegistry destinationRegistry;
@@ -69,13 +67,6 @@ public class ServletController {
serviceListRelativePath = relativePath;
}
- public void setServiceListStyleSheet(String serviceListStyleSheet) {
- this.serviceListStyleSheet = serviceListStyleSheet;
- }
- public void setTitle(String t) {
- title = t;
- }
-
protected String getBaseURL(HttpServletRequest request) {
return forcedBaseAddress == null ? BaseUrlHelper.getBaseURL(request) : forcedBaseAddress;
}
Modified: cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java?rev=1188829&r1=1188828&r2=1188829&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java Tue Oct 25 17:50:52 2011
@@ -30,12 +30,15 @@ public class FormattedServiceListWriter
private String styleSheetPath;
private String title;
private Map<String, String> atomMap;
-
+ private boolean showForeignContexts;
+
public FormattedServiceListWriter(String styleSheetPath,
- String title,
+ String title,
+ boolean showForeignContexts,
Map<String, String> atomMap) {
this.styleSheetPath = styleSheetPath;
this.title = title;
+ this.showForeignContexts = showForeignContexts;
this.atomMap = atomMap;
}
@@ -85,6 +88,11 @@ public class FormattedServiceListWriter
private void writerSoapEndpoint(PrintWriter writer,
String basePath,
AbstractDestination sd) {
+ String absoluteURL = getAbsoluteAddress(basePath, sd);
+ if (absoluteURL == null) {
+ return;
+ }
+
writer.write("<tr><td>");
writer.write("<span class=\"porttypename\">"
+ sd.getEndpointInfo().getInterface().getName().getLocalPart() + "</span>");
@@ -97,7 +105,7 @@ public class FormattedServiceListWriter
writer.write("</ul>");
writer.write("</td><td>");
- String absoluteURL = getAbsoluteAddress(basePath, sd);
+
writer.write("<span class=\"field\">Endpoint address:</span> " + "<span class=\"value\">"
+ absoluteURL + "</span>");
writer.write("<br/><span class=\"field\">WSDL :</span> " + "<a href=\"" + absoluteURL
@@ -115,12 +123,19 @@ public class FormattedServiceListWriter
return endpointAddress;
}
endpointAddress = d.getEndpointInfo().getAddress();
- if (d instanceof ServletDestination
- && (endpointAddress.startsWith("http://") || endpointAddress.startsWith("https://"))) {
- String path = ((ServletDestination)d).getPath();
- return basePath + path;
- } else if (basePath == null || endpointAddress.startsWith(basePath)) {
- return endpointAddress;
+ if (endpointAddress.startsWith("http://") || endpointAddress.startsWith("https://")) {
+ if (endpointAddress.startsWith(basePath)) {
+ return endpointAddress;
+ } else if (showForeignContexts) {
+ if (d instanceof ServletDestination) {
+ String path = ((ServletDestination)d).getPath();
+ return basePath + path;
+ } else {
+ return endpointAddress;
+ }
+ } else {
+ return null;
+ }
} else {
return basePath + endpointAddress;
}
@@ -143,6 +158,9 @@ public class FormattedServiceListWriter
String basePath,
AbstractDestination sd) {
String absoluteURL = getAbsoluteAddress(basePath, sd);
+ if (absoluteURL == null) {
+ return;
+ }
writer.write("<tr><td>");
writer.write("<span class=\"field\">Endpoint address:</span> " + "<span class=\"value\">"
Modified: cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/ServiceListGeneratorServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/ServiceListGeneratorServlet.java?rev=1188829&r1=1188828&r2=1188829&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/ServiceListGeneratorServlet.java (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/ServiceListGeneratorServlet.java Tue Oct 25 17:50:52 2011
@@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import org.apache.cxf.Bus;
+import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.message.Message;
import org.apache.cxf.service.model.EndpointInfo;
@@ -44,6 +45,7 @@ public class ServiceListGeneratorServlet
private Bus bus;
private String serviceListStyleSheet;
private String title;
+ private boolean showForeignContexts = true;
public ServiceListGeneratorServlet(DestinationRegistry destinationRegistry, Bus bus) {
this.destinationRegistry = destinationRegistry;
@@ -98,7 +100,8 @@ public class ServiceListGeneratorServlet
} else {
styleSheetPath = request.getRequestURI() + "/?stylesheet=1";
}
- serviceListWriter = new FormattedServiceListWriter(styleSheetPath, title, atomMap);
+ serviceListWriter =
+ new FormattedServiceListWriter(styleSheetPath, title, showForeignContexts, atomMap);
}
response.setContentType(serviceListWriter.getContentType());
@@ -157,13 +160,18 @@ public class ServiceListGeneratorServlet
public void init(ServletConfig servletConfig) {
String configServiceListStyleSheet = servletConfig.getInitParameter("service-list-stylesheet");
- if (configServiceListStyleSheet != null) {
+ if (!StringUtils.isEmpty(configServiceListStyleSheet)) {
this.serviceListStyleSheet = configServiceListStyleSheet;
}
String configTitle = servletConfig.getInitParameter("service-list-title");
- if (configTitle != null) {
+ if (!StringUtils.isEmpty(configTitle)) {
this.title = configTitle;
}
+
+ String showAllContexts = servletConfig.getInitParameter("service-list-all-contexts");
+ if (!StringUtils.isEmpty(showAllContexts)) {
+ this.showForeignContexts = Boolean.valueOf(showAllContexts);
+ }
}
public ServletConfig getServletConfig() {
@@ -176,4 +184,5 @@ public class ServiceListGeneratorServlet
public void destroy() {
}
+
}
Modified: cxf/branches/2.4.x-fixes/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml?rev=1188829&r1=1188828&r2=1188829&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml Tue Oct 25 17:50:52 2011
@@ -39,6 +39,7 @@ http://www.springframework.org/schema/co
<prop key="org.apache.cxf.servlet.redirects-list"></prop>
<prop key="org.apache.cxf.servlet.redirect-servlet-name"></prop>
<prop key="org.apache.cxf.servlet.redirect-servlet-path"></prop>
+ <prop key="org.apache.cxf.servlet.service-list-all-contexts"></prop>
</osgix:cm-properties>
<ctx:property-placeholder properties-ref="cxfOsgiProperties"/>
@@ -60,7 +61,8 @@ http://www.springframework.org/schema/co
<entry key="static-resources-list" value="${org.apache.cxf.servlet.static-resources-list}"/>
<entry key="redirects-list" value="${org.apache.cxf.servlet.redirects-list}"/>
<entry key="redirect-servlet-name" value="${org.apache.cxf.servlet.redirect-servlet-name}"/>
- <entry key="redirect-servlet-path" value="${org.apache.cxf.servlet.redirect-servlet-path}"/>
+ <entry key="redirect-servlet-path" value="${org.apache.cxf.servlet.redirect-servlet-path}"/>
+ <entry key="service-list-all-contexts" value="${org.apache.cxf.servlet.service-list-all-contexts}"/>
</osgi:service-properties>
</osgi:service>