Fix URL deprecation warnings
This commit is contained in:
parent
5dd11bbe6c
commit
951a659be1
@ -29,7 +29,7 @@ import java.io.BufferedReader
|
||||
import java.io.IOException
|
||||
import java.io.InputStreamReader
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import java.net.URI
|
||||
|
||||
class CachetAPIController {
|
||||
|
||||
@ -41,7 +41,7 @@ class CachetAPIController {
|
||||
|
||||
fun postTotalRequests() {
|
||||
try {
|
||||
val url = URL("${StartupController.cachetBaseURL}/api/v1/metrics/1/points")
|
||||
val url = URI("${StartupController.cachetBaseURL}/api/v1/metrics/1/points").toURL()
|
||||
val jsonInputString = "{\"value\": ${totalRequests -oldTotalRequests}, \"timestamp\": \"${(System.currentTimeMillis() / 1000)}\"}"
|
||||
oldTotalRequests = totalRequests
|
||||
|
||||
|
@ -29,7 +29,7 @@ import org.mosad.thecitadelofricks.Status
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import java.net.URI
|
||||
import java.time.LocalDateTime
|
||||
import java.util.*
|
||||
import kotlin.collections.HashMap
|
||||
@ -90,8 +90,8 @@ class StatusController {
|
||||
var swfrCode = 999
|
||||
|
||||
try {
|
||||
val hsoURL = URL("https://www.hs-offenburg.de/")
|
||||
val swfrURL = URL("https://www.swfr.de/")
|
||||
val hsoURL = URI("https://www.hs-offenburg.de/").toURL()
|
||||
val swfrURL = URI("https://www.swfr.de/").toURL()
|
||||
|
||||
var connection = hsoURL.openConnection() as HttpURLConnection
|
||||
connection.requestMethod = "HEAD"
|
||||
|
Loading…
Reference in New Issue
Block a user