/** * Deletes this item. * Note on the funny name: for reasons of historical compatibility, this URL is {@code /doDelete} * since it predates {@code <l:confirmationLink>}. {@code /delete} goes to a Jelly page * which should now be unused by core but is left in case plugins are still using it. */ @RequirePOST public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException { delete(); if (req == null || rsp == null) { // CLI return; } List<Ancestor> ancestors = req.getAncestors(); ListIterator<Ancestor> it = ancestors.listIterator(ancestors.size()); String url = getParent().getUrl(); // fallback but we ought to get to Jenkins.instance at the root while (it.hasPrevious()) { Object a = it.previous().getObject(); if (a instanceof View) { url = ((View) a).getUrl(); break; } else if (a instanceof ViewGroup && a != this) { url = ((ViewGroup) a).getUrl(); break; } } rsp.sendRedirect2(req.getContextPath() + '/' + url); }
String base = getParent().getUrl(); LOGGER.log(Level.FINER, "falling back to {0}{1} for {2} from {3}", new Object[] {base, shortUrl, this, uri}); return base + shortUrl;
@Override public HttpResponse handle(Item item, ItemGroup<?> destination, AtomicReference<Item> newItem, List<? extends RelocationHandler> chain) throws IOException, InterruptedException { if (!(destination instanceof DirectlyModifiableTopLevelItemGroup)) { return chain.isEmpty() ? null : chain.get(0).handle(item, destination, newItem, chain.subList(1, chain.size())); } Item result = doMove(item, (DirectlyModifiableTopLevelItemGroup) destination); newItem.set(result); // AbstractItem.getUrl does weird magic here which winds up making it redirect to the old location, so inline the correct part of this method. return HttpResponses.redirectViaContextPath(result.getParent().getUrl() + result.getShortUrl()); }
@Override public HttpResponse handle(Item item, ItemGroup<?> destination, AtomicReference<Item> newItem, List<? extends RelocationHandler> chain) throws IOException, InterruptedException { if (!(destination instanceof DirectlyModifiableTopLevelItemGroup)) { return chain.isEmpty() ? null : chain.get(0).handle(item, destination, newItem, chain.subList(1, chain.size())); } Item result = doMove(item, (DirectlyModifiableTopLevelItemGroup) destination); newItem.set(result); // AbstractItem.getUrl does weird magic here which winds up making it redirect to the old location, so inline the correct part of this method. return HttpResponses.redirectViaContextPath(result.getParent().getUrl() + result.getShortUrl()); }
public final String getUrl() { // try to stick to the current view if possible StaplerRequest req = Stapler.getCurrentRequest(); if (req != null) { String seed = Functions.getNearestAncestorUrl(req,this); if(seed!=null) { // trim off the context path portion and leading '/', but add trailing '/' return seed.substring(req.getContextPath().length()+1)+'/'; } } // otherwise compute the path normally return getParent().getUrl()+getShortUrl(); }
public final String getUrl() { // try to stick to the current view if possible StaplerRequest req = Stapler.getCurrentRequest(); if (req != null) { String seed = Functions.getNearestAncestorUrl(req,this); if(seed!=null) { // trim off the context path portion and leading '/', but add trailing '/' return seed.substring(req.getContextPath().length()+1)+'/'; } } // otherwise compute the path normally return getParent().getUrl()+getShortUrl(); }
public final String getUrl() { // try to stick to the current view if possible StaplerRequest req = Stapler.getCurrentRequest(); if (req != null) { String seed = Functions.getNearestAncestorUrl(req,this); if(seed!=null) { // trim off the context path portion and leading '/', but add trailing '/' return seed.substring(req.getContextPath().length()+1)+'/'; } } // otherwise compute the path normally return getParent().getUrl()+getShortUrl(); }
public final String getUrl() { // try to stick to the current view if possible StaplerRequest req = Stapler.getCurrentRequest(); if (req != null) { String seed = Functions.getNearestAncestorUrl(req, this); if (seed != null) { // trim off the context path portion and leading '/', but add trailing '/' return seed.substring(Functions.getRequestRootPath(req).length() + 1) + '/'; } } // otherwise compute the path normally return getParent().getUrl() + getShortUrl(); }
String base = getParent().getUrl(); LOGGER.log(Level.FINER, "falling back to {0}{1} for {2} from {3}", new Object[] {base, shortUrl, this, uri}); return base + shortUrl;
/** * Deletes this item. * Note on the funny name: for reasons of historical compatibility, this URL is {@code /doDelete} * since it predates {@code <l:confirmationLink>}. {@code /delete} goes to a Jelly page * which should now be unused by core but is left in case plugins are still using it. */ @RequirePOST public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException { delete(); if (req == null || rsp == null) { // CLI return; } List<Ancestor> ancestors = req.getAncestors(); ListIterator<Ancestor> it = ancestors.listIterator(ancestors.size()); String url = getParent().getUrl(); // fallback but we ought to get to Jenkins.instance at the root while (it.hasPrevious()) { Object a = it.previous().getObject(); if (a instanceof View) { url = ((View) a).getUrl(); break; } else if (a instanceof ViewGroup && a != this) { url = ((ViewGroup) a).getUrl(); break; } } rsp.sendRedirect2(req.getContextPath() + '/' + url); }
/** * Deletes this item. */ @CLIMethod(name = "delete-job") public void doDoDelete(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException { requirePOST(); delete(); if (rsp != null) // null for CLI { rsp.sendRedirect2(req.getContextPath() + "/" + getParent().getUrl()); } }
/** * Deletes this item. */ @CLIMethod(name="delete-job") public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException { requirePOST(); delete(); if (rsp != null) // null for CLI rsp.sendRedirect2(req.getContextPath()+"/"+getParent().getUrl()); }
/** * Deletes this item. */ @CLIMethod(name="delete-job") public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException { requirePOST(); delete(); if (rsp != null) // null for CLI rsp.sendRedirect2(req.getContextPath()+"/"+getParent().getUrl()); }
/** * Deletes this item. */ @CLIMethod(name="delete-job") public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException { requirePOST(); delete(); if (rsp != null) // null for CLI rsp.sendRedirect2(req.getContextPath()+"/"+getParent().getUrl()); }
/** * Renames this job. */ public/* not synchronized. see renameTo() */ void doDoRename( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { requirePOST(); // rename is essentially delete followed by a create checkPermission(CREATE); checkPermission(DELETE); String newName = req.getParameter("newName"); Hudson.checkGoodName(newName); if (isBuilding()) { // redirect to page explaining that we can't rename now rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8")); return; } renameTo(newName); // send to the new job page // note we can't use getUrl() because that would pick up old name in the // Ancestor.getUrl() rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl() + getShortUrl()); }
/** * Renames this job. */ public/* not synchronized. see renameTo() */void doDoRename( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { requirePOST(); // rename is essentially delete followed by a create checkPermission(CREATE); checkPermission(DELETE); String newName = req.getParameter("newName"); Hudson.checkGoodName(newName); if (isBuilding()) { // redirect to page explaining that we can't rename now rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8")); return; } renameTo(newName); // send to the new job page // note we can't use getUrl() because that would pick up old name in the // Ancestor.getUrl() rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl() + getShortUrl()); }
/** * Renames this job. */ public/* not synchronized. see renameTo() */void doDoRename( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { requirePOST(); // rename is essentially delete followed by a create checkPermission(CREATE); checkPermission(DELETE); String newName = req.getParameter("newName"); Hudson.checkGoodName(newName); if (isBuilding()) { // redirect to page explaining that we can't rename now rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8")); return; } renameTo(newName); // send to the new job page // note we can't use getUrl() because that would pick up old name in the // Ancestor.getUrl() rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl() + getShortUrl()); }
rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl() + getShortUrl());