当前位置: 首页>>代码示例>>Java>>正文


Java MultitenantConstants.TENANT_AWARE_URL_PREFIX属性代码示例

本文整理汇总了Java中org.wso2.carbon.utils.multitenancy.MultitenantConstants.TENANT_AWARE_URL_PREFIX属性的典型用法代码示例。如果您正苦于以下问题:Java MultitenantConstants.TENANT_AWARE_URL_PREFIX属性的具体用法?Java MultitenantConstants.TENANT_AWARE_URL_PREFIX怎么用?Java MultitenantConstants.TENANT_AWARE_URL_PREFIX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.wso2.carbon.utils.multitenancy.MultitenantConstants的用法示例。


在下文中一共展示了MultitenantConstants.TENANT_AWARE_URL_PREFIX属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getContextRoot

protected String getContextRoot(HttpServletRequest request) {
    String contextPath = (request.getContextPath().equals("")) ? "" : request.getContextPath();
    int index;
    if (contextPath.equals("/fileupload")) {
        contextPath = "";
    } else {
        if ((index = contextPath.indexOf("/fileupload")) > -1) {
            contextPath = contextPath.substring(0, index);
        }
    }
    // Make the context root tenant aware, eg: /t/wso2.com in a multi-tenant scenario
    String tenantDomain = (String)request.getSession().getAttribute(MultitenantConstants.TENANT_DOMAIN);
    if(!contextPath.startsWith("/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/")
            && (tenantDomain != null &&
            !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) ){
        contextPath = contextPath + "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" +
                      tenantDomain;
        // replace the possible '//' with '/ '
        contextPath = contextPath.replaceAll("//", "/");
    }
    return contextPath;
}
 
开发者ID:apache,项目名称:stratos,代码行数:22,代码来源:AbstractFileUploadExecutor.java

示例2: getRegistrationServiceURL

private String getRegistrationServiceURL() throws B4PCoordinationException, FaultException {
    String tenantDomain = "";
    try {
        tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
    } catch (Throwable e) {
        tenantDomain = null;
    }
    String registrationServiceURL = generateServiceURLUpToWebContext() + ((tenantDomain != null &&
            !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) ?
            "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" + tenantDomain : "") +
            BPEL4PeopleConstants.CARBON_ADMIN_SERVICE_CONTEXT_ROOT + "/"
            + BPEL4PeopleConstants.B4P_REGISTRATION_SERVICE + "/";
    return registrationServiceURL;
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:14,代码来源:PeopleActivity.java

示例3: getContextRoot

public static String getContextRoot(HttpServletRequest request) {

        /*ServletContext context = request.getSession().getServletContext();
        HttpSession session = request.getSession();

        String serverURL = CarbonUIUtil.getServerURL(context, session);
        String serverRoot = serverURL.substring(0, serverURL.length() - "services/".length());
        serverRoot = serverRoot.substring(serverRoot.indexOf("//") + "//".length(), serverRoot.length());
        serverRoot = serverRoot.substring(serverRoot.indexOf("/") + "/".length(), serverRoot.length());
        return "/" + serverRoot;*/
        String contextRoot = request.getContextPath();
        if (contextRoot.startsWith("//")) {
            contextRoot = contextRoot.substring(1);
        }

        // We need a context root in the format '/foo/', for this logic to work.
        if (!contextRoot.startsWith(RegistryConstants.PATH_SEPARATOR)) {
            contextRoot = RegistryConstants.PATH_SEPARATOR + contextRoot;
        }
        if (!contextRoot.endsWith(RegistryConstants.PATH_SEPARATOR)) {
            contextRoot = contextRoot + RegistryConstants.PATH_SEPARATOR;
        }

        // Hack to obtain the correct context root.
        // The particular request that we get in here, due to some reason has a wrong context path.
        // TODO: Identify the true cause of this problem and fix this.
        if (contextRoot.endsWith("carbon/") && !request.getServletPath().startsWith("/carbon")) {
            contextRoot = contextRoot.substring(0, contextRoot.length() - "carbon/".length());
        }

        String tenantDomain = (String)request.getSession().getAttribute(MultitenantConstants.TENANT_DOMAIN);
        if (tenantDomain != null &&
                !tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
            contextRoot = "/"+ MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" + tenantDomain + contextRoot;
        }

        return contextRoot;
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:38,代码来源:UIUtil.java

示例4: handleLoginPageRequest

/**
 * 
 * @param requestedURI
 * @param request
 * @param response
 * @param authenticated
 * @param context
 * @param indexPageURL
 * @return
 * @throws IOException
 */
protected static int handleLoginPageRequest(String requestedURI, HttpServletRequest request,
        HttpServletResponse response, boolean authenticated, String context, String indexPageURL)
        throws IOException {
    if (requestedURI.indexOf("login.jsp") > -1
            || requestedURI.indexOf("login_ajaxprocessor.jsp") > -1
            || requestedURI.indexOf("admin/layout/template.jsp") > -1
            || requestedURI.endsWith("/filedownload") || requestedURI.endsWith("/fileupload")
            || requestedURI.indexOf("/fileupload/") > -1
            || requestedURI.indexOf("login_action.jsp") > -1
            || requestedURI.indexOf("admin/jsp/WSRequestXSSproxy_ajaxprocessor.jsp") > -1) {

        if ((requestedURI.indexOf("login.jsp") > -1
                || requestedURI.indexOf("login_ajaxprocessor.jsp") > -1 || requestedURI
                .indexOf("login_action.jsp") > -1) && authenticated) {
            // User has typed the login page url, while being logged in
            if (request.getSession().getAttribute(MultitenantConstants.TENANT_DOMAIN) != null) {
                String tenantDomain = (String) request.getSession().getAttribute(
                        MultitenantConstants.TENANT_DOMAIN);
                if (tenantDomain != null
                        && !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
                    context += "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/"
                            + tenantDomain;
                }
            }
            if(log.isDebugEnabled()){
            	log.debug("User already authenticated. Redirecting to " + indexPageURL);
            }
            // redirect relative to the servlet container root
            response.sendRedirect(context + "/carbon/admin/index.jsp");
            return RETURN_FALSE;
        } else if (requestedURI.indexOf("login_action.jsp") > -1 && !authenticated) {
            // User is not yet authenticated and now trying to get authenticated
            // do nothing, leave for authentication at the end
            if (log.isDebugEnabled()) {
                log.debug("User is not yet authenticated and now trying to get authenticated;"
                        + "do nothing, leave for authentication at the end");
            }
            return CONTINUE;
        } else {
if (log.isDebugEnabled()) {
	log.debug("Skipping security checks for " + requestedURI);
}
            return RETURN_TRUE;
        }
    }

    return CONTINUE;
}
 
开发者ID:apache,项目名称:stratos,代码行数:59,代码来源:CarbonUILoginUtil.java


注:本文中的org.wso2.carbon.utils.multitenancy.MultitenantConstants.TENANT_AWARE_URL_PREFIX属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。