/** * Given a class or resource name, returns a patch to that resource. * * @param name the class or resource name. * @return the path representing the class or resource. */ @Override public Path getPath(String name) { if (_prefix != null && _pathPrefix == null) _pathPrefix = _prefix.replace('.', '/'); if (_pathPrefix != null && !name.startsWith(_pathPrefix)) return null; if (name.startsWith("/")) return _path.lookup("." + name); else return _path.lookup(name); }
public URLConnection getResource(URL url) throws IOException { if (!"jndi".equals(url.getProtocol())) return null; // handle jndi:/server (single slash) parsing (gf) String file = url.getFile(); if ("".equals(url.getHost()) && file.startsWith("/server")) { file = file.substring(7, file.length()); if (file.startsWith(getContextPath())) file = file.substring(getContextPath().length()); else { // server/102p int p = file.indexOf('/', 1); if (p > 0) { String contextPath = file.substring(0, p); WebApp webApp = (WebApp) getContext(contextPath); if (webApp != null) return webApp.getResource(url); } } } String realPath = getRealPath(file); Path rootDirectory = getRootDirectory(); Path path = rootDirectory.lookup(realPath); if (path.exists()) return new URL(path.getURL()).openConnection(); int fileIdx; URLConnection connection = null; if (file.length() > 1 && (fileIdx = file.indexOf("/", 1)) > -1) { String context = file.substring(0, file.indexOf("/", 1)); if (context.equals(getContextPath())) { // disable cross-context lookup file = file.substring(fileIdx, file.length()); realPath = getRealPath(file); path = rootDirectory.lookup(realPath); if (path.exists()) connection = new URL(path.getURL()).openConnection(); } } if (connection != null) return connection; return new FileNotFoundURLConnection(url); }
private Path writeTempFile(Node node) throws IOException { Path workDir = CauchoSystem.getWorkPath().lookup("_xsl"); workDir.mkdirs(); // Path temp = workDir.createTempFile("tmp", "xsl"); WriteStream os = Vfs.lookup("null:").openWrite(); Crc64Stream crcStream = new Crc64Stream(os.getSource()); os.init(crcStream); try { XmlPrinter printer = new XmlPrinter(os); printer.printNode(node); } finally { os.close(); } long crc = crcStream.getCRC(); CharBuffer cb = new CharBuffer(); Base64.encode(cb, crc); String crcValue = cb.toString().replace('/', '-'); Path xslPath = workDir.lookup(crcValue + ".xsl"); // temp.renameTo(xslPath); return xslPath; }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("initpass.jsp"), 7048575714632404679L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); depend = new com.caucho.vfs.Depend(appDir.lookup("login_check.jsp"), 5313538553479869376L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("tweetSearch.jsp"), -3076669215319968785L, false); _caucho_depends.add(depend); depend = new com.caucho.vfs.Depend(appDir.lookup("header.jsp"), 7773134504633206276L, false); _caucho_depends.add(depend); }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("EthnicGroup.jsp"), 6847378287986436659L, false); _caucho_depends.add(depend); depend = new com.caucho.vfs.Depend(appDir.lookup("Footer.jsp"), -3074380813858324039L, false); _caucho_depends.add(depend); }
public void init(com.caucho.java.LineMap lineMap, com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); _caucho_line_map = new com.caucho.java.LineMap("_main__jsp.java", "foo"); _caucho_line_map.add("/myadmin/main.jsp", 14, 30); _caucho_line_map.add(14, 32); _caucho_line_map.add(22, 34); _caucho_line_map.add(62, 75); _caucho_line_map.add(63, 77); _caucho_line_map.add(67, 79); _caucho_line_map.add(68, 81); _caucho_line_map.add(69, 83); _caucho_line_map.add(70, 85); _caucho_line_map.add(74, 87); _caucho_line_map.add(83, 96); _caucho_line_map.add(92, 98); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend( appDir.lookup("myadmin/main.jsp"), "AOlUHB8X9qDorKgZ7MCqag==", false); _caucho_depends.add(depend); }
/** Removes logs passing the rollover count. */ private void removeOldLogs() { try { Path path = getPath(); Path parent = path.getParent(); String[] list = parent.list(); ArrayList<String> matchList = new ArrayList<String>(); Pattern archiveRegexp = getArchiveRegexp(); for (int i = 0; i < list.length; i++) { Matcher matcher = archiveRegexp.matcher(list[i]); if (matcher.matches()) matchList.add(list[i]); } Collections.sort(matchList); if (_rolloverCount <= 0 || matchList.size() < _rolloverCount) return; for (int i = 0; i + _rolloverCount < matchList.size(); i++) { try { parent.lookup(matchList.get(i)).remove(); } catch (Throwable e) { } } } catch (Throwable e) { } }
public void init() throws ConfigException { if (_id == null) throw new ConfigException(L.l("`{0}' is required", "id")); if (_location == null) throw new ConfigException(L.l("`{0}' is required", "location")); if (_name == null) _name = _location.toString(); if (_indexString == null) _indexString = "index-all.html"; _locationPath = Vfs.lookup(_location); int split = _indexString.indexOf('#'); if (split > -1) { CharBuffer before = new CharBuffer(_indexString.substring(0, split)); CharBuffer after = new CharBuffer(_indexString.substring(split + 1)); CharBuffer index = CharBuffer.allocate(); boolean isIndex = false; for (int i = 1; i <= 27; i++) { index.append(before); index.append(i); index.append(after); Path indexPath = _locationPath.lookup(index.toString()); if (indexPath.exists()) { isIndex = true; _index.add(indexPath); } index.clear(); } if (!isIndex) { throw new ConfigException(L.l("`{0}' not found", _locationPath.lookup(_indexString))); } } else _index.add(_locationPath.lookup(_indexString)); if (_locationPath.getScheme().equals("file")) { _isLocal = true; Path pwd = Vfs.getPwd(); if (!_locationPath.getPath().startsWith(pwd.getPath())) _isLocalAbsolute = true; } }
/** Initialize local configuration, e.g. finding the PHP and PEAR libraries */ protected void initLocal() { StringBuilder sb = new StringBuilder("."); Path pwd = getPwd(); String[] paths = new String[] { "/usr/share/php", "/usr/lib/php", "/usr/local/lib/php", "/usr/share/pear", "/usr/lib/pear", "/usr/local/lib/pear" }; for (String path : paths) { if (pwd.lookup(path).isDirectory()) { sb.append(":").append(pwd.lookup(path).getPath()); } } setIni("include_path", sb.toString()); }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("bms/info.jsp"), -3507448949258287785L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); depend = new com.caucho.vfs.Depend( appDir.lookup("WEB-INF/tld/MyTld.tld"), 2313055599944075409L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); com.caucho.jsp.JavaPage.addDepend( _caucho_depends, new com.caucho.make.ClassDependency(dms.tag.CategorySelectTag.class, 4895540770968086576L)); com.caucho.jsp.JavaPage.addDepend( _caucho_depends, new com.caucho.make.ClassDependency(dms.tag.CitySelectTag.class, -8095317528224568575L)); com.caucho.jsp.JavaPage.addDepend( _caucho_depends, new com.caucho.make.ClassDependency(dms.tag.DomainSelectTag.class, -6906637344929707994L)); com.caucho.jsp.JavaPage.addDepend( _caucho_depends, new com.caucho.make.ClassDependency(dms.tag.ServiceSelectTag.class, 1551605886958229292L)); com.caucho.jsp.JavaPage.addDepend( _caucho_depends, new com.caucho.make.ClassDependency(dms.tag.GroupSelectTag.class, 8341835262871728445L)); depend = new com.caucho.vfs.Depend(appDir.lookup("WEB-INF/tld/fmt.tld"), 308338869353100094L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); com.caucho.jsp.JavaPage.addDepend( _caucho_depends, new com.caucho.make.ClassDependency( org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag.class, 7844905413159918656L)); }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("Coach/AddCoach.jsp"), 9120939392708460488L, false); _caucho_depends.add(depend); }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend( appDir.lookup("WEB-INF/jsp/error.jsp"), -6469239493088807450L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend( appDir.lookup("Survey_RatingList.jsp"), 4990420660777494174L, false); _caucho_depends.add(depend); }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("allnews.jsp"), 4100619310644654661L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); depend = new com.caucho.vfs.Depend(appDir.lookup("parts/header.jsp"), 7818843393653806549L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); depend = new com.caucho.vfs.Depend( appDir.lookup("parts/messageBox.jsp"), 4695996236894547340L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); depend = new com.caucho.vfs.Depend( appDir.lookup("parts/messagesDisplay.jsp"), 3651959889291330025L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); }
public void init(com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); com.caucho.loader.DynamicClassLoader loader; loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader(); String resourcePath = loader.getResourcePathSpecificFirst(); mergePath.addClassPath(resourcePath); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("order/download.jsp"), -8925709412953061948L, false); com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); }
public void init(com.caucho.java.LineMap lineMap, com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); mergePath.addClassPath(getClass().getClassLoader()); _caucho_line_map = new com.caucho.java.LineMap("_logo_0admin__jsp.java", "/myconf/inc/logo_admin.jsp"); _caucho_line_map.add(1, 1); _caucho_line_map.add(1, 29); _caucho_line_map.add(6, 32); _caucho_line_map.add(12, 44); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("inc/logo_admin.jsp"), 1176214214000L, 656L); _caucho_depends.add(depend); }
public static Path lookupPath(String string, ELContext env, Path pwd) throws ELException { if (env == null) env = Config.getEnvironment(); string = rewritePathString(string); Expr expr = new ELParser(env, string).parse(); Object obj = expr.evalObject(env); if (obj == null) throw new NullPointerException(L.l("Path '{0}' evaluated to null.", string)); if (obj instanceof Path) return (Path) obj; String value = Expr.toString(obj, env); if (pwd != null) return pwd.lookup(value); else return Vfs.lookup(value); }
static ArrayList<Depend> parseDepend(Path dependPath) throws IOException { ReadStream is = dependPath.openRead(); try { ArrayList<Depend> dependList = new ArrayList<Depend>(); String name; while ((name = parseName(is)) != null) { long digest = Long.parseLong(parseName(is)); Depend depend = new Depend(dependPath.lookup(name), digest); dependList.add(depend); } return dependList; } finally { is.close(); } }
/** * Loads a stylesheet from a named file * * @param systemId the URL of the file */ public StylesheetImpl newStylesheet(String systemId) throws Exception { StylesheetImpl stylesheet = loadPrecompiledStylesheet(systemId, systemId); if (stylesheet != null) return stylesheet; synchronized (AbstractStylesheetFactory.class) { stylesheet = loadPrecompiledStylesheet(systemId, systemId); if (stylesheet != null) return stylesheet; ReadStream is; if (_stylePath != null) is = _stylePath.lookup(systemId).openRead(); else is = Vfs.lookup(systemId).openRead(); try { return newStylesheet(is); } finally { if (is != null) is.close(); } } }
/** Gets a table. */ public Table getTable(String name) { synchronized (_tables) { Table table = _tables.get(name); if (table != null) return table; Path dir = _dir; if (dir == null) return null; try { table = Table.loadFromFile(this, name); if (table == null) return null; table.init(); _tables.put(name, table); return table; } catch (Exception e) { if (log.isLoggable(Level.FINER)) log.log(Level.FINER, e.toString(), e); if (_removeOnError) { if (log.isLoggable(Level.FINER)) log.log(Level.FINER, e.toString(), e); else log.warning(e.toString()); try { dir.lookup(name + ".db").remove(); } catch (IOException e1) { log.log(Level.FINEST, e.toString(), e); } } } } return null; }
/** Returns an enumeration of all the resources. */ public Set<String> getResourcePaths(String prefix) { if (!prefix.endsWith("/")) prefix = prefix + "/"; Path path = getRootDirectory().lookup(getRealPath(prefix)); HashSet<String> set = new HashSet<String>(); try { String[] list = path.list(); for (int i = 0; i < list.length; i++) { if (path.lookup(list[i]).isDirectory()) set.add(prefix + list[i] + '/'); else set.add(prefix + list[i]); } } catch (IOException e) { } /* try { Enumeration<URL> paths = getClassLoader().getResources(resourceName); while (paths.hasMoreElements()) { URL subPath = paths.nextElement(); String subPathName = subPath.toString(); int p = subPathName.indexOf("META-INF/resources"); if (p >= 0) set.add(subPathName.substring(p + "META-INF/resources".length())); } } catch (IOException e) { log.log(Level.FINER, e.toString(), e); } */ return set; }
private void setEnvironment(ClientSocket stream, WriteStream ws, HttpServletRequest req) throws IOException { addHeader(stream, ws, "REQUEST_URI", req.getRequestURI()); addHeader(stream, ws, "REQUEST_METHOD", req.getMethod()); addHeader(stream, ws, "SERVER_SOFTWARE", "Resin/" + VersionFactory.getVersion()); addHeader(stream, ws, "SERVER_NAME", req.getServerName()); // addHeader(stream, ws, "SERVER_ADDR=" + req.getServerAddr()); addHeader(stream, ws, "SERVER_PORT", String.valueOf(req.getServerPort())); addHeader(stream, ws, "REMOTE_ADDR", req.getRemoteAddr()); addHeader(stream, ws, "REMOTE_HOST", req.getRemoteAddr()); // addHeader(stream, ws, "REMOTE_PORT=" + req.getRemotePort()); if (req.getRemoteUser() != null) addHeader(stream, ws, "REMOTE_USER", req.getRemoteUser()); else addHeader(stream, ws, "REMOTE_USER", ""); if (req.getAuthType() != null) addHeader(stream, ws, "AUTH_TYPE", req.getAuthType()); addHeader(stream, ws, "GATEWAY_INTERFACE", "CGI/1.1"); addHeader(stream, ws, "SERVER_PROTOCOL", req.getProtocol()); if (req.getQueryString() != null) addHeader(stream, ws, "QUERY_STRING", req.getQueryString()); else addHeader(stream, ws, "QUERY_STRING", ""); String scriptPath = req.getServletPath(); String pathInfo = req.getPathInfo(); WebApp webApp = (WebApp) req.getServletContext(); Path appDir = webApp.getAppDir(); String realPath = webApp.getRealPath(scriptPath); if (!appDir.lookup(realPath).isFile() && pathInfo != null) scriptPath = scriptPath + pathInfo; /* * FastCGI (specifically quercus) uses the PATH_INFO and PATH_TRANSLATED * for the script path. */ log.finer("STREAM file: " + webApp.getRealPath(scriptPath)); addHeader(stream, ws, "PATH_INFO", req.getContextPath() + scriptPath); addHeader(stream, ws, "PATH_TRANSLATED", webApp.getRealPath(scriptPath)); /* These are the values which would be sent to CGI. addHeader(stream, ws, "SCRIPT_NAME", req.getContextPath() + scriptPath); addHeader(stream, ws, "SCRIPT_FILENAME", app.getRealPath(scriptPath)); if (pathInfo != null) { addHeader(stream, ws, "PATH_INFO", pathInfo); addHeader(stream, ws, "PATH_TRANSLATED", req.getRealPath(pathInfo)); } else { addHeader(stream, ws, "PATH_INFO", ""); addHeader(stream, ws, "PATH_TRANSLATED", ""); } */ int contentLength = req.getContentLength(); if (contentLength < 0) addHeader(stream, ws, "CONTENT_LENGTH", "0"); else addHeader(stream, ws, "CONTENT_LENGTH", String.valueOf(contentLength)); ServletContext rootContext = webApp.getContext("/"); if (rootContext != null) addHeader(stream, ws, "DOCUMENT_ROOT", rootContext.getRealPath("/")); CharBuffer cb = new CharBuffer(); Enumeration e = req.getHeaderNames(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); String value = req.getHeader(key); if (key.equalsIgnoreCase("content-length")) addHeader(stream, ws, "CONTENT_LENGTH", value); else if (key.equalsIgnoreCase("content-type")) addHeader(stream, ws, "CONTENT_TYPE", value); else if (key.equalsIgnoreCase("if-modified-since")) { } else if (key.equalsIgnoreCase("if-none-match")) { } else if (key.equalsIgnoreCase("authorization")) { } else if (key.equalsIgnoreCase("proxy-authorization")) { } else addHeader(stream, ws, convertHeader(cb, key), value); } }
public void init(com.caucho.java.LineMap lineMap, com.caucho.vfs.Path appDir) throws javax.servlet.ServletException { com.caucho.vfs.Path resinHome = com.caucho.util.CauchoSystem.getResinHome(); com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath(); mergePath.addMergePath(appDir); mergePath.addMergePath(resinHome); mergePath.addClassPath(getClass().getClassLoader()); _caucho_line_map = new com.caucho.java.LineMap("_view2__jsp.java", "/conf1/bbs/view2.jsp"); _caucho_line_map.add(19, 1); _caucho_line_map.add(1, 36); _caucho_line_map.add(6, 42); _caucho_line_map.add(7, 52); _caucho_line_map.add(8, 56); _caucho_line_map.add(13, 62); _caucho_line_map.add(27, 77); _caucho_line_map.add(40, 89); _caucho_line_map.add(45, 95); _caucho_line_map.add(48, 97); _caucho_line_map.add(53, 103); _caucho_line_map.add(54, 105); _caucho_line_map.add(63, 111); _caucho_line_map.add(68, 120); _caucho_line_map.add(78, 123); _caucho_line_map.add(91, 126); _caucho_line_map.add(92, 128); _caucho_line_map.add(92, 140); _caucho_line_map.add(92, 142); _caucho_line_map.add(92, 144); _caucho_line_map.add(92, 146); _caucho_line_map.add(93, 155); _caucho_line_map.add(94, 157); _caucho_line_map.add(94, 169); _caucho_line_map.add(94, 171); _caucho_line_map.add(94, 173); _caucho_line_map.add(94, 175); _caucho_line_map.add(95, 184); _caucho_line_map.add(99, 186); _caucho_line_map.add(101, 198); _caucho_line_map.add(102, 200); _caucho_line_map.add(103, 202); _caucho_line_map.add(104, 204); _caucho_line_map.add(118, 212); _caucho_line_map.add(118, 214); _caucho_line_map.add(118, 216); _caucho_line_map.add(119, 218); _caucho_line_map.add(120, 220); _caucho_line_map.add(120, 221); _caucho_line_map.add(120, 229); _caucho_line_map.add(120, 230); _caucho_line_map.add(120, 239); _caucho_line_map.add(127, 241); _caucho_line_map.add(135, 243); _caucho_line_map.add(135, 244); _caucho_line_map.add(135, 252); _caucho_line_map.add(135, 253); _caucho_line_map.add(135, 261); _caucho_line_map.add(135, 263); _caucho_line_map.add(136, 265); _caucho_line_map.add(136, 273); _caucho_line_map.add(145, 275); _caucho_line_map.add(145, 278); _caucho_line_map.add(153, 283); _caucho_line_map.add(154, 295); _caucho_line_map.add(157, 299); _caucho_line_map.add(165, 301); _caucho_line_map.add(166, 307); _caucho_line_map.add(181, 316); _caucho_line_map.add(182, 319); _caucho_line_map.add(189, 321); _caucho_line_map.add(207, 324); _caucho_line_map.add(208, 327); _caucho_line_map.add(208, 332); _caucho_line_map.add(208, 334); _caucho_line_map.add(220, 337); _caucho_line_map.add(225, 343); _caucho_line_map.add(230, 349); com.caucho.vfs.Depend depend; depend = new com.caucho.vfs.Depend(appDir.lookup("bbs/view2.jsp"), 1179334046000L, 9825L); _caucho_depends.add(depend); }
public Process launchManager(String[] argv) throws IOException { System.out.println( L.l( "Resin/{0} launching watchdog at {1}:{2}", VersionFactory.getVersion(), getWatchdogAddress(), getWatchdogPort())); log.fine(this + " starting ResinWatchdogManager"); Path resinHome = getResinHome(); Path resinRoot = getRootDirectory(); ProcessBuilder builder = new ProcessBuilder(); builder.directory(new File(resinRoot.getNativePath())); Map<String, String> env = builder.environment(); env.putAll(System.getenv()); String classPath = WatchdogArgs.calculateClassPath(resinHome); env.put("CLASSPATH", classPath); String libexecPath; if (is64bit()) { libexecPath = resinHome.lookup("libexec64").getNativePath(); appendEnvPath(env, "LD_LIBRARY_PATH", libexecPath); appendEnvPath(env, "LD_LIBRARY_PATH_64", libexecPath); appendEnvPath(env, "DYLD_LIBRARY_PATH", libexecPath); if (CauchoSystem.isWindows()) appendEnvPath(env, "Path", resinHome.lookup("win64").getNativePath()); } else { libexecPath = resinHome.lookup("libexec").getNativePath(); appendEnvPath(env, "LD_LIBRARY_PATH", libexecPath); appendEnvPath(env, "DYLD_LIBRARY_PATH", libexecPath); if (CauchoSystem.isWindows()) appendEnvPath(env, "Path", resinHome.lookup("win32").getNativePath()); } ArrayList<String> list = new ArrayList<String>(); list.add(_config.getJavaExe()); // #3759 - user args are first so they're displayed by ps list.addAll(_config.getWatchdogJvmArgs()); list.add("-Dresin.watchdog=" + _id); list.add("-Djava.util.logging.manager=com.caucho.log.LogManagerImpl"); list.add("-Djavax.management.builder.initial=com.caucho.jmx.MBeanServerBuilderImpl"); list.add("-Djava.awt.headless=true"); list.add("-Dresin.home=" + resinHome.getFullPath()); list.add("-Dresin.root=" + resinRoot.getFullPath()); for (int i = 0; i < argv.length; i++) { if (argv[i].startsWith("-Djava.class.path=")) { // IBM JDK startup issues } else if (argv[i].startsWith("-J")) { list.add(argv[i].substring(2)); } } // #2566 list.add("-Xrs"); if (!_config.hasWatchdogXss()) list.add("-Xss256k"); if (!_config.hasWatchdogXmx()) list.add("-Xmx32m"); // XXX: can this just be copied from original args? if (!list.contains("-d32") && !list.contains("-d64") && is64bit() && !CauchoSystem.isWindows()) { list.add("-d64"); } if (!list.contains("-server") && !list.contains("-client") && !CauchoSystem.isWindows()) { // #3331, windows can't add -server automatically list.add("-server"); } list.add("com.caucho.boot.WatchdogManager"); for (int i = 0; i < argv.length; i++) { if (argv[i].equals("-conf") || argv[i].equals("--conf")) { list.add(argv[i]); list.add(resinHome.lookup(argv[i + 1]).getNativePath()); i++; } else list.add(argv[i]); } list.add("--log-directory"); list.add(getLogDirectory().getFullPath()); builder = builder.command(list); // builder.redirectErrorStream(true); Process process = null; try { process = builder.start(); } catch (Exception e) { e.printStackTrace(); } InputStream stdIs = process.getInputStream(); InputStream stdErr = process.getErrorStream(); OutputStream stdOs = process.getOutputStream(); ProcessThreadReader reader = new ProcessThreadReader(stdIs); reader.setDaemon(true); reader.start(); ProcessThreadReader errorReader = new ProcessThreadReader(stdErr); errorReader.setDaemon(true); errorReader.start(); try { Thread.sleep(1000); } catch (Exception e) { } // stdIs.close(); stdOs.close(); return process; }