public static void addLink( Element root, String searchURL, String rel, String keywords, int page, int itemsPerPage) { Element link = addElement(root, "link", DEFAULT_NAMESPACE); link.addAttribute("rel", rel); searchURL = HttpUtil.addParameter( searchURL, "keywords", URLCodec.encodeURL(keywords)); searchURL = HttpUtil.addParameter(searchURL, "p", page); searchURL = HttpUtil.addParameter(searchURL, "c", itemsPerPage); searchURL = HttpUtil.addParameter(searchURL, "format", "atom"); link.addAttribute("href", searchURL); link.addAttribute("type", "application/atom+xml"); }
/** * @deprecated As of Judson (7.1.x), replaced by {@link * URLCodec#encodeURL(String)} */ @Deprecated public static String encodeURL(String url) { return getHttp().encodeURL(url); }
public static void checkConnect(String location) { String domainAndPort = HttpUtil.getDomain(location); String[] domainAndPortArray = StringUtil.split( domainAndPort, CharPool.COLON); String domain = domainAndPortArray[0]; int port = -1; if (domainAndPortArray.length > 1) { port = GetterUtil.getInteger(domainAndPortArray[1]); } String protocol = HttpUtil.getProtocol(location); _checkConnect(domain, port, protocol); }
tokens.put("portal_ctx", themeDisplay.getPathContext()); tokens.put( "portal_url", HttpUtil.removeProtocol(themeDisplay.getURLPortal())); tokens.put( "protocol", HttpUtil.getProtocol(themeDisplay.getURLPortal())); tokens.put("root_path", themeDisplay.getPathContext()); tokens.put(
params, requestContext); return HttpUtil.addParameter( HttpUtil.removeParameter(actualURL, "p_v_l_s_g_id"), "p_v_l_s_g_id", groupId);
@Override public Source resolve(String href, String base) { try { String content = null; Matcher matcher = _templateIdPattern.matcher(href); if (matcher.matches()) { long articleGroupId = GetterUtil.getLong( _tokens.get("article_group_id")); String templateId = matcher.group(1); content = JournalHelperUtil.getTemplateScript( articleGroupId, templateId, _tokens, _languageId); } else { content = HttpUtil.URLtoString(href); } return new StreamSource(new UnsyncStringReader(content)); } catch (Exception e) { _log.error(href + " does not reference a valid template"); return null; } }
public String getProtocol() { return HttpUtil.getProtocol(_secure); }
_pathThemeImages = themeDisplay.getPathThemeImages(); _plid = themeDisplay.getPlid(); _portalURL = HttpUtil.removeProtocol(themeDisplay.getPortalURL()); _realUserId = themeDisplay.getRealUserId(); _scopeGroupId = themeDisplay.getScopeGroupId(); _serverPort = themeDisplay.getServerPort(); _timeZone = themeDisplay.getTimeZone(); _urlPortal = HttpUtil.removeProtocol(themeDisplay.getURLPortal()); _userId = themeDisplay.getUserId();
@Override public String decode(String s) { return HttpUtil.decodeURL(s); }
public static String[] getPathArray(String path, boolean fixTrailing) { path = HttpUtil.fixPath(path, true, fixTrailing); return StringUtil.split(path, CharPool.SLASH); }
public BaseResourceImpl( String parentPath, String name, String displayName, Date createDate, Date modifiedDate, long size) { _displayName = displayName; _size = size; String href = HttpUtil.encodePath(parentPath); if (Validator.isNotNull(name)) { href += StringPool.SLASH + URLCodec.encodeURL(name, true); } _href = href; if (createDate == null) { _createDate = new Date(); } else { _createDate = createDate; } if (modifiedDate == null) { _modifiedDate = new Date(); } else { _modifiedDate = modifiedDate; } }
public static String getDestination( HttpServletRequest request, String rootPath) { String headerDestination = request.getHeader("Destination"); String[] pathSegments = StringUtil.split(headerDestination, rootPath); String destination = pathSegments[pathSegments.length - 1]; destination = HttpUtil.decodePath(destination); if (_log.isDebugEnabled()) { _log.debug("Destination " + destination); } return destination; }
@Override protected String getLink( UserNotificationEvent userNotificationEvent, ServiceContext serviceContext) throws Exception { JSONObject jsonObject = JSONFactoryUtil.createJSONObject( userNotificationEvent.getPayload()); String entryURL = jsonObject.getString("entryURL"); if (Validator.isNull(entryURL)) { return StringPool.BLANK; } String entryURLDomain = HttpUtil.getDomain(entryURL); String portalURL = serviceContext.getPortalURL(); String portalURLDomain = HttpUtil.getDomain(portalURL); if (!entryURLDomain.equals(portalURLDomain)) { entryURL = StringUtil.replaceFirst( entryURL, entryURLDomain, portalURLDomain); } return entryURL; }
tokens.put( "portal_url", HttpUtil.removeProtocol(themeDisplayModel.getURLPortal())); tokens.put( "protocol", HttpUtil.getProtocol(themeDisplayModel.getURLPortal())); tokens.put("root_path", themeDisplayModel.getPathContext()); tokens.put(
content = HttpUtil.URLtoString(options);
/** * @deprecated As of Wilberforce (7.0.x), replaced by {@link * #decodeURL(String)} */ @Deprecated public static String decodeURL(String url, boolean unescapeSpaces) { return getHttp().decodeURL(url, unescapeSpaces); }
protected String buildArticleURL( String articleURL, long groupId, long folderId, String articleId) { String portletId = PortletProviderUtil.getPortletId( JournalArticle.class.getName(), PortletProvider.Action.EDIT); String namespace = PortalUtil.getPortletNamespace(portletId); articleURL = HttpUtil.addParameter( articleURL, namespace + "groupId", groupId); articleURL = HttpUtil.addParameter( articleURL, namespace + "folderId", folderId); articleURL = HttpUtil.addParameter( articleURL, namespace + "articleId", articleId); return articleURL; }
/** * @deprecated As of Judson (7.1.x), replaced by {@link * URLCodec#encodeURL(String, boolean)} */ @Deprecated public static String encodeURL(String url, boolean escapeSpaces) { return getHttp().encodeURL(url, escapeSpaces); }
public static byte[] URLtoByteArray(Http.Options options) throws IOException { return getHttp().URLtoByteArray(options); }
public static InputStream URLtoInputStream(String location) throws IOException { return getHttp().URLtoInputStream(location); }