Package org.takes.misc
Class Href
- java.lang.Object
-
- org.takes.misc.Href
-
- All Implemented Interfaces:
CharSequence
public final class Href extends Object implements CharSequence
HTTP URI/HREF.The class is immutable and thread-safe.
- Since:
- 0.7
-
-
Constructor Summary
Constructors Constructor Description Href()
Ctor.Href(CharSequence txt)
Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
bare()
Get URI without params.char
charAt(int index)
int
length()
Iterable<String>
param(Object key)
Get query param.String
path()
Get path part of the HREF.Href
path(Object suffix)
Add this path to the URI.CharSequence
subSequence(int start, int end)
String
toString()
Href
with(Object key, Object value)
Add this extra param.Href
without(Object key)
Without this query param.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
-
-
-
Constructor Detail
-
Href
public Href()
Ctor.
-
Href
public Href(CharSequence txt)
Ctor.- Parameters:
txt
- Text of the link
-
-
Method Detail
-
length
public int length()
- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAt
in interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfaceCharSequence
-
toString
public String toString()
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
path
public String path()
Get path part of the HREF.- Returns:
- Path
- Since:
- 0.9
-
bare
public String bare()
Get URI without params.- Returns:
- Bare URI
- Since:
- 0.14
-
param
public Iterable<String> param(Object key)
Get query param.- Parameters:
key
- Param name- Returns:
- Values (could be empty)
- Since:
- 0.9
-
path
public Href path(Object suffix)
Add this path to the URI.- Parameters:
suffix
- The suffix- Returns:
- New HREF
-
with
public Href with(Object key, Object value)
Add this extra param.- Parameters:
key
- Key of the paramvalue
- The value- Returns:
- New HREF
-
-