Author: ffang
Date: Fri May 13 09:51:18 2011
New Revision: 1102640
URL: http://svn.apache.org/viewvc?rev=1102640&view=rev
Log:
[CXF-3506]Service list page displays no services in unformatted mode
Modified:
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java
cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
Modified:
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java?rev=1102640&r1=1102639&r2=1102640&view=diff
==============================================================================
---
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
(original)
+++
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
Fri May 13 09:51:18 2011
@@ -71,7 +71,8 @@ public class FormattedServiceListWriter
AbstractDestination[] destinations)
throws IOException {
writer.write("<span class=\"heading\">Available SOAP
services:</span><br/>");
- writer.write("<table>");
+ writer.write("<table " + (styleSheetPath.endsWith("stylesheet=1")
+ ? "cellpadding=\"1\" cellspacing=\"1\"
border=\"1\" width=\"100%\"" : "") + ">");
for (AbstractDestination sd : destinations) {
writerSoapEndpoint(writer, sd);
}
@@ -105,7 +106,8 @@ public class FormattedServiceListWriter
private void writeRESTfulEndpoints(PrintWriter writer,
AbstractDestination[] restfulDests)
throws IOException {
writer.write("<span class=\"heading\">Available RESTful
services:</span><br/>");
- writer.write("<table>");
+ writer.write("<table " + (styleSheetPath.endsWith("stylesheet=1")
+ ? "cellpadding=\"1\" cellspacing=\"1\" border=\"1\"
width=\"100%\"" : "") + ">");
for (AbstractDestination sd : restfulDests) {
writeRESTfulEndpoint(writer, sd);
}
Modified:
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java?rev=1102640&r1=1102639&r2=1102640&view=diff
==============================================================================
---
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java
(original)
+++
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java
Fri May 13 09:51:18 2011
@@ -31,13 +31,13 @@ public class UnformattedServiceListWrite
}
public String getContentType() {
- return "text/plain; charset=UTF-8";
+ return "text/html; charset=UTF-8";
}
public void writeServiceList(PrintWriter writer,
AbstractDestination[] soapDestinations,
AbstractDestination[] restDestinations)
throws IOException {
- if (soapDestinations.length > 0 && restDestinations.length > 0) {
+ if (soapDestinations.length > 0 || restDestinations.length > 0) {
writeUnformattedSOAPEndpoints(writer, soapDestinations);
writeUnformattedRESTfulEndpoints(writer, restDestinations);
} else {
Modified:
cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java?rev=1102640&r1=1102639&r2=1102640&view=diff
==============================================================================
---
cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
(original)
+++
cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
Fri May 13 09:51:18 2011
@@ -128,6 +128,19 @@ public class CXFServletTest extends Abst
}
@Test
+ public void testGetUnformatServiceList() throws Exception {
+ ServletUnitClient client = newClient();
+ client.setExceptionsThrownOnErrorStatus(false);
+
+ WebResponse res = client.getResponse(CONTEXT_URL +
"/services?formatted=false");
+
+
assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter3"));
+
assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter2"));
+
assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter"));
+
+ }
+
+ @Test
public void testGetWSDL() throws Exception {
ServletUnitClient client = newClient();
client.setExceptionsThrownOnErrorStatus(true);