/** * get logo URL to String * * @param httpContext * @return String */ public String getLogoUrl(HttpContext httpContext, boolean isRealLogo) { String portalName = ExoContainerContext.getCurrentContainer() .getContext() .getPortalContainerName(); String logoFolderUrl = httpContext.getScheme() + "://" + httpContext.getServerName() + ":" + httpContext.getServerPort() + "/" + portalName + "/rest/jcr/repository/collaboration/Application%20Data/logos/"; String logoUrl = null; if (isRealLogo) { logoUrl = logoFolderUrl + BrandingDataStorageService.logo_name + "?" + System.currentTimeMillis(); } else { logoUrl = logoFolderUrl + BrandingDataStorageService.logo_preview_name + "?" + System.currentTimeMillis(); } if (!isExiste(logoUrl)) { logoUrl = "/eXoSkin/skin/images/themes/default/platform/skin/ToolbarContainer/HomeIcon.png"; } return logoUrl; }
public static void forgetIdentity() { HttpContext context = Request.getCurrent().getHttpContext(); if (context instanceof ServletWebBridge) { ServletWebBridge bridge = (ServletWebBridge) context; String name = DEFAULT_REMEMBER_ME_COOKIE_NAME; String value = DELETED_COOKIE_VALUE; String domain = context.getServerName(); String path = context.getContextPath(); int maxAge = 0; // always zero for deletion final String headerValue = buildHeaderValue(name, value, domain.trim(), path.trim(), maxAge); bridge.getResponse().setHeader(COOKIE_HEADER_NAME, headerValue); } }
private String readCookieValue(String name) { HttpContext context = Request.getCurrent().getBridge().getHttpContext(); Cookie[] cookies = context.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals(name)) { return cookie.getValue(); } } } return null; }
HttpMethod requestMethod = bridge.getHttpContext().getMethod(); Iterator<RouteMatch> matches = root.matcher(requestPath.substring(bridge.getRequestContext().getPath().length()), Collections.<String, String[]>emptyMap());
HttpMethod requestMethod = bridge.getHttpContext().getMethod(); Iterator<RouteMatch> matches = root.matcher(requestPath.substring(bridge.getRequestContext().getPath().length()), Collections.<String, String[]>emptyMap());
public static void rememberSerialized() { HttpContext context = Request.getCurrent().getHttpContext(); if (context instanceof ServletWebBridge) { ServletWebBridge bridge = (ServletWebBridge) context; // base 64 encode it and store as a cookie: DefaultSerializer<PrincipalCollection> serializer = new DefaultSerializer<PrincipalCollection>(); byte[] serialized = serializer.serialize(SecurityUtils.getSubject().getPrincipals()); serialized = encrypt(serialized); String base64 = Base64.encodeToString(serialized); String name = DEFAULT_REMEMBER_ME_COOKIE_NAME; String value = base64; String domain = context.getServerName(); String path = context.getContextPath(); int maxAge = ONE_YEAR; // always zero for deletion final String headerValue = buildHeaderValue(name, value, domain.trim(), path.trim(), maxAge); bridge.getResponse().setHeader(COOKIE_HEADER_NAME, headerValue); } }