You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
1.1 KiB

package org.mosad.thecitadelofricks.controller
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.net.HttpURLConnection
import java.net.URL
import java.io.OutputStreamWriter
class CachetAPIController {
companion object {
private val logger: Logger = LoggerFactory.getLogger(CachetAPIController::class.java)
fun postTotalRequests(totalRequests: Int) {
logger.info("sending post request ...")
val currentTime = System.currentTimeMillis() / 1000
val data = mapOf(Pair("value", totalRequests.toString()), Pair("timestamp", currentTime.toString()))
val url = URL("https://status.mosad.xyz/api/v1/metrics/1/points")
val connection = url.openConnection() as HttpURLConnection
connection.setRequestProperty("X-Cachet-Token", "h0103Wix5xhhNH5tk5KU")
connection.requestMethod = "POST"
connection.doOutput = true
val writer = OutputStreamWriter(connection.outputStream)
writer.write(data.toString())
writer.flush()
writer.close()
}
}
}

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close