1 48 49 package org.jpublish.view.xslt; 50 51 import java.io.*; 52 53 import com.anthonyeden.lib.config.Configuration; 54 import com.anthonyeden.lib.config.ConfigurationException; 55 import com.anthonyeden.lib.util.IOUtilities; 56 import org.jpublish.RequestContext; 57 import org.jpublish.view.AbstractViewRenderer; 58 import org.jpublish.view.ContentSource; 59 import org.jpublish.view.ViewRenderException; 60 61 67 68 public class XSLTViewRenderer extends AbstractViewRenderer { 69 70 79 80 public void render(RequestContext context, String path, Writer out) 81 throws IOException, ViewRenderException { 82 ContentSource contentSource = siteContext.getContentSource(path); 83 InputStream in = null; 84 try { 85 in = contentSource.getInputStream(); 86 int c = -1; 87 while ((c = in.read()) != -1) { 88 out.write((char) c); 89 } 90 } finally { 91 IOUtilities.close(in); 92 } 93 } 94 95 104 105 public void render(RequestContext context, String path, OutputStream out) 106 throws IOException, ViewRenderException { 107 render(context, path, new OutputStreamWriter(out)); 108 } 109 110 120 121 public void render(RequestContext context, String path, Reader in, 122 Writer out) throws IOException, ViewRenderException { 123 int c = -1; 124 while ((c = in.read()) != -1) { 125 out.write((char) c); 126 } 127 } 128 129 139 140 public void render(RequestContext context, String path, InputStream in, 141 OutputStream out) throws IOException, ViewRenderException { 142 render(context, path, new InputStreamReader(in), 143 new OutputStreamWriter(out)); 144 } 145 146 151 152 public void loadConfiguration(Configuration configuration) 153 throws ConfigurationException { 154 155 } 156 157 } 158 | Popular Tags |