public void init(FilterConfig filterConfig) throws ServletException { wblContainer = WebletContainer.getInstance(); }
static public WebletContainer getInstance() throws WebletException { ClassLoader loader = getLoader(); return (WebletContainer) _INSTANCES.get(loader); }
private void resolveLine(String line, int startAt, Matcher matcher, boolean url) throws IOException { if (matcher.matches()) { String preamble = line.substring(0, startAt); String webletName = matcher.group(1); webletName = (webletName != null) ? webletName.trim() : webletName; String pathInfo = matcher.group(2); pathInfo = (pathInfo != null) ? pathInfo.trim() : pathInfo; String postamble = matcher.group(3); // default relative weblet:/resource.ext to this weblet if (webletName == null) { webletName = this.webletName; } WebletContainer container = WebletContainer.getInstance(); String webletURL = null; if (url) webletURL = container.getWebletContextPath() + container.getResourceUri(webletName, pathInfo); else webletURL = container.getResourceUri(webletName, pathInfo); r.write(preamble); r.write(webletURL); r.write(postamble); r.write("\n"); } else { r.write(line); r.write("\n"); } }
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (!isSetup) { synchronized (wblContainer) { isSetup = true; if (wblContainer.getWebletContextPath() == null || wblContainer.getWebletContextPath().trim().equals("")) { wblContainer.setWebletContextPath(((HttpServletRequest) servletRequest).getContextPath()); } } } filterChain.doFilter(servletRequest, servletResponse); }
registerConfig(resource); WebletContainer.setInstance(this);
WebletContainer.setInstance(this);
public void init(FilterConfig config) throws ServletException { _servletContext = config.getServletContext(); // _webletContainer = (WebletContainerImpl)config.getServletContext().getAttribute(WebletsContextListenerImpl.WEBLET_CONTAINER_KEY); _webletContainer = (WebletContainerImpl) WebletContainer.getInstance(); }
private String resolveLine(String line, int startAt, Matcher matcher, boolean url) throws IOException { StringBuffer buf = new StringBuffer(line.length() + 64); if (matcher.matches()) { String preamble = line.substring(0, startAt); String webletName = matcher.group(1); webletName = (webletName != null) ? webletName.trim() : webletName; String pathInfo = matcher.group(2); pathInfo = (pathInfo != null) ? pathInfo.trim() : pathInfo; String postamble = matcher.group(3); // default relative weblet:/resource.ext to this weblet if (webletName == null) { webletName = this.webletName; } WebletContainer container = WebletContainer.getInstance(); String webletURL = null; if (url) webletURL = container.getWebletContextPath() + container.getResourceUri(webletName, pathInfo); else webletURL = container.getResourceUri(webletName, pathInfo); buf.append(preamble); buf.append(webletURL); buf.append(postamble); buf.append("\n"); } else { buf.append(line); buf.append("\n"); } return buf.toString(); }
static protected void setInstance(WebletContainer container) throws WebletException { ClassLoader loader = getLoader(); _INSTANCES.put(loader, container); }
public void init(FilterConfig config) throws ServletException { _servletContext = config.getServletContext(); // _webletContainer = (WebletContainerImpl)config.getServletContext().getAttribute(WebletsContextListenerImpl.WEBLET_CONTAINER_KEY); _webletContainer = (WebletContainerImpl) WebletContainer.getInstance(); }
WebXmlParser parser = new WebXmlParser(); Digester digester = new Digester(); digester.setClassLoader(WebletContainer.getLoader());
public void init(ServletConfig config) throws ServletException { super.init(config); // _webletContainer = (WebletContainerImpl)getServletContext().getAttribute(WebletsContextListenerImpl.WEBLET_CONTAINER_KEY); _webletContainer = (WebletContainerImpl) WebletContainer.getInstance(); }
public void init(ServletConfig config) throws ServletException { super.init(config); // _webletContainer = (WebletContainerImpl)getServletContext().getAttribute(WebletsContextListenerImpl.WEBLET_CONTAINER_KEY); _webletContainer = (WebletContainerImpl) WebletContainer.getInstance(); }
public void contextDestroyed(ServletContextEvent event) { WebletContainerImpl container = (WebletContainerImpl) WebletContainerImpl.getInstance(); if (container != null) container.destroy(); }
public InputStream getResourceAsStream(WebletRequest request, String mimetype) throws WebletException { WebletContainerImpl container = (WebletContainerImpl) WebletContainer.getInstance(); return container.getResourceStream(request, mimetype); }
public InputStream getResourceAsStream(WebletRequest request, String mimetype) throws WebletException { WebletContainerImpl container = (WebletContainerImpl) WebletContainer.getInstance(); return container.getResourceStream(request, mimetype); }
public String getURL(String weblet, String pathInfo) { /* lets be more tolerant regarding paths */ if (pathInfo == null || pathInfo.trim().equals("")) pathInfo = "/"; WebletContainerImpl container = (WebletContainerImpl) WebletContainer.getInstance(); if (container == null) { initError(); return WEBLETS_NOT_INITIALIZED; } return container.getWebletContextPath() + container.getResourceUri(weblet, pathInfo); }
public String getURL(String weblet, String pathInfo) { /* lets be more tolerant regarding paths */ if (pathInfo == null || pathInfo.trim().equals("")) pathInfo = "/"; WebletContainerImpl container = (WebletContainerImpl) WebletContainer.getInstance(); if (container == null) { initError(); return WEBLETS_NOT_INITIALIZED; } return container.getWebletContextPath() + container.getResourceUri(weblet, pathInfo); }
/** * resolves into a uri relative to the current application context //pathInfo resolves into server absolue addresses <p/> /pathInfo into context relative * addresses * * @param weblet * @param pathInfo * @return the resource path */ public String getResource(String weblet, String pathInfo) { /* lets be more tolerant regarding paths */ if (pathInfo == null || pathInfo.trim().equals("")) pathInfo = "/"; WebletContainerImpl container = (WebletContainerImpl) WebletContainer.getInstance(); if (container == null) { initError(); return WEBLETS_NOT_INITIALIZED; } return container.getResourceUri(weblet, pathInfo); }
/** * resolves into a uri relative to the current application context //pathInfo resolves into server absolue addresses <p/> /pathInfo into context relative * addresses * * @param weblet * @param pathInfo * @return the resource path */ public String getResource(String weblet, String pathInfo) { /* lets be more tolerant regarding paths */ if (pathInfo == null || pathInfo.trim().equals("")) pathInfo = "/"; WebletContainerImpl container = (WebletContainerImpl) WebletContainer.getInstance(); if (container == null) { initError(); return WEBLETS_NOT_INITIALIZED; } return container.getResourceUri(weblet, pathInfo); }