if ((proxy != null) && (proxy.type() == Proxy.Type.HTTP)) { sun.net.www.URLConnection.setProxiedHost(host); privilegedOpenServer((InetSocketAddress) proxy.address()); usingProxy = true; return; } else { // make direct connection openServer(host, port); usingProxy = false; return; }
private static URL getFileURL(File file) { try { file = file.getCanonicalFile(); } catch (IOException e) {} try { return ParseUtil.fileToEncodedURL(file); } catch (MalformedURLException e) { // Should never happen since we specify the protocol... throw new InternalError(); } }
public static InputStream getInputStream(URL url) throws IOException { if ("file".equals(url.getProtocol())) { String path = url.getFile().replace('/', File.separatorChar); path = ParseUtil.decode(path); return new FileInputStream(path); } else { return url.openStream(); } }
MessageHeader mh = new MessageHeader(); try mh.parseHeader(new ByteArrayInputStream(headers.getBytes())); String value = null; header = mh.getKey(0); if (header != null) return false; value = mh.getValue(0); if (value == null) return false; try while ((header = mh.getKey(i)) != null) value = mh.getValue(i); i++;
MimeEntry entry = MimeTable.getDefaultTable().find(mimetype); if(entry != null && entry.getExtensions().length > 0) { extension = entry.getExtensions()[0];
static String[] parseExtDirs(String codebase, int start) { String s = System.getProperty(EXTDIRS_PROPERTY); String globalPrefix = (start > 0 ? codebase.substring(0, start) : "file:"); int end = start + EXTDIRS_EXPANSION.length(); String globalSuffix = (end < codebase.length() ? codebase.substring(end) : (String) null); String[] dirs = null; String localSuffix; if (s != null) { StringTokenizer st = new StringTokenizer(s, File.pathSeparator); int count = st.countTokens(); dirs = new String[count]; for (int i = 0; i < count; i++) { File file = new File(st.nextToken()); dirs[i] = sun.net.www.ParseUtil.encodePath (file.getAbsolutePath()); if (!dirs[i].startsWith("/")) { dirs[i] = "/" + dirs[i]; } localSuffix = (globalSuffix == null ? (dirs[i].endsWith("/") ? "*" : "/*") : globalSuffix); dirs[i] = globalPrefix + dirs[i] + localSuffix; } } return dirs; }
MessageHeader messageHeader = (MessageHeader) REQUESTS_FIELD.get(reflect); System.err.println("Request headers"); for (Map.Entry<String, List<String>> header : messageHeader.getHeaders(null).entrySet()) { System.err.println(String.format("\t%s - %s", header.getKey(), header.getValue()));
MessageHeader mh = new MessageHeader(); try mh.parseHeader(new ByteArrayInputStream(headers.getBytes())); String value = null; header = mh.getKey(0); if (header != null) return false; value = mh.getValue(0); if (value == null) return false; try while ((header = mh.getKey(i)) != null) value = mh.getValue(i); i++;
public static InputStream getInputStream(URL url) throws IOException { if ("file".equals(url.getProtocol())) { String path = url.getFile().replace('/', File.separatorChar); path = ParseUtil.decode(path); return new FileInputStream(path); } else { return url.openStream(); } }
MimeEntry entry = MimeTable.getDefaultTable().find(mimetype); if(entry != null && entry.getExtensions().length > 0) { extension = entry.getExtensions()[0];
sun.net.www.ParseUtil.fileToEncodedURL(new File(name)).toString(); if (fromFile && !remove) { uncheckedPermissions = null;
static String[] parseExtDirs(String codebase, int start) { String s = System.getProperty(EXTDIRS_PROPERTY); String globalPrefix = (start > 0 ? codebase.substring(0, start) : "file:"); int end = start + EXTDIRS_EXPANSION.length(); String globalSuffix = (end < codebase.length() ? codebase.substring(end) : (String) null); String[] dirs = null; String localSuffix; if (s != null) { StringTokenizer st = new StringTokenizer(s, File.pathSeparator); int count = st.countTokens(); dirs = new String[count]; for (int i = 0; i < count; i++) { File file = new File(st.nextToken()); dirs[i] = sun.net.www.ParseUtil.encodePath (file.getAbsolutePath()); if (!dirs[i].startsWith("/")) { dirs[i] = "/" + dirs[i]; } localSuffix = (globalSuffix == null ? (dirs[i].endsWith("/") ? "*" : "/*") : globalSuffix); dirs[i] = globalPrefix + dirs[i] + localSuffix; } } return dirs; }
/** * Modified from java.net.JarURLConnection * * @param url URL to parse * @throws MalformedURLException */ private void parseSpecs(URL url) throws MalformedURLException { String spec = url.getFile(); if (spec.startsWith("jar:")) { spec = spec.substring(4, spec.length()); } int separator = spec.indexOf("!/"); jarFileURL = new URL(spec.substring(0, separator++)); entryName = null; /* if ! is the last letter of the innerURL, entryName is null */ if (++separator != spec.length()) { entryName = spec.substring(separator, spec.length()); entryName = ParseUtil.decode(entryName); int subEntrySeparator = entryName.indexOf("!/"); if (subEntrySeparator != -1) { subEntryName = entryName.substring(subEntrySeparator + 2, entryName.length()); entryName = entryName.substring(0, subEntrySeparator); } } }
sun.net.www.ParseUtil.fileToEncodedURL(new File(name)).toString(); if (fromFile && !remove) { uncheckedPermissions = null;
/** * Modified from java.net.JarURLConnection * * @param url URL to parse * @throws MalformedURLException */ private void parseSpecs(URL url) throws MalformedURLException { String spec = url.getFile(); if (spec.startsWith("jar:")) { spec = spec.substring(4, spec.length()); } int separator = spec.indexOf("!/"); jarFileURL = new URL(spec.substring(0, separator++)); entryName = null; /* if ! is the last letter of the innerURL, entryName is null */ if (++separator != spec.length()) { entryName = spec.substring(separator, spec.length()); entryName = ParseUtil.decode(entryName); int subEntrySeparator = entryName.indexOf("!/"); if (subEntrySeparator != -1) { subEntryName = entryName.substring(subEntrySeparator + 2, entryName.length()); entryName = entryName.substring(0, subEntrySeparator); } } }
path = policy_url.getFile(). replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); policyFile = new File(path); found = policyFile.exists(); String path = policy_url.getFile(). replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); File policyFile = new File(path); if (policyFile.exists()) {
path = policy_url.getFile(). replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); policyFile = new File(path); found = policyFile.exists(); String path = policy_url.getFile(). replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); File policyFile = new File(path); if (policyFile.exists()) {