Interface Fragment

All Superinterfaces:
Normalisable<Fragment>, org.wiremock.stringparser.ParsedString, PercentEncoded<Fragment>

public interface Fragment extends PercentEncoded<Fragment>, org.wiremock.stringparser.ParsedString
Represents the fragment component of a URI as defined in RFC 3986 Section 3.5.

The fragment identifier provides direction to a secondary resource, such as a section within a document. Fragments are not sent to the server but are used by the client. Fragment strings may contain percent-encoded characters.

Implementations must be immutable and thread-safe.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Fragment
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Fragment
    encode(String unencoded)
    Encodes a string into a valid fragment with proper percent-encoding.
    Returns a normalised form of this fragment.
    static Fragment
    parse(String fragment)
    Parses a string into a fragment.

    Methods inherited from interface org.wiremock.url.Normalisable

    isNormalForm

    Methods inherited from interface org.wiremock.stringparser.ParsedString

    toString

    Methods inherited from interface org.wiremock.url.PercentEncoded

    decode, isEmpty, length
  • Field Details

  • Method Details

    • normalise

      Fragment normalise()
      Returns a normalised form of this fragment.
      Specified by:
      normalise in interface Normalisable<Fragment>
      Returns:
      a normalised fragment
    • parse

      static Fragment parse(String fragment) throws IllegalFragment
      Parses a string into a fragment.
      Parameters:
      fragment - the string to parse
      Returns:
      the parsed fragment
      Throws:
      IllegalFragment - if the string is not a valid fragment
    • encode

      static Fragment encode(String unencoded)
      Encodes a string into a valid fragment with proper percent-encoding.
      Parameters:
      unencoded - the unencoded string
      Returns:
      the encoded fragment