public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
public void save() throws IOException { if(BulkChange.contains(this)) return; XmlFile config = getXmlFile(); config.write(this); SaveableListener.fireOnChange(this, config); }
@RequirePOST public HttpResponse doProxyConfigure(StaplerRequest req) throws IOException, ServletException { Jenkins jenkins = Jenkins.getInstance(); jenkins.checkPermission(CONFIGURE_UPDATECENTER); ProxyConfiguration pc = req.bindJSON(ProxyConfiguration.class, req.getSubmittedForm()); if (pc.name==null) { jenkins.proxy = null; ProxyConfiguration.getXmlFile().delete(); } else { jenkins.proxy = pc; jenkins.proxy.save(); } return new HttpRedirect("advanced"); }
public void save() throws IOException { if(BulkChange.contains(this)) return; getXmlFile().write(this); SaveableListener.fireOnChange(this, getXmlFile()); }
public void save() throws IOException { if(BulkChange.contains(this)) return; getXmlFile().write(this); SaveableListener.fireOnChange(this, getXmlFile()); }
public void save() throws IOException { if(BulkChange.contains(this)) return; getXmlFile().write(this); SaveableListener.fireOnChange(this, getXmlFile()); }
public void load() throws IOException { XmlFile config = getXmlFile(); try { if (config.exists()) { config.unmarshal(this); } } catch (IOException e) { logger.error("Failed to load " + config, e); } }
public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
@Override public void save() throws IOException { if (BulkChange.contains(this)) { return; } getXmlFile().write(this); // Could be called oiutside of Hudson Context (Ex Initial Setup) if (Hudson.getInstance() != null) { SaveableListener.fireOnChange(this, getXmlFile()); } }
public void save() throws IOException { if(BulkChange.contains(this)) return; XmlFile config = getXmlFile(); config.write(this); SaveableListener.fireOnChange(this, config); }
} else { hudson.proxy = null; ProxyConfiguration.getXmlFile().delete();
} else { hudson.proxy = null; ProxyConfiguration.getXmlFile().delete();
} else { hudson.proxy = null; ProxyConfiguration.getXmlFile().delete();
private boolean setProxy(String server, String port, String noProxyFor, String userName, String password, String authNeeded) throws IOException { server = Util.fixEmptyAndTrim(server); if ((server != null) && !"".equals(server)) { // If port is not specified assume it is port 80 (usual default for HTTP port) int portNumber = 80; if (!"".equals(Util.fixNull(port))) { portNumber = Integer.parseInt(Util.fixNull(port)); } boolean proxyAuthNeeded = "on".equals(Util.fixNull(authNeeded)); if (!proxyAuthNeeded) { userName = ""; password = ""; } proxyConfig.configure(server, portNumber, Util.fixEmptyAndTrim(noProxyFor), Util.fixEmptyAndTrim(userName), Util.fixEmptyAndTrim(password), "on".equals(Util.fixNull(authNeeded))); return true; } else { proxyConfig.getXmlFile().delete(); proxyConfig.name = null; return false; } }
public HttpResponse doProxyConfigure( @QueryParameter("proxy.server") String server, @QueryParameter("proxy.port") String port, @QueryParameter("proxy.noProxyFor") String noProxyFor, @QueryParameter("proxy.userName") String userName, @QueryParameter("proxy.password") String password, @QueryParameter("proxy.authNeeded") String authNeeded) throws IOException { Hudson hudson = Hudson.getInstance(); hudson.checkPermission(Hudson.ADMINISTER); server = Util.fixEmptyAndTrim(server); if ((server != null) && !"".equals(server)) { // If port is not specified assume it is port 80 (usual default for HTTP port) int portNumber = 80; if (!"".equals(Util.fixNull(port))) { portNumber = Integer.parseInt(Util.fixNull(port)); } boolean proxyAuthNeeded = "on".equals(Util.fixNull(authNeeded)); if (!proxyAuthNeeded) { userName = ""; password = ""; } hudson.proxy.configure(server, portNumber, Util.fixEmptyAndTrim(noProxyFor), Util.fixEmptyAndTrim(userName), Util.fixEmptyAndTrim(password), "on".equals(Util.fixNull(authNeeded))); hudson.proxy.save(); } else { hudson.proxy.getXmlFile().delete(); hudson.proxy = null; } return new HttpRedirect("advanced"); }
private boolean setProxy(String server, String port, String noProxyFor, String userName, String password, String authNeeded) throws IOException { server = Util.fixEmptyAndTrim(server); if ((server != null) && !"".equals(server)) { // If port is not specified assume it is port 80 (usual default for HTTP port) int portNumber = 80; if (!"".equals(Util.fixNull(port))) { portNumber = Integer.parseInt(Util.fixNull(port)); } boolean proxyAuthNeeded = "on".equals(Util.fixNull(authNeeded)); if (!proxyAuthNeeded) { userName = ""; password = ""; } proxyConfig.configure(server, portNumber, Util.fixEmptyAndTrim(noProxyFor), Util.fixEmptyAndTrim(userName), Util.fixEmptyAndTrim(password), "on".equals(Util.fixNull(authNeeded))); return true; } else { proxyConfig.getXmlFile().delete(); proxyConfig.configure(null, -1, null, null, null, false); return false; } }
@RequirePOST public HttpResponse doProxyConfigure(StaplerRequest req) throws IOException, ServletException { Jenkins jenkins = Jenkins.getInstance(); jenkins.checkPermission(CONFIGURE_UPDATECENTER); ProxyConfiguration pc = req.bindJSON(ProxyConfiguration.class, req.getSubmittedForm()); if (pc.name==null) { jenkins.proxy = null; ProxyConfiguration.getXmlFile().delete(); } else { jenkins.proxy = pc; jenkins.proxy.save(); } return new HttpRedirect("advanced"); }