Author: keith Date: Sun Aug 3 22:35:24 2008 New Revision: 20327 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20327
Log: /opt/svn/mashup/modules/core/target/wso2mashup-core-SNAPSHOT.jar Modified: branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java Modified: branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java?rev=20327&r1=20326&r2=20327&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java (original) +++ branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java Sun Aug 3 22:35:24 2008 @@ -60,53 +60,64 @@ StringBuffer url = request.getRequestURL(); int index = url.indexOf(":"); String protocol = url.substring(0, index); - if (!axisService.isEnableAllTransports() && !axisService.isExposedTransport(protocol)) { - ServerManager serverManager = ServerManager.getInstance(); - String redirectURL = ""; - if (ServerConstants.HTTP_TRANSPORT.equals(protocol)) { - TransportInDescription httpsTransport = - configuration.getTransportIn(ServerConstants.HTTPS_TRANSPORT); - Parameter parameter = httpsTransport.getParameter("proxyPort"); - String port = ""; - if (parameter != null) { - String value = (String) parameter.getValue(); - if (!"443".equals(value)) { - port = ":" + value; - } - } else { - port = ":" + serverManager.getHttpsPort(); - } - redirectURL = "https://" + request.getServerName() + port + requestURI + "?" + - request.getQueryString(); - } else if (ServerConstants.HTTPS_TRANSPORT.equals(protocol)) { - TransportInDescription httpsTransport = - configuration.getTransportIn(ServerConstants.HTTP_TRANSPORT); - Parameter parameter = httpsTransport.getParameter("proxyPort"); - String port = ""; - if (parameter != null) { - String value = (String) parameter.getValue(); - if (!"80".equals(value)) { - port = ":" + value; - } - } else { - port = ":" + serverManager.getHttpPort(); - } - 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 + 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>Service " + serviceName + - " is not exposed over http or https transports. Cannot display <em>TryIt</em>.</h4>") - .getBytes()); + .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; } - response.sendRedirect(redirectURL); - return; + if (!axisService.isExposedTransport(protocol)) { + ServerManager serverManager = ServerManager.getInstance(); + String redirectURL = ""; + if (ServerConstants.HTTP_TRANSPORT.equals(protocol)) { + TransportInDescription httpsTransport = + configuration.getTransportIn(ServerConstants.HTTPS_TRANSPORT); + Parameter parameter = httpsTransport.getParameter("proxyPort"); + String port = ""; + if (parameter != null) { + String value = (String) parameter.getValue(); + if (!"443".equals(value)) { + port = ":" + value; + } + } else { + port = ":" + serverManager.getHttpsPort(); + } + redirectURL = "https://" + request.getServerName() + port + requestURI + "?" + + request.getQueryString(); + } else if (ServerConstants.HTTPS_TRANSPORT.equals(protocol)) { + TransportInDescription httpsTransport = + configuration.getTransportIn(ServerConstants.HTTP_TRANSPORT); + Parameter parameter = httpsTransport.getParameter("proxyPort"); + String port = ""; + if (parameter != null) { + String value = (String) parameter.getValue(); + if (!"80".equals(value)) { + port = ":" + value; + } + } else { + port = ":" + serverManager.getHttpPort(); + } + 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; + } } if (!axisService.isActive()) { _______________________________________________ Mashup-dev mailing list [email protected] http://mailman.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
