protected PageDefinition parse(String path, URL url, Object extra) throws Exception { final Locator locator = extra != null ? (Locator) extra : getLocator(_wapp, path); return new Parser(_wapp, locator).parse(url, path); } }
/** Returns the page definition of the specified raw content in DOM; * never null. * * @param locator the locator used to locate taglib and other resources. * If null, wapp is assumed ({@link WebApp} is also assumed). * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @exception UiException if failed to parse */ public static final PageDefinition getPageDefinitionDirectly(WebApp wapp, Locator locator, Document doc, String extension) { try { return new Parser(wapp, locator).parse(doc, extension); } catch (Exception ex) { throw UiException.Aide.wrap(ex); } }
/** Returns the page definition of the raw content from the specified * reader; never null. * * @param locator the locator used to locate taglib and other resources. * If null, wapp is assumed ({@link WebApp} is also assumed). * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @exception UiException if failed to parse */ public static final PageDefinition getPageDefinitionDirectly(WebApp wapp, Locator locator, Reader reader, String extension) throws IOException { try { return new Parser(wapp, locator).parse(reader, extension); } catch (IOException ex) { throw ex; } catch (Exception ex) { throw UiException.Aide.wrap(ex); } }
protected PageDefinition parse(String path, File file, Object extra) throws Exception { final Locator locator = extra != null ? (Locator) extra : getLocator(_wapp, path); Parser parser = new Parser(_wapp, locator); // Bug ZK-1132 if (file.exists()) { return parser.parse(file, path); } else { InputStream stream = parser.getLocator().getResourceAsStream(path); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(stream)); PageDefinition pgdef = parser.parse(reader, Servlets.getExtension(path)); pgdef.setRequestPath(path); return pgdef; } finally { if (reader != null) reader.close(); } } }