/** * Creates a renderlet service registered using the given bundle context. Using * This method ensures that the passed BundleContext is used to determine the priority * of the renderlets. * * @param location * @param rdfType * @param modePattern * @param mediaType * @param callerBundleContext * @return */ public ServiceRegistration registerScalaServerPage(URL location, IRI rdfType, String modePattern, MediaType mediaType, BundleContext callerBundleContext) { TypeRenderlet sspTypeRenderlet = new SspTypeRenderlet(location, rdfType, modePattern, mediaType, scalaCompilerService); return callerBundleContext.registerService(TypeRenderlet.class.getName(), sspTypeRenderlet, null); }
private static char[] getScriptChars(URL location) { try { final CharArrayWriter caos = new CharArrayWriter(); //Add the scriptHeader to the beginning of the script caos.write(headerChars); //add the content caos.write(getChars(location)); caos.write(footerChars); return caos.toCharArray(); } catch (IOException ex) { throw new RuntimeException(ex); } }
@Override public void render(GraphNode node, GraphNode context, Map<String, Object> sharedRenderingValues, CallbackRenderer callbackRenderer, RequestProperties requestProperties, OutputStream os) throws IOException { TypeRenderlet compiledSsp = getCompiledSsp(); compiledSsp.render(node, context, sharedRenderingValues, callbackRenderer, requestProperties, os); }
private synchronized TypeRenderlet getCompiledSsp() { char[] scriptChars = getScriptChars(sspLocation); if (Arrays.equals(scriptChars, lastCompiledChars)) { return lastCompiledSsp;