本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}