openvidu java tutorials updated version number

This commit is contained in:
pabloFuente 2019-02-07 16:42:58 +01:00
parent 3bd067f191
commit c2fc8b9e9a
5 changed files with 27 additions and 31 deletions

View File

@ -1,14 +1,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.openvidu</groupId>
<artifactId>openvidu-js-java</artifactId>
<version>2.7.0</version>
<version>2.8.0</version>
<packaging>jar</packaging>
<name>openvidu-js-java</name>
<url>http://maven.apache.org</url>
<url>https://github.com/OpenVidu/openvidu-tutorials/tree/master/openvidu-js-java</url>
<parent>
<groupId>org.springframework.boot</groupId>

View File

@ -1,10 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.openvidu</groupId>
<artifactId>openvidu-mvc-java</artifactId>
<version>2.5.0</version>
<version>2.8.0</version>
<packaging>jar</packaging>
<name>openvidu-mvc-java</name>

View File

@ -49,28 +49,27 @@ public class LoginController {
@RequestMapping(value = "/dashboard", method = { RequestMethod.GET, RequestMethod.POST })
public String login(@RequestParam(name = "user", required = false) String user,
@RequestParam(name = "pass", required = false) String pass,
Model model, HttpSession httpSession) {
@RequestParam(name = "pass", required = false) String pass, Model model, HttpSession httpSession) {
// Check if the user is already logged in
String userName = (String) httpSession.getAttribute("loggedUser");
if (userName != null) {
if (userName != null) {
// User is already logged. Immediately return dashboard
model.addAttribute("username", userName);
return "dashboard";
}
// User wasn't logged and wants to
if (login(user, pass)) { // Correct user-pass
// Validate session and return OK
// Validate session and return OK
// Value stored in HttpSession allows us to identify the user in future requests
httpSession.setAttribute("loggedUser", user);
model.addAttribute("username", user);
// Return dashboard.html template
return "dashboard";
} else { // Wrong user-pass
// Invalidate session and redirect to index.html
httpSession.invalidate();

View File

@ -32,7 +32,6 @@ public class SessionController {
private String OPENVIDU_URL;
// Secret shared with our OpenVidu server
private String SECRET;
public SessionController(@Value("${openvidu.secret}") String secret, @Value("${openvidu.url}") String openviduUrl) {
this.SECRET = secret;
@ -53,7 +52,7 @@ public class SessionController {
// Role associated to this user
OpenViduRole role = LoginController.users.get(httpSession.getAttribute("loggedUser")).role;
// Optional data to be passed to other users when this user connects to the video-call
// In this case, a JSON with the value we stored in the HttpSession object on login
String serverData = "{\"serverData\": \"" + httpSession.getAttribute("loggedUser") + "\"}";
@ -65,10 +64,10 @@ public class SessionController {
// Session already exists
System.out.println("Existing session " + sessionName);
try {
// Generate a new token with the recently created tokenOptions
String token = this.mapSessions.get(sessionName).generateToken(tokenOptions);
// Update our collection storing the new token
this.mapSessionNamesTokens.get(sessionName).put(token, role);
@ -80,7 +79,7 @@ public class SessionController {
// Return session.html template
return "session";
} catch (Exception e) {
// If error just return dashboard.html template
model.addAttribute("username", httpSession.getAttribute("loggedUser"));
@ -90,7 +89,7 @@ public class SessionController {
// New session
System.out.println("New session " + sessionName);
try {
// Create a new OpenVidu Session
Session session = this.openVidu.createSession();
// Generate a new token with the recently created tokenOptions
@ -109,7 +108,7 @@ public class SessionController {
// Return session.html template
return "session";
} catch (Exception e) {
// If error just return dashboard.html template
model.addAttribute("username", httpSession.getAttribute("loggedUser"));
@ -131,7 +130,7 @@ public class SessionController {
// If the session exists ("TUTORIAL" in this case)
if (this.mapSessions.get(sessionName) != null && this.mapSessionNamesTokens.get(sessionName) != null) {
// If the token exists
if (this.mapSessionNamesTokens.get(sessionName).remove(token) != null) {
// User left the session
@ -140,13 +139,13 @@ public class SessionController {
this.mapSessions.remove(sessionName);
}
return "redirect:/dashboard";
} else {
// The TOKEN wasn't valid
System.out.println("Problems in the app server: the TOKEN wasn't valid");
return "redirect:/dashboard";
}
} else {
// The SESSION does not exist
System.out.println("Problems in the app server: the SESSION does not exist");

View File

@ -5,11 +5,11 @@
<groupId>io.openvidu</groupId>
<artifactId>openvidu-recording-java</artifactId>
<version>2.2.0</version>
<version>2.8.0</version>
<packaging>jar</packaging>
<name>openvidu-recording-java</name>
<url>http://maven.apache.org</url>
<url>https://github.com/OpenVidu/openvidu-tutorials/tree/master/openvidu-recording-java</url>
<parent>
<groupId>org.springframework.boot</groupId>
@ -63,7 +63,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
@ -73,7 +72,6 @@
<artifactId>openvidu-java-client</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
@ -107,19 +105,17 @@
<version>23.0</version>
<scope>test</scope>
</dependency>
<!--<dependency> <groupId>com.googlecode.mp4parser</groupId> <artifactId>isoparser</artifactId>
<version>1.1.22</version> <scope>test</scope> </dependency> -->
<!--<dependency> <groupId>net.bramp.ffmpeg</groupId> <artifactId>ffmpeg</artifactId>
<version>0.6.2</version> </dependency> -->
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-all-deps</artifactId>
<version>2.4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>2.4.5</version>
<scope>test</scope>
</dependency>
</dependencies>