This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:myapp/serverinfo.dart'; | |
import 'dart:js' as js; | |
import 'package:http/http.dart' as http; | |
import 'dart:async'; | |
import 'dart:convert'; | |
Future<List<ServerInfo>> fetchServerInfo() async { | |
final response = await http.get("http://localhost:8080/api"); | |
if (response.statusCode == 200) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:myapp/dataservice.dart'; | |
import 'dart:async'; | |
import 'package:myapp/serverinfo.dart'; | |
import 'package:myapp/startpage.dart'; | |
void main() { | |
runApp(MyApp()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:myapp/serverinfo.dart'; | |
import 'package:myapp/serviceinfo.dart'; | |
import 'package:myapp/utils.dart'; | |
class StartPage extends StatelessWidget { | |
StartPage({Key key, this.title, this.serverInfo}) : super(key: key); | |
final String title; | |
final Future<List<ServerInfo>> serverInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:myapp/serviceinfo.dart'; | |
class ServerInfo { | |
const ServerInfo({this.name, this.services}); | |
final String name; | |
final List<ServiceInfo> services; | |
factory ServerInfo.fromJson(Map<String, dynamic> json) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.serverchecker; | |
import com.serverchecker.dto.ServerInfo; | |
import com.serverchecker.service.DataService; | |
import java.util.List; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.RestController; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
@RestController | |
public class ApiController { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.serverchecker; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
@SpringBootApplication | |
public class Api { | |
/** | |
* @param args the command line arguments | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.serverchecker.service; | |
import com.serverchecker.dto.ServerInfo; | |
import com.serverchecker.dto.ServiceInfo; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.HashMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation 'org.springframework.boot:spring-boot-starter-web' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datapath=./data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Connection createConnection() throws TimeoutException, InterruptedException { | |
ConnectionFactory factory = new ConnectionFactory(); | |
// "guest"/"guest" by default, limited to localhost connections | |
factory.setUsername("guest"); | |
factory.setPassword("guest"); | |
factory.setVirtualHost("/"); | |
factory.setHost("127.0.0.1"); | |
factory.setPort(5672); | |
return connectToRabbitMQ(factory); | |
} |