Maximum length of participant metadata (both client and server side) from 1000 to 10000

pull/73/head
pabloFuente 2018-04-05 15:35:26 +02:00
parent 1e63a116c8
commit eb619f3826
3 changed files with 7 additions and 7 deletions

View File

@ -159,7 +159,7 @@ public abstract class SessionManager {
return sessionId;
}
public String newToken(String sessionId, ParticipantRole role, String serverMetadata) {
public String newToken(String sessionId, ParticipantRole role, String serverMetadata) throws OpenViduException {
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null
&& this.sessionidTokenTokenobj.get(sessionId) != null) {
if (isMetadataFormatCorrect(serverMetadata)) {
@ -169,7 +169,7 @@ public abstract class SessionManager {
return token;
} else {
throw new OpenViduException(Code.GENERIC_ERROR_CODE,
"Data invalid format. Max length allowed is 1000 chars");
"Data invalid format. Max length allowed is 10000 chars");
}
} else {
System.out.println("Error: the sessionId [" + sessionId + "] is not valid");
@ -223,8 +223,8 @@ public abstract class SessionManager {
}
public boolean isMetadataFormatCorrect(String metadata) {
// Max 1000 chars
return (metadata.length() <= 1000);
// Max 10000 chars
return (metadata.length() <= 10000);
}
public void newInsecureParticipant(String participantPrivateId) {

View File

@ -140,7 +140,7 @@ public class SessionRestController {
HttpStatus.BAD_REQUEST);
} catch (OpenViduException e) {
return this.generateErrorResponse(
"Metadata [" + params.get("data") + "] unexpected format. Max length allowed is 1000 chars",
"Metadata [" + params.get("data") + "] unexpected format. Max length allowed is 10000 chars",
"/api/tokens", HttpStatus.BAD_REQUEST);
}
}

View File

@ -157,9 +157,9 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
sessionManager.joinRoom(participant, sessionId, request.getId());
} else {
log.error("ERROR: Metadata format is incorrect");
log.error("ERROR: Metadata format set in client-side is incorrect");
throw new OpenViduException(Code.USER_METADATA_FORMAT_INVALID_ERROR_CODE,
"Unable to join room. The metadata received has an invalid format");
"Unable to join room. The metadata received from the client-side has an invalid format (max length allowed is 10000 chars)");
}
} else {
log.error("ERROR: sessionId or token not valid");