code: public static String render(final Request request, final WComponent component) {
  		boolean needsContext = UIContextHolder.getCurrent() == null;
  
  		if (needsContext) {
  			UIContextHolder.pushContext(new UIContextImpl());
  		}
  
  		try {
  			StringWriter buffer = new StringWriter();
  
  			component.preparePaint(request);
  			try (PrintWriter writer = new PrintWriter(buffer)) {
  				component.paint(new WebXmlRenderContext(writer));
  			}
  			return buffer.toString();
  		} finally {
  			if (needsContext) {
  				UIContextHolder.popContext();
  			}
  		}
  	}
docs: Renders the given WComponent to a String outside of the context of a Servlet. This is good for getting hold of
  the XML for debugging, unit testing etc. Also it is good for using the WComponent framework as a more generic
  templating framework.
  
  @param request the request being responded to.
  @param component the root WComponent to render.
  @return the rendered output as a String.