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); }
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(); }
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"); } }