Here you can find the source of isHttpUrl(URL url)
public static boolean isHttpUrl(URL url)
//package com.java2s; /******************************************************************************* * Copyright (c) 2007, 2009 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. * // w w w . j ava 2 s . c o m * Contributors: * Oracle - initial API and implementation ******************************************************************************/ import java.net.URL; public class Main { /** * The <code>file</code> string indicating a url http protocol. */ public static final String HTTP_PROTOCOL = "http"; /** * The <code>file</code> string indicating a url http protocol. */ public static final String HTTPS_PROTOCOL = "https"; /** * Returns true if the specified url protocol is http. */ public static boolean isHttpUrl(URL url) { String protocol = url.getProtocol(); return url != null && (HTTP_PROTOCOL.equals(protocol) || HTTPS_PROTOCOL.equals(protocol)); } }