[Mashup-dev] svn commit r20380 - trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor

keith at wso2.com keith at wso2.com
Mon Aug 4 23:20:33 PDT 2008


Author: keith
Date: Mon Aug  4 23:20:33 2008
New Revision: 20380
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20380

Log:
Fixing Mashup-1051


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=20380&r1=20379&r2=20380&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 Aug  4 23:20:33 2008
@@ -60,20 +60,11 @@
             StringBuffer url = request.getRequestURL();
             int index = url.indexOf(":");
             String protocol = url.substring(0, index);
-            if (!axisService.isEnableAllTransports()) {
-                if (!(axisService.isExposedTransport(ServerConstants.HTTP_TRANSPORT) ||
-                        axisService.isExposedTransport(ServerConstants.HTTPS_TRANSPORT))) {
-                    response.setContentType("text/html");
-                    response.setStatus(HttpServletResponse.SC_NOT_FOUND);
-                    outputStream
-                            .write(("<h4>The http and https transports are disabled on this service. The <em>TryIt</em> uses either of these transports to access the service and hence the <em>TryIt</em> page cannot be displayed.</h4>").getBytes());
-                    outputStream.flush();
-                    return;
-                }
-                if (!axisService.isExposedTransport(protocol)) {
+            if (!axisService.isEnableAllTransports() && !axisService.isExposedTransport(protocol)) {
                     ServerManager serverManager = ServerManager.getInstance();
-                    String redirectURL = "";
-                    if (ServerConstants.HTTP_TRANSPORT.equals(protocol)) {
+                    String redirectURL;
+                    if (ServerConstants.HTTP_TRANSPORT.equals(protocol) &&
+                            axisService.isExposedTransport(ServerConstants.HTTPS_TRANSPORT)) {
                         TransportInDescription httpsTransport =
                                 configuration.getTransportIn(ServerConstants.HTTPS_TRANSPORT);
                         Parameter parameter = httpsTransport.getParameter("proxyPort");
@@ -88,7 +79,10 @@
                         }
                         redirectURL = "https://" + request.getServerName() + port + requestURI + "?" +
                                 request.getQueryString();
-                    } else if (ServerConstants.HTTPS_TRANSPORT.equals(protocol)) {
+                        response.sendRedirect(redirectURL);
+                        return;
+                    } else if (ServerConstants.HTTPS_TRANSPORT.equals(protocol) &&
+                            axisService.isExposedTransport(ServerConstants.HTTP_TRANSPORT)) {
                         TransportInDescription httpsTransport =
                                 configuration.getTransportIn(ServerConstants.HTTP_TRANSPORT);
                         Parameter parameter = httpsTransport.getParameter("proxyPort");
@@ -103,21 +97,9 @@
                         }
                         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();
+                        response.sendRedirect(redirectURL);
                         return;
                     }
-                    response.sendRedirect(redirectURL);
-                    return;
-                }
             }
 
             if (!axisService.isActive()) {



More information about the Mashup-dev mailing list