@Override public <T> T perform(String description, IOOperation<T> operation) throws IOException { return operationTracker.perform(description, operation); }
@Override public <T> T perform(String description, IOOperation<T> operation) throws IOException { return operationTracker.perform(description, operation); }
public <T> T perform(String description, IOOperation<T> operation) throws IOException { return tracker.perform(description, operation); }
private StreamableResource filter(final StreamableResource base, final Resource baseResource) throws IOException { return tracker.perform("Rewriting relative URLs in " + baseResource, new IOOperation<StreamableResource>() { public StreamableResource perform() throws IOException { String baseString = readAsString(base); String filtered = replaceURLs(baseString, baseResource); if (filtered == null) { // No URLs were replaced so no need to create a new StreamableResource return base; } BytestreamCache cache = new BytestreamCache(filtered.getBytes("UTF-8")); return new StreamableResourceImpl(base.getDescription(), CSS_CONTENT_TYPE, CompressionStatus.COMPRESSABLE, base.getLastModified(), cache, checksumGenerator, base.getResponseCustomizer()); } }); }
public boolean handleAssetRequest(Request request, Response response, final String extraPath) throws IOException { return tracker.perform(String.format("Streaming JavaScript asset stack %s", extraPath), new IOOperation<Boolean>() { public Boolean perform() throws IOException { return streamStackResource(extraPath); } }); }
@Override public InputStream transform(final Resource source, final ResourceDependencies dependencies) throws IOException { final String description = String.format("Compiling %s from %s to %s", source, sourceName, targetName); return tracker.perform(description, new IOOperation<InputStream>() { @Override public InputStream perform() throws IOException { return delegate.transform(source, dependencies); } }); } };
@Override public InputStream transform(final Resource source, final ResourceDependencies dependencies) throws IOException { final String description = String.format("Compiling %s from %s to %s", source, sourceName, targetName); return tracker.perform(description, new IOOperation<InputStream>() { @Override public InputStream perform() throws IOException { return delegate.transform(source, dependencies); } }); } };
@Override public <T> T perform(String description, IOOperation<T> operation) throws IOException { try { return get().perform(description, operation); } finally { cleanup(); } } }
@Override public <T> T perform(String description, IOOperation<T> operation) throws IOException { try { return get().perform(description, operation); } finally { cleanup(); } } }
public boolean streamResource(final Resource resource, final String providedChecksum, final Set<Options> options) throws IOException { if (!resource.exists()) { // TODO: Or should we just return false here and not send back a specific error with the (eventual) 404? response.sendError(HttpServletResponse.SC_NOT_FOUND, String.format("Unable to locate asset '%s' (the file does not exist).", resource)); return true; } final boolean compress = providedChecksum.startsWith("z"); return tracker.perform("Streaming " + resource + (compress ? " (compressed)" : ""), new IOOperation<Boolean>() { public Boolean perform() throws IOException { StreamableResourceProcessing processing = compress ? StreamableResourceProcessing.COMPRESSION_ENABLED : StreamableResourceProcessing.COMPRESSION_DISABLED; StreamableResource streamable = streamableResourceSource.getStreamableResource(resource, processing, resourceChangeTracker); return streamResource(resource, streamable, compress ? providedChecksum.substring(1) : providedChecksum, options); } }); }
private void invokeQueuedRenderer() throws IOException { while (true) { IOOperation responseRenderer = (IOOperation) request.getAttribute(TapestryConstants.RESPONSE_RENDERER); if (responseRenderer == null) { break; } // There's a particular case where an operation puts a different operation into the attribute; // we'll handle that on the next pass. request.setAttribute(TapestryConstants.RESPONSE_RENDERER, null); tracker.perform("Executing deferred response renderer.", responseRenderer); } } }
tracker.perform(String.format("Assembling JavaScript asset stack '%s' (%s)", stackName, localeName), new IOOperation<StreamableResource>()
return tracker.perform(String.format("Streaming %s %s", compress ? "compressed module" : "module", moduleName), new IOOperation<Boolean>()
public void handleComponentEvent(final ComponentEventRequestParameters parameters, final ComponentRequestHandler handler) throws IOException { String componentId = parameters.getNestedComponentId().equals("") ? parameters.getContainingPageName() : parameters.getContainingPageName() + ":" + parameters.getNestedComponentId(); tracker.perform(String.format("Handling %s '%s' component event request for %s.", request.isXHR() ? "Ajax" : "traditional", parameters.getEventType(), componentId), new IOOperation<Void>() { public Void perform() throws IOException { handler.handleComponentEvent(parameters); return null; } }); }
tracker.perform("Minimizing " + input, new IOOperation<Void>()
tracker.perform("Minimizing " + input, new IOOperation<Void>()