Hi Thilina,
Why this commit as well as the commits 81441 and 81447, never made it to
trunk? They supposedly have fixed the Captcha generation logic [it should
use the hostname to resolve the captcha location] and a Theme Loading issue
[artifacts from the registry should be read using the hostname].

Apologies if this has already been discussed somewhere else or if I have
missed/misunderstood some important point here.

Thank you.
Regards,
Pradeeban.

On Thu, Nov 11, 2010 at 8:18 AM, <[email protected]> wrote:

> Author: thilinab
> Date: Wed Nov 10 18:48:15 2010
> New Revision: 81440
> URL: http://wso2.org/svn/browse/wso2?view=rev&revision=81440
>
> Log:
> Fixing a theme loading issue : artifacts from the registry should be read
> using the hostname.
>
> Modified:
>
> branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/java/org/wso2/carbon/ui/CarbonUIUtil.java
>
> branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/resources/web/admin/layout/template.jsp
>
> Modified:
> branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/java/org/wso2/carbon/ui/CarbonUIUtil.java
> URL:
> http://wso2.org/svn/browse/wso2/branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/java/org/wso2/carbon/ui/CarbonUIUtil.java?rev=81440&r1=81439&r2=81440&view=diff
>
> ==============================================================================
> ---
> branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/java/org/wso2/carbon/ui/CarbonUIUtil.java
>      (original)
> +++
> branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/java/org/wso2/carbon/ui/CarbonUIUtil.java
>      Wed Nov 10 18:48:15 2010
> @@ -171,6 +171,47 @@
>         return "https://"; + hostName + ":" + httpsPort + context +
> "/carbon/";
>     }
>
> +    public static String getAdminConsoleURLModified(HttpServletRequest
> request) {
> +
> +        // Hostname
> +        String hostName = "localhost";
> +        try {
> +            hostName = NetworkUtils.getLocalHostname();
> +        } catch (Exception ignored) {
> +        }
> +
> +        // HTTPS port
> +        String mgtConsoleTransport = CarbonUtils.getManagementTransport();
> +        int httpsPort =
> CarbonUtils.getTransportPort(CarbonUIServiceComponent
> +                .getConfigurationContextService(), mgtConsoleTransport);
> +
> +        // if the server is apache fronted then the admin url will contain
> the
> +        // apache fronted https port
> +        String apacheHttpsPort =
> ServerConfiguration.getInstance().getFirstProperty(
> +                "ApacheHttpsPort");
> +
> +        if (apacheHttpsPort != null && !"".equals(apacheHttpsPort)) {
> +            try {
> +                httpsPort = Integer.parseInt(apacheHttpsPort);
> +            } catch (NumberFormatException ne) {
> +                log.error("Apache HTTPS port is not a number in
> carbon.xml" + ne.getMessage());
> +            }
> +        }
> +
> +        // Context
> +//        String context = request.getContextPath();
> +//        if ("/".equals(context)) {
> +//            context = "";
> +//        }
> +
> +        String context =
> ServerConfiguration.getInstance().getFirstProperty("WebContextRoot");
> +
> +        if (httpsPort == -1) {
> +            return null;
> +        }
> +        return "https://"; + hostName + ":" + httpsPort + context +
> "/carbon/";
> +    }
> +
>     /**
>      * Returns url to admin console.
>      *
>
> Modified:
> branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/resources/web/admin/layout/template.jsp
> URL:
> http://wso2.org/svn/browse/wso2/branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/resources/web/admin/layout/template.jsp?rev=81440&r1=81439&r2=81440&view=diff
>
> ==============================================================================
> ---
> branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/resources/web/admin/layout/template.jsp
>        (original)
> +++
> branches/carbon/3.1.0/core/org.wso2.carbon.ui/3.1.0/src/main/resources/web/admin/layout/template.jsp
>        Wed Nov 10 18:48:15 2010
> @@ -41,10 +41,17 @@
>
>  .getAttribute(MultitenantConstants.TENANT_DOMAIN);
>        }
>        if (tenantDomain != null) {
> -               String serverURL = CarbonUIUtil.getServerURL(config
> -                               .getServletContext(),
> request.getSession());
> -               String serverRoot = serverURL.substring(0,
> serverURL.length()
> -                               - "services/".length());
> +
> +        String temp = CarbonUIUtil.getAdminConsoleURLModified(request);
> +        System.out.println("########### " + temp);
> +        String serverRoot = temp.substring(0,
> temp.lastIndexOf("carbon/"));
> +
> +        System.out.println("########### Server ROOT " + serverRoot);
> +
> +//             String serverURL = CarbonUIUtil.getServerURL(config
> +//                             .getServletContext(),
> request.getSession());
> +//             String serverRoot = serverURL.substring(0,
> serverURL.length()
> +//                             - "services/".length());
>                String themeRoot = serverRoot + "t/" + tenantDomain
>                                + "/registry/resource"
>                                +
> RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH
>
> _______________________________________________
> Carbon-commits mailing list
> [email protected]
> https://wso2.org/cgi-bin/mailman/listinfo/carbon-commits
>



-- 
Kathiravelu Pradeeban.
Software Engineer.
WSO2 Inc.

Blog: [Llovizna] http://kkpradeeban.blogspot.com/
_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to