Author: keith
Date: Mon Jun 23 01:01:28 2008
New Revision: 18550
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=18550

Log:
Avoid displaying tryit if both http and https transports are disabled on a 
service


Modified:
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java?rev=18550&r1=18549&r2=18550&view=diff
==============================================================================
--- 
trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java
     (original)
+++ 
trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java
     Mon Jun 23 01:01:28 2008
@@ -44,6 +44,7 @@
             AxisConfiguration configuration = 
configurationContext.getAxisConfiguration();
             AxisService axisService = configuration
                     .getServiceForActivation(serviceName);
+            OutputStream outputStream = response.getOutputStream();
 
             // This is a fix for Mashup-861. If the transport is disabled we 
redirect the user to
             // the alternative transport
@@ -83,12 +84,22 @@
                     }
                     redirectURL = "http://"; + request.getServerName() + port + 
requestURI + "?" +
                             request.getQueryString();
+                } else {
+                    // There is no point showing the tryit if both http and 
https transports are
+                    // disabled on this service
+                    response.setContentType("text/html");
+                    response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                    outputStream
+                            .write(("<h4>Service " + serviceName +
+                                    " is not exposed over http or https 
transports. Cannot display <em>TryIt</em>.</h4>")
+                                    .getBytes());
+                    outputStream.flush();
+                    return;
                 }
                 response.sendRedirect(redirectURL);
                 return;
             }
 
-            OutputStream outputStream = response.getOutputStream();
             if (axisService != null) {
                 if (!axisService.isActive()) {
                     response.setContentType("text/html");

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to