java.lang.Object
net.i2p.router.web.HelperBase
Direct Known Subclasses:
CertHelper, ConfigAdvancedHelper, ConfigBanHelper, ConfigClientsHelper, ConfigFamilyHelper, ConfigKeyringHelper, ConfigLoggingHelper, ConfigNavHelper, ConfigNetHelper, ConfigPeerHelper, ConfigReseedHelper, ConfigStatsHelper, ConfigTunnelsHelper, ConfigUIHelper, ConfigUpdateHelper, ContentHelper, CSSHelper, DebugOverviewHelper, FileDumpHelper, HealthHelper, HelpSectionHelper, HomeHelper, InfoHelper, JobQueueHelper, LogsHelper, NewsFeedHelper, PeerHelper, ProfilesHelper, ReseedGenerator, ReseedHandler, SAMDebugHelper, SearchHelper, SidebarHelper, StatHelper, StreamHelper, TransitSummaryHelper, TuningHelper, TunnelBandwidthHelper, TunnelHelper, TunnelParticipatingFastestHelper, TunnelParticipatingHelper, TunnelPeerCountHelper, WizardHelper

public abstract class HelperBaseextends Object
Base helper class for JSP helper beans. Provides common functionality for router context access, translation services, and UI helper methods.
  • Field Details

  • Constructor Details

    • HelperBase

      public HelperBase()
      Constructor for JSP helper beans; a subclass calls the constructor taking its context and translator.
  • Method Details

    • setContextId

      public void setContextId(String contextId)
      Configure this bean to query a particular router context.
      Parameters:
      contextId - beginning few characters of the routerHash, or null to pick the first one we come across.
    • isAdvanced

      public boolean isAdvanced()
      Check if advanced mode is enabled.
      Returns:
      true if advanced mode is enabled
    • storeWriter

      public void storeWriter(Writer out)
      Store the writer for output. Renamed from setWriter, we really don't want setFoo(non-String) to prevent jsp.error.beans.property.conversion 500 error for ?writer=foo.
      Parameters:
      out - the writer to store
    • getChecked

      protected String getChecked(String prop)
      Get the checked attribute for a boolean property.
      Parameters:
      prop - the property name, must default to false
      Returns:
      non-null, either "" or " checked "
    • _t

      public String _t(String s)
      Translate a string.
      Parameters:
      s - the string to translate
      Returns:
      the translated string
    • _t

      public String _t(String s, Object o)
      Translate a string with a parameter. This is a lot more expensive than _t(s), so use sparingly.
      Parameters:
      s - string to be translated containing {0} The {0} will be replaced by the parameter. Single quotes must be doubled, i.e. ' -> '' in the string.
      o - parameter, not translated. To translate parameter also, use _t("foo {0} bar", _t("baz")) Do not double the single quotes in the parameter. Use autoboxing to call with ints, longs, floats, etc.
      Returns:
      the translated string
    • _t

      public String _t(String s, Object o, Object o2)
      Translate a string with two parameters.
      Parameters:
      s - string to be translated containing {0} and {1}
      o - substituted for {0} in the string to be translated
      o2 - substituted for {1} in the string to be translated
      Returns:
      the translated string
    • ngettext

      public String ngettext(String s, String p, int n)
      Translate a string with plural forms (ngettext).
      Parameters:
      s - singular message key, used when n is 1
      p - plural message key, used when n is not 1
      n - the count to determine which form to use
      Returns:
      the translated string
    • _x

      public static String _x(String s)
      Mark a string for extraction by xgettext and translation. Use this only in static initializers. It does not translate!
      Parameters:
      s - the string to mark
      Returns:
      s, unchanged and untranslated