java.lang.Object
net.i2p.router.web.ContentOnly

public class ContentOnlyextends Object
Per-request utility for the opt-in console fragment mode. When a page is requested with a contentonly request parameter, only the named elements are rendered and the shared head/sidebar chrome is skipped, so auto-refresh ticks transfer and parse a fraction of the full page. Full-page requests (no contentonly parameter) are unaffected.

Pages opt in by gating each refresh target with render(HttpServletRequest, String); the chrome guards in head.jsi and sidebar.jsi are shared by every console page.

  • Field Details

    • SPLIT

      private static final Pattern SPLIT
      Splits the contentonly parameter on commas and whitespace.
    • ELEMENT_ID

      private static final Pattern ELEMENT_ID
      Element ids are [A-Za-z0-9_-] runs.
  • Constructor Details

    • ContentOnly

      private ContentOnly()
      Utility class, not intended for instantiation.
  • Method Details

    • isContentOnly

      public static boolean isContentOnly(HttpServletRequest req)
      True when the request asks for fragment rendering.
      Parameters:
      req - request whose contentonly parameter is inspected
      Returns:
      true iff the contentonly parameter is present and non-empty
    • requestedIds

      public static Set<String> requestedIds(HttpServletRequest req)
      The sanitized set of requested element ids. Splits the parameter on commas and whitespace and keeps only ids matching [A-Za-z0-9_-].
      Parameters:
      req - request whose contentonly parameter supplies the ids
      Returns:
      the requested ids, or an empty set
    • render

      public static boolean render(HttpServletRequest req, String id)
      Whether the named element must be rendered for this request.
      Parameters:
      req - request whose contentonly parameter gates the rendering
      id - the element id
      Returns:
      true for full-page requests, and for fragment requests that include the id