/** * Gets the template created by the underlying engine parsing the request. * * <p> * This method looks up a simple (weak) hash map for an existing template * object that matches the source URL. If there is no cache entry, a new one is * created by the underlying template engine. This new instance is put * to the cache for consecutive calls. * * @return The template that will produce the response text. * @param url The URL containing the template source.. * @throws ServletException If the request specified an invalid template source URL */ protected Template getTemplate(URL url) throws ServletException { String key = url.toString(); Template template = findCachedTemplate(key, null); // Template not cached or the source file changed - compile new template! if (template == null) { try { template = createAndStoreTemplate(key, url.openConnection().getInputStream(), null); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e); } } return template; }
template = createAndStoreTemplate(key, new FileInputStream(file), file); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e);
/** * Gets the template created by the underlying engine parsing the request. * * <p> * This method looks up a simple (weak) hash map for an existing template * object that matches the source URL. If there is no cache entry, a new one is * created by the underlying template engine. This new instance is put * to the cache for consecutive calls. * * @return The template that will produce the response text. * @param url The URL containing the template source.. * @throws ServletException If the request specified an invalid template source URL */ protected Template getTemplate(URL url) throws ServletException { String key = url.toString(); Template template = findCachedTemplate(key, null); // Template not cached or the source file changed - compile new template! if (template == null) { try { template = createAndStoreTemplate(key, url.openConnection().getInputStream(), null); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e); } } return template; }
/** * Gets the template created by the underlying engine parsing the request. * * <p> * This method looks up a simple (weak) hash map for an existing template * object that matches the source URL. If there is no cache entry, a new one is * created by the underlying template engine. This new instance is put * to the cache for consecutive calls. * </p> * * @return The template that will produce the response text. * @param url * The URL containing the template source.. * @throws ServletException * If the request specified an invalid template source URL */ protected Template getTemplate(URL url) throws ServletException { String key = url.toString(); Template template = findCachedTemplate(key, null); // Template not cached or the source file changed - compile new template! if (template == null) { try { template = createAndStoreTemplate(key, url.openConnection().getInputStream(), null); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e); } } return template; }
template = createAndStoreTemplate(key, new FileInputStream(file), file); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e);
template = createAndStoreTemplate(key, new FileInputStream(file), file); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e);