Package com.helger.servlet
Class StaticServerInfo
- java.lang.Object
-
- com.helger.servlet.StaticServerInfo
-
@Immutable public class StaticServerInfo extends Object
This singleton instance represents default server information for locations where no request context is available (e.g. in scheduled tasks)- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStaticServerInfo(String sScheme, String sServerName, int nServerPort, String sContextPath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContextPath()StringgetFullContextPath()This is a shortcut forgetFullServerPath () + getContextPath ().StringgetFullServerPath()static StaticServerInfogetInstance()StringgetScheme()StringgetServerName()intgetServerPort()static StaticServerInfoinit(String sScheme, String sServerName, int nServerPort, String sContextPath)static booleanisSet()StringtoString()
-
-
-
Method Detail
-
getServerName
@Nonnull public String getServerName()
- Returns:
- The server name without scheme. E.g. "www.helger.com"
-
getServerPort
@CheckForSigned public int getServerPort()
- Returns:
- The server port we're running on. May be -1, if constructed from a URL and the passed scheme is neither "http" nor "https".
-
getFullServerPath
@Nonnull public String getFullServerPath()
- Returns:
scheme://server:portorscheme://serverif the default port was used
-
getFullContextPath
@Nonnull public String getFullContextPath()
This is a shortcut forgetFullServerPath () + getContextPath ().- Returns:
scheme://server:port/contextorscheme://server:portfor the ROOT context.
-
isSet
public static boolean isSet()
-
init
@Nonnull public static StaticServerInfo init(@Nonnull @Nonempty String sScheme, @Nonnull @Nonempty String sServerName, @Nonnegative int nServerPort, @Nonnull String sContextPath)
-
getInstance
@Nonnull public static StaticServerInfo getInstance()
-
-