public void init(WebletConfig config) { super.init(config); String httpAddress = config.getInitParameter("rootaddress"); if (httpAddress == null) { throw new WebletException("Missing either init parameter \"package\" or " + " or init parameter \"resourceRoot\" for " + " Weblet \"" + config.getWebletName() + "\""); } _resourceRoot = httpAddress; }
public Map getResource() { if (_delegate == null) init(); return _delegate.getResource(); }
/** * loads the resource from a given input stream note, this api is under construction we have caching not enabled yet * * @param config * the weblet config to load the resource * @param request * the weblet request * @param response * the weblet response * @param copyProvider * the processing copy provider * @param in * the resource serving input stream * @throws IOException */ public void loadResourceFromStream(WebletConfig config, WebletRequest request, WebletResponse response, CopyStrategy copyProvider, InputStream in) throws IOException { OutputStream out = response.getOutputStream(); String finalMimetype = config.getMimeType(request.getPathInfo()); copyProvider.copy(request.getWebletName(), finalMimetype, in, out); }
public InputStream getResourceStream(WebletRequest request, String mimeType) throws WebletException { Weblet weblet = (Weblet) _weblets.get(request.getWebletName()); if (weblet == null) return null; try { return weblet.serviceStream(request.getPathInfo(), mimeType); } catch (IOException ex) { return null; } }
/** * new since 1.1 we now can get the weblet also * as local stream for furhter external processing * if we have our weblet request. * <p/> * We can add a dummy request * * @param request * @return an input stream on our current weblet resource * @throws WebletException * @throws IOException */ public InputStream serviceStream(WebletRequest request, String mimetype) throws WebletException, IOException { Weblet weblet = getWeblet(request); return weblet.serviceStream(request.getPathInfo(), mimetype); }
public void init(FilterConfig filterConfig) throws ServletException { wblContainer = WebletContainer.getInstance(); }
public Weblet getWeblet(WebletRequest request) { String webletName = request.getWebletName(); return getWeblet(webletName); }
public void contextDestroyed(ServletContextEvent event) { WebletContainerImpl container = (WebletContainerImpl) WebletContainerImpl.getInstance(); if (container != null) container.destroy(); }
public void destroy() { _resourceRoot = null; _packageName = null; super.destroy(); } }
/** * init method which is called by default to process the parameters * * @param config * the webletconfig to be processed */ public void init(WebletConfig config) { super.init(config); _resourceRoot = config.getInitParameter("resourceRoot"); // init param missing, lets throw an error if (_resourceRoot == null) { throw new WebletException("Missing either init parameter \"package\" or " + " or init parameter \"resourceRoot\" for " + " Weblet \"" + config.getWebletName() + "\""); } }
public InputStream getResourceStream(WebletRequest request, String mimeType) throws WebletException { Weblet weblet = (Weblet) _weblets.get(request.getWebletName()); if (weblet == null) return null; try { return weblet.serviceStream(request.getPathInfo(), mimeType); } catch (IOException ex) { return null; } }
/** * new since 1.1 we now can get the weblet also * as local stream for furhter external processing * if we have our weblet request. * <p/> * We can add a dummy request * * @param request * @return an input stream on our current weblet resource * @throws WebletException * @throws IOException */ public InputStream serviceStream(WebletRequest request, String mimetype) throws WebletException, IOException { Weblet weblet = getWeblet(request); return weblet.serviceStream(request.getPathInfo(), mimetype); }
public void init(FilterConfig config) throws ServletException { _servletContext = config.getServletContext(); // _webletContainer = (WebletContainerImpl)config.getServletContext().getAttribute(WebletsContextListenerImpl.WEBLET_CONTAINER_KEY); _webletContainer = (WebletContainerImpl) WebletContainer.getInstance(); }
public void destroy() { _resourceRoot = null; super.destroy(); }
/** * init method which is called by default to process the parameters * * @param config the webletconfig to be processed */ public void init(WebletConfig config) { super.init(config); // fetch the weblets init param String packageName = config.getInitParameter("package"); // fetch the resource root param String resourceRoot = config.getInitParameter("resourceRoot"); // String cacheTimeout = config.getInitParameter("cachecontrol-timeout"); // init param missing, lets throw an error if (packageName == null && resourceRoot == null) { throw new WebletException("Missing either init parameter \"package\" or " + " or init parameter \"resourceRoot\" for " + " Weblet \"" + config.getWebletName() + "\""); } // the init was successful we now have all we need _resourceRoot = (packageName != null) ? packageName.replace('.', '/') : resourceRoot; // optional init param }
public void init(FilterConfig config) throws ServletException { _servletContext = config.getServletContext(); // _webletContainer = (WebletContainerImpl)config.getServletContext().getAttribute(WebletsContextListenerImpl.WEBLET_CONTAINER_KEY); _webletContainer = (WebletContainerImpl) WebletContainer.getInstance(); }
public void destroy() { _resourceRoot = null; super.destroy(); }
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(); }