# Package org.klomp.snark.web

The I2PSnark web user interface package, providing a complete web-based torrent management system implemented as a webapp in i2psnark.war.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  BasicServlet.HttpContent | from Jetty HttpContent.java

- Class Summary
  Class | Description
  --- | ---
  BasicServlet | Based on DefaultServlet from Jetty 6.1.26, heavily simplified and modified to remove all dependencies on Jetty libs.
  FetchAndAdd | A cancellable torrent file downloader.
  I2PSnarkServlet | Web interface servlet for I2PSnark torrent management.
  InclusiveByteRange | Byte range inclusive of end points.
  MimeTypes | Based on MimeTypes from Jetty 6.1.26, heavily simplified and modified to remove all dependencies on Jetty libs.
  Mp3Tags | Utility class for extracting MP3 metadata tags for display in the I2PSnark web interface.
  Sorters | Comparators for various columns
  Sorters.FileAndIndex | Class to precompute and efficiently sort data on a torrent file entry.

## Package org.klomp.snark.web Description

The I2PSnark web user interface package, providing a complete web-based torrent management system implemented as a webapp in i2psnark.war. This package contains all the servlets, utilities, and supporting classes necessary for the I2PSnark web interface.

## Core Components

- `I2PSnarkServlet` - Main servlet handling all HTTP requests for the I2PSnark web interface, including torrent management, file browsing, and configuration.
- `BasicServlet` - Base servlet class providing common functionality for HTTP request handling, file serving, and utility methods used throughout the web interface.
- `FetchAndAdd` - Torrent file downloader that fetches torrent files from remote locations and automatically adds them to the I2PSnark manager.

## Utility Classes

- `MimeTypes` - MIME type detection and mapping for various file formats, enabling proper content-type headers when serving files through the web interface.
- `Sorters` - Collection of comparators for sorting torrents and files by various criteria such as name, size, progress, and speed in multiple locales.
- `InclusiveByteRange` - HTTP byte range handling for partial content requests, supporting resumable downloads and efficient file streaming.
- `Mp3Tags` - MP3 metadata extraction utility for reading ID3v1 and ID3v2 tags, enhancing the file browsing experience with rich media information.

## Key Features

- Complete torrent management interface (add, remove, start, stop, prioritize)
- Real-time torrent status monitoring and progress tracking
- File browsing and direct download from completed torrents
- Support for torrent file addition via URL, magnet links, or file upload
- Internationalized interface with multi-language sorting support
- Media metadata extraction for enhanced file browsing
- Partial content support for efficient large file downloads

## Security and Privacy

All web interface operations are conducted through the I2P network, ensuring privacy and anonymity. The package includes security measures such as secure file handling and proper input validation.

## Integration

This package integrates tightly with the core I2PSnark components in the `org.klomp.snark` package, providing a user-friendly web interface for torrent management while leveraging the underlying torrent engine and I2P networking capabilities.