public final class WebUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
browseSite(String address)
Opens site in default system web-browser
|
static void |
browseSiteSafely(String address)
Opens site in default system web-browser safely
|
static String |
decodeUrl(String url)
Returns decoded url path.
|
static String |
encodeUrl(String url)
Returns encoded url path.
|
static Map<String,List<String>> |
getUrlParameters(String url)
Returns url query parameters.
|
static String |
normalizeUrl(String url)
Returns normalized url path.
|
static void |
openFile(File file)
Opens file in appropriate system application
|
static void |
openFileSafely(File file)
Opens file in appropriate system application safely
|
static void |
shareOnFb(String address)
Opens system default web-browser with Facebook share page.
|
static void |
shareOnTwitter(String address)
Opens system default web-browser with Twitter share page.
|
static void |
shareOnVk(String address)
Opens system default web-browser with VKontakte share page.
|
static void |
writeEmail(String email)
Opens system mail agent to compose a new letter
|
static void |
writeEmail(String email,
String subject,
String body)
Opens system mail agent to compose a new letter
|
static void |
writeEmailSafely(String email)
Opens system mail agent to compose a new letter safely
|
static void |
writeEmailSafely(String email,
String subject,
String body)
Opens system mail agent to compose a new letter safely
|
@NotNull public static String normalizeUrl(@NotNull String url)
url - the url to normalize@NotNull public static Map<String,List<String>> getUrlParameters(@NotNull String url)
url - the url to parse@NotNull public static String encodeUrl(@NotNull String url)
url - the url to encode@NotNull public static String decodeUrl(@NotNull String url)
url - the url to decodepublic static void browseSite(@NotNull String address) throws URISyntaxException, IOException
address - the address to openURISyntaxException - if URI cannot be created for the given addressIOException - if browser application is not found or fails to launchpublic static void browseSiteSafely(@NotNull String address)
address - the address to openpublic static void shareOnTwitter(@NotNull String address)
address - the address to sharepublic static void shareOnVk(@NotNull String address)
address - the address to sharepublic static void shareOnFb(@NotNull String address)
address - the address to sharepublic static void openFile(@NotNull File file) throws IOException
file - the file to openIOException - if the specified file has no associated application or the associated application fails to be launchedpublic static void openFileSafely(@NotNull File file)
file - the file to openpublic static void writeEmail(@NotNull String email) throws URISyntaxException, IOException
email - the destination email addressURISyntaxException - if mailing URI cannot be createdIOException - if used mail client cannot be foundpublic static void writeEmail(@NotNull String email, @Nullable String subject, @Nullable String body) throws URISyntaxException, IOException
email - the destination email addresssubject - letter subjectbody - letter textURISyntaxException - if mailing URI cannot be createdIOException - if used mail client cannot be foundpublic static void writeEmailSafely(@NotNull String email)
email - the destination email addressCopyright © 2020. All rights reserved.