public String getSearchUrl() { return Util.rawEncode(name); }
public String getUrl() { return "computer/" + Util.rawEncode(getName()) + "/"; }
public @Nonnull String getUrl() { return "user/" + Util.rawEncode(idStrategy().keyFor(id)); }
public @Nonnull String getSearchUrl() { return "/user/" + Util.rawEncode(idStrategy().keyFor(id)); }
/** * Same as {@link #getUrl()} except this returns a view/{name} path * even for the default view. */ public String getViewUrl() { return (owner!=null ? owner.getUrl() : "") + "view/" + Util.rawEncode(getViewName()) + '/'; }
/** * When there are multiple suggested items, this method can narrow down the resultset * to the SuggestedItem that has a url that contains the query. This is useful is one * job has a display name that matches another job's project name. * @param r A list of Suggested items. It is assumed that there is at least one * SuggestedItem in r. * @param query A query string * @return Returns the SuggestedItem which has a search url that contains the query. * If no SuggestedItems have a search url which contains the query, then the first * SuggestedItem in the List is returned. */ static SuggestedItem findClosestSuggestedItem(List<SuggestedItem> r, String query) { for(SuggestedItem curItem : r) { if(LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(String.format("item's searchUrl:%s;query=%s", curItem.item.getSearchUrl(), query)); } if(curItem.item.getSearchUrl().contains(Util.rawEncode(query))) { return curItem; } } // couldn't find an item with the query in the url so just // return the first one return r.get(0); }
public String getShortUrl() { String prefix = getParent().getUrlChildPrefix(); String subdir = Util.rawEncode(getName()); return prefix.equals(".") ? subdir + '/' : prefix + '/' + subdir + '/'; }
public String getSearchUrl() { Computer c = toComputer(); if (c != null) { return c.getUrl(); } return "computer/" + Util.rawEncode(getNodeName()); }
private StringBuilder retrieveProjectUrl(Job<?, ?> project) { return new StringBuilder() .append(Jenkins.getInstance().getRootUrl()) .append(GitLabWebHook.WEBHOOK_URL) .append(retrieveParentUrl(project)) .append('/').append(Util.rawEncode(project.getName())); }
public HttpResponse doIndex() { return new HttpRedirect("view/" + Util.rawEncode(getPrimaryView().getViewName()) + "/"); }
public HttpResponse doTest() { String referer = Stapler.getCurrentRequest().getReferer(); Jenkins j = Jenkins.getInstance(); // May need to send an absolute URL, since handling of HttpRedirect with a relative URL does not currently honor X-Forwarded-Proto/Port at all. String redirect = j.getRootUrl() + "administrativeMonitor/" + id + "/testForReverseProxySetup/" + (referer != null ? Util.rawEncode(referer) : "NO-REFERER") + "/"; LOGGER.log(Level.FINE, "coming from {0} and redirecting to {1}", new Object[] {referer, redirect}); return new HttpRedirect(redirect); }
private StringBuilder retrieveParentUrl(Item item) { if (item.getParent() instanceof Item) { Item parent = (Item) item.getParent(); return retrieveParentUrl(parent).append('/').append(Util.rawEncode(parent.getName())); } else { return new StringBuilder(); } }
Path p = new Path(Util.rawEncode(f.getName()), f.getName(), f.isDirectory(), f.length(), f.canRead(), f.lastModified()); if(!f.isDirectory()) { r.add(Collections.singletonList(p)); String relPath = Util.rawEncode(f.getName()); while(true) { break; f = sub.get(0); relPath += '/'+Util.rawEncode(f.getName()); l.add(new Path(relPath,f.getName(),true, f.length(), f.canRead(), f.lastModified()));
/** * Builds the path list and href recursively top-down. */ private static void buildPathList(VirtualFile baseDir, VirtualFile filePath, List<Path> pathList, StringBuilder href) throws IOException { VirtualFile parent = filePath.getParent(); if (!baseDir.equals(parent)) { buildPathList(baseDir, parent, pathList, href); } href.append(Util.rawEncode(filePath.getName())); if (filePath.isDirectory()) { href.append("/"); } Path path = new Path(href.toString(), filePath.getName(), filePath.isDirectory(), filePath.length(), filePath.canRead(), filePath.lastModified()); pathList.add(path); }
String child = sub.getName(); String childPath = path + child; String childHref = pathHref + Util.rawEncode(child); String length = sub.isFile() ? String.valueOf(sub.length()) : ""; boolean collapsed = (kids.length==1 && parent!=null);
/** * Accepts submission from the configuration page. */ @RequirePOST public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { JSONObject src = req.getSubmittedForm(); String newName = src.getString("name"), redirect = "."; XmlFile oldFile = null; if(!name.equals(newName)) { Jenkins.checkGoodName(newName); oldFile = getConfigFile(); // rename getParent().logRecorders.remove(name); this.name = newName; getParent().logRecorders.put(name,this); redirect = "../" + Util.rawEncode(newName) + '/'; } List<Target> newTargets = req.bindJSONToList(Target.class, src.get("targets")); for (Target t : newTargets) t.enable(); targets.replaceBy(newTargets); save(); if (oldFile!=null) oldFile.delete(); rsp.sendRedirect2(redirect); }
/** * Accepts submission from the configuration page. * * Subtypes should override the {@link #submit(StaplerRequest)} method. */ @RequirePOST public final synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException { checkPermission(CONFIGURE); submit(req); description = Util.nullify(req.getParameter("description")); filterExecutors = req.getParameter("filterExecutors") != null; filterQueue = req.getParameter("filterQueue") != null; rename(req.getParameter("name")); getProperties().rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors()); save(); FormApply.success("../" + Util.rawEncode(name)).generateResponse(req,rsp,this); }
/** * Return the store relative URL of this domain. * * @return the store relative URL of this domain. */ @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF", justification = "isGlobal() check implies that domain.getName() is null") public String getUrl() { return isGlobal() ? "domain/_/" : "domain/" + Util.rawEncode(name) + "/"; }
/** * Return the URL name. * * @return the URL name. */ @Exported @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "isGlobal() check implies that domain.getName() is null") public String getUrlName() { return isGlobal() ? "_" : Util.rawEncode(domain.getName()); }
public HttpResponse doTest() { String referer = Stapler.getCurrentRequest().getReferer(); Jenkins j = Jenkins.getInstance(); // May need to send an absolute URL, since handling of HttpRedirect with a relative URL does not currently honor X-Forwarded-Proto/Port at all. String redirect = j.getRootUrl() + "administrativeMonitor/" + id + "/testForReverseProxySetup/" + (referer != null ? Util.rawEncode(referer) : "NO-REFERER") + "/"; LOGGER.log(Level.FINE, "coming from {0} and redirecting to {1}", new Object[] {referer, redirect}); return new HttpRedirect(redirect); }