class AbstractDefaultToStringRenderable implements Renderable {

    @Override
    public String toString() {
        StringWriter writer = new StringWriter();
        try {
            render(null, writer);
        } catch (MethodInvocationException e) {
            throw new TilesVelocityException("Cannot invoke method when rendering", e);
        } catch (ParseErrorException e) {
            throw new TilesVelocityException("Cannot parse when rendering", e);
        } catch (ResourceNotFoundException e) {
            throw new TilesVelocityException("Cannot find resource when rendering", e);
        } catch (IOException e) {
            throw new TilesVelocityException("I/O exception when rendering", e);
        } finally {
            try {
                writer.close();
            } catch (IOException e) {
                log.error("Error when closing a StringWriter, the impossible happened!", e);
            }
        }
        return writer.toString();
    }

    public  AbstractDefaultToStringRenderable(Context velocityContext,
            Map<String, Object> params, HttpServletResponse response,
            HttpServletRequest request);

}