⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configureproxiesform.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
//                    throw new Exception("passwordToShort");
//                }
//                // keypasswords do not match
//                if (!superUserPassword.equals(DUMMY_PASSWORD) && !superUserPassword.equals(confirmSuperUserPassword)) {
//                    throw new Exception("passwordsDoNotMatch");
//                }
//            } catch (Exception e) {
//                // Always report to user when an error is encountered
//                ActionErrors errs = new ActionErrors();
//                errs.add(Globals.ERROR_KEY, new ActionMessage("installation.setSuperUserPassword.error." + e.getMessage()));
//                return errs;
//            }
//        }
        return null;
    }


    /**
     * @return Returns the useHTTPProxy.
     */
    public boolean getUseHTTPProxy() {
        return useHTTPProxy;
    }

    /**
     * @param useHTTPProxy The useHTTPProxy to set.
     */
    public void setUseHTTPProxy(boolean useHTTPProxy) {
        this.useHTTPProxy = useHTTPProxy;
    }

    /**
     * @return Returns the useSOCKSProxy.
     */
    public boolean getUseSOCKSProxy() {
        return useSOCKSProxy;
    }

    /**
     * @param useSOCKSProxy The useSOCKSProxy to set.
     */
    public void setUseSOCKSProxy(boolean useSOCKSProxy) {
        this.useSOCKSProxy = useSOCKSProxy;
    }

    /**
     * @return Returns the httpProxyHostname.
     */
    public String getHttpProxyHostname() {
        return httpProxyHostname;
    }

    /**
     * @param httpProxyHostname The httpProxyHostname to set.
     */
    public void setHttpProxyHostname(String httpProxyHostname) {
        this.httpProxyHostname = httpProxyHostname;
    }

    /**
     * @return
     */
    public String getHttpNonProxyHosts() {
        return httpNonProxyHosts.getAsTextFieldText();
    }

    /**
     * @param httpNonProxyHosts
     */
    public void setHttpNonProxyHosts(String httpNonProxyHosts) {
        this.httpNonProxyHosts.setAsTextFieldText(httpNonProxyHosts);
    }

    /**
     * @return Returns the httpProxyPassword.
     */
    public String getHttpProxyPassword() {
        return httpProxyPassword;
    }

    /**
     * @param httpProxyPassword The httpProxyPassword to set.
     */
    public void setHttpProxyPassword(String httpProxyPassword) {
        this.httpProxyPassword = httpProxyPassword;
    }

    /**
     * @return Returns the httpProxyPort.
     */
    public String getHttpProxyPort() {
        return httpProxyPort;
    }

    /**
     * @param httpProxyPort The httpProxyPort to set.
     */
    public void setHttpProxyPort(String httpProxyPort) {
        this.httpProxyPort = httpProxyPort;
    }

    /**
     * @return Returns the httpProxyUsername.
     */
    public String getHttpProxyUsername() {
        return httpProxyUsername;
    }

    /**
     * @param httpProxyUsername The httpProxyUsername to set.
     */
    public void setHttpProxyUsername(String httpProxyUsername) {
        this.httpProxyUsername = httpProxyUsername;
    }

    /**
     * @return Returns the socksProxyHostname.
     */
    public String getSocksProxyHostname() {
        return socksProxyHostname;
    }

    /**
     * @param socksProxyHostname The socksProxyHostname to set.
     */
    public void setSocksProxyHostname(String socksProxyHostname) {
        this.socksProxyHostname = socksProxyHostname;
    }

    /**
     * @return Returns the socksProxyPassword.
     */
    public String getSocksProxyPassword() {
        return socksProxyPassword;
    }

    /**
     * @param socksProxyPassword The socksProxyPassword to set.
     */
    public void setSocksProxyPassword(String socksProxyPassword) {
        this.socksProxyPassword = socksProxyPassword;
    }

    /**
     * @return Returns the socksProxyPort.
     */
    public String getSocksProxyPort() {
        return socksProxyPort;
    }

    /**
     * @param socksProxyPort The socksProxyPort to set.
     */
    public void setSocksProxyPort(String socksProxyPort) {
        this.socksProxyPort = socksProxyPort;
    }

    /**
     * @return Returns the socksProxyUsername.
     */
    public String getSocksProxyUsername() {
        return socksProxyUsername;
    }

    /**
     * @param socksProxyUsername The socksProxyUsername to set.
     */
    public void setSocksProxyUsername(String socksProxyUsername) {
        this.socksProxyUsername = socksProxyUsername;
    }
    
    class ProxyAuthenticator extends Authenticator {
        
        String socksUsername, socksPassword, httpUsername, httpPassword;
        
        ProxyAuthenticator(String socksUsername, String socksPassword,
            String httpUsername, String httpPassword) {
            this.socksUsername = socksUsername;
            this.socksPassword = socksPassword;
            this.httpUsername = httpUsername;
            this.httpPassword = httpPassword;
        }

        public PasswordAuthentication getPasswordAuthentication() {
        	if (log.isInfoEnabled())
        		log.info("Requesting " + getRequestingProtocol() + " proxy authentication for " + getRequestingSite() + " ("
                            + getRequestingHost() + ":" + getRequestingPort() + "), prompt = " + getRequestingPrompt());
            String user = null;
            String pass = null;
            try {
                if (getRequestingProtocol().startsWith("SOCKS")) {
                    user = socksUsername;
                    pass = socksPassword;
                } else {
                    user = httpUsername;
                    pass = httpPassword;
                }
            } catch (Exception e) {
                log.error("Failed to get proxy authentication details.");
                return null;
            }
            return new PasswordAuthentication(user, pass.toCharArray());
        }

    }

    public void reset(ActionMapping mapping, HttpServletRequest request) {
        super.reset(mapping, request);
        useSOCKSProxy = false;
        useHTTPProxy = false;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -