HttpHandler, which processes requests to a static resources resolved by a given ClassLoader.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final boolean | CHECK_NON_SLASH_TERMINATED_FOLDERS
true (default) if we want to double-check the resource requests, that don't have terminating slash if they represent a folder and try to retrieve a welcome resource from the folder. |
| protected static final String | |
| private final ClassLoader | |
| private final ArraySet | |
| private static final String | |
| private static final Logger | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public | CLStaticHttpHandler(final ClassLoader
ClassLoader to be used to resolve the resourcesthe doc roots (path prefixes), which will be used to find resources. Effectively each docRoot will be
prepended to a resource path before passing it to docRoots)ClassLoader#getResource(java.. If no
docRoots are set - the resources will be searched starting from ClassLoader's root.Create HttpHandler, which will handle requests to the static resources resolved by the given class loader. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if this docroot hasn't been registered before, or false otherwise.Adds doc root (path prefix), which will be used to look up resources. |
| private boolean | |
| private static void | |
| public ClassLoader | |
| private File | |
| protected boolean | handle(String resourcePath, final Request request, final Response response)
Implements abstract org. Lookup a resource based on the request URI, and process it. |
| private URL | |
| public boolean | Returns: true if this docroot was found and removed from the list, or or false if this docroot was not found in the list.Removes docRoot from the doc root list. |
| private static void |
| CHECK_NON_SLASH_TERMINATED_FOLDERS | back to summary |
|---|---|
| private static final boolean CHECK_NON_SLASH_TERMINATED_FOLDERS true (default) if we want to double-check the resource requests, that don't have terminating slash if they represent a folder and try to retrieve a welcome resource from the folder. | |
| CHECK_NON_SLASH_TERMINATED_FOLDERS_PROP | back to summary |
|---|---|
| protected static final String CHECK_NON_SLASH_TERMINATED_FOLDERS_PROP | |
| classLoader | back to summary |
|---|---|
| private final ClassLoader classLoader | |
| docRoots | back to summary |
|---|---|
| private final ArraySet<String> docRoots | |
| EMPTY_STR | back to summary |
|---|---|
| private static final String EMPTY_STR | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER Hides org. | |
| SLASH_STR | back to summary |
|---|---|
| private static final String SLASH_STR | |
| CLStaticHttpHandler | back to summary |
|---|---|
| public CLStaticHttpHandler(final ClassLoader classLoader, final String... docRoots) Create HttpHandler, which will handle requests to the static resources resolved by the given class loader.
| |
| addDocRoot | back to summary |
|---|---|
| public boolean addDocRoot(final String docRoot) Adds doc root (path prefix), which will be used to look up resources. Effectively each registered docRoot will be
prepended to a resource path before passing it to
| |
| addTimeStampEntryToFileCache | back to summary |
|---|---|
| private boolean addTimeStampEntryToFileCache(final Request req, final Response res, final File archive) | |
| closeJarFileIfNeeded | back to summary |
|---|---|
| private static void closeJarFileIfNeeded(final JarURLConnection jarConnection, final JarFile jarFile) throws IOException | |
| getClassLoader | back to summary |
|---|---|
| public ClassLoader getClassLoader() Returns the | |
| getJarFile | back to summary |
|---|---|
| private File getJarFile(final String path) throws MalformedURLException, FileNotFoundException | |
| handle | back to summary |
|---|---|
| protected boolean handle(String resourcePath, final Request request, final Response response) throws Exception Implements abstract org. Doc from org. Lookup a resource based on the request URI, and process it.
| |
| lookupResource | back to summary |
|---|---|
| private URL lookupResource(String resourcePath) | |
| removeDocRoot | back to summary |
|---|---|
| public boolean removeDocRoot(final String docRoot) Removes docRoot from the doc root list.
| |
| sendResource | back to summary |
|---|---|
| private static void sendResource(final Response response, final InputStream input) throws IOException | |
| Modifier and Type | Field and Description |
|---|---|
| private final JarURLConnection | |
| private final JarFile |
| Access | Constructor and Description |
|---|---|
| pack-priv | JarURLInputStream(final JarURLConnection jarConnection, final JarFile jarFile, final InputStream src)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. Closes this input stream and releases any system resources associated with the stream. |
| jarConnection | back to summary |
|---|---|
| private final JarURLConnection jarConnection | |
| jarFile | back to summary |
|---|---|
| private final JarFile jarFile | |
| JarURLInputStream | back to summary |
|---|---|
| pack-priv JarURLInputStream(final JarURLConnection jarConnection, final JarFile jarFile, final InputStream src) | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated with the stream.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final InputStream | |
| private final MemoryManager | |
| private final NIOOutputStream | |
| private final Response |
| Access | Constructor and Description |
|---|---|
| pack-priv | NonBlockingDownloadHandler(final Response response, final NIOOutputStream outputStream, final InputStream inputStream, final int chunkSize)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | onError(Throwable t)
Implements org. Invoked when an error occurs processing the request asynchronously. |
| public void | onWritePossible()
Implements org. This callback will be invoked when the requirements as dictated by writer are met. |
| private boolean |
| chunkSize | back to summary |
|---|---|
| private final int chunkSize | |
| inputStream | back to summary |
|---|---|
| private final InputStream inputStream | |
| mm | back to summary |
|---|---|
| private final MemoryManager<E extends Buffer> mm | |
| outputStream | back to summary |
|---|---|
| private final NIOOutputStream outputStream | |
| response | back to summary |
|---|---|
| private final Response response | |
| NonBlockingDownloadHandler | back to summary |
|---|---|
| pack-priv NonBlockingDownloadHandler(final Response response, final NIOOutputStream outputStream, final InputStream inputStream, final int chunkSize) | |
| complete | back to summary |
|---|---|
| private void complete(final boolean isError) Complete the download | |
| onError | back to summary |
|---|---|
| public void onError(Throwable t) Implements org. Doc from org. Invoked when an error occurs processing the request asynchronously.
| |
| onWritePossible | back to summary |
|---|---|
| public void onWritePossible() throws Exception Implements org. Doc from org. This callback will be invoked when the requirements as dictated by writer are met.
| |
| sendChunk | back to summary |
|---|---|
| private boolean sendChunk() throws IOException Send next CHUNK_SIZE of file | |