diff --git a/bigbluebutton-web/web-app/demo/bbb_api.jsp b/bigbluebutton-web/web-app/demo/bbb_api.jsp index b35488b195..fd466ce7c5 100755 --- a/bigbluebutton-web/web-app/demo/bbb_api.jsp +++ b/bigbluebutton-web/web-app/demo/bbb_api.jsp @@ -28,31 +28,33 @@ Author: Fred Dixon <%@ include file="bbb_api_conf.jsp"%> <%! -// -// Create a meeting that does not require passwords -// -public String getJoinURL(String username, String meetingID) { - - String checksum = ""; +// +// Create a meeting and return a URL to join it +// +public String getJoinURL(String username, String meetingID, String welcome) { String base_url_create = BigBlueButtonURL + "api/create?"; String base_url_join = BigBlueButtonURL + "api/join?"; - Random random = new Random(); - Integer voiceBridge = 70000 + random.nextInt(79999); + String welcome_param = ""; + String checksum = ""; - String create_parameters = "name=" + username + "&meetingID=" + meetingID - + "&attendeePW=ap&moderatorPW=mp&voiceBridge="+voiceBridge; - + Random random = new Random(); + Integer voiceBridge = 70000 + random.nextInt(9999); + + if ( (welcome != null) && ! welcome.equals("")) { + welcome_param = "&welcome=" + urlEncode(welcome); + } + + String create_parameters = "name=" + urlEncode(username) + "&meetingID=" + urlEncode(meetingID) + + welcome_param + "&attendeePW=ap&moderatorPW=mp&voiceBridge="+voiceBridge; Document doc = null; try { // Attempt to create a meeting of that name - String xml = getURL(base_url_create + create_parameters + "&checksum=" + checksum(create_parameters + salt) ); - doc = parseXml(xml); - + doc = parseXml(xml); } catch (Exception e) { e.printStackTrace(); } @@ -73,13 +75,15 @@ public String getJoinURL(String username, String meetingID) { return base_url_join + join_parameters + "&checksum=" + checksum(join_parameters + salt); } - return ""; + return doc.getElementsByTagName("messageKey").item(0).getTextContent().trim() + + ": " + doc.getElementsByTagName("message").item(0).getTextContent().trim(); } public static String checksum(String s) { String checksum = ""; try { - checksum = DigestUtils.shaHex(s); + checksum = org.apache.commons.codec.digest.DigestUtils.shaHex(s); + // checksum = DigestUtils.shaHex(s); } catch (Exception e) { e.printStackTrace(); } @@ -188,4 +192,15 @@ public String getJoinURL(String username, String meetingID) { DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(new InputSource(new StringReader(xml))); return doc; - }%> + } + + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } + return ""; + } +%> diff --git a/bigbluebutton-web/web-app/demo/demo1.jsp b/bigbluebutton-web/web-app/demo/demo1.jsp index a2364e0bea..59b53124ca 100755 --- a/bigbluebutton-web/web-app/demo/demo1.jsp +++ b/bigbluebutton-web/web-app/demo/demo1.jsp @@ -26,7 +26,7 @@ Author: Fred Dixon -BigBlueButton API Demos +Join a Course @@ -39,12 +39,11 @@ if (request.getParameterMap().isEmpty()) { // // Assume we want to create a meeting // - %> + %> +Join a Course | Join a Selected Course | Create Your Own Meeting | Home + +

Demo #1: Join a Course

-Join a Meeting | Join a Selected Meeting | Create Your Own Meeting and Invite Others | Home -
-

Demo #1: Join the Demo Meeting.

-
@@ -55,7 +54,7 @@ if (request.getParameterMap().isEmpty()) { -

Join Demo Meeting +

Join a Course. Enter your name:
@@ -75,24 +74,28 @@ if (request.getParameterMap().isEmpty()) { // Got an action=create // - String username = URLEncoder.encode(request.getParameter("username"),"UTF-8"); - String meetingID = URLEncoder.encode("Demo Meeting","UTF-8"); - String joinURL = getJoinURL(username, meetingID); + // + // Request a URL to join a meeting called "Demo Meeting" + // Pass null for welcome message to use the default message (see defaultWelcomeMessage in bigbluebutton.properties) + // + String joinURL = getJoinURL(request.getParameter("username"), "Demo Meeting", null ); - if ("".equals(joinURL)) { + if (joinURL.startsWith("http://")) { %> -Error: getJoinURL() returned an empty URL + <% } else { %> - +Error: getJoinURL() failed +

+<%=joinURL %> -<% +<% } } %> diff --git a/bigbluebutton-web/web-app/demo/demo2.jsp b/bigbluebutton-web/web-app/demo/demo2.jsp index 9ce2e5c7e2..8d7676b2c6 100755 --- a/bigbluebutton-web/web-app/demo/demo2.jsp +++ b/bigbluebutton-web/web-app/demo/demo2.jsp @@ -26,26 +26,30 @@ Author: Fred Dixon -BigBlueButton API Demos +Join a Selected Course <%@ include file="bbb_api.jsp"%> -<%@ include file="demo_header.jsp"%> -
-<% -if (request.getParameterMap().isEmpty()) { - // - // Assume we want to create a meeting - // - %> +<% + if (request.getParameterMap().isEmpty()) { + // + // Assume we want to create a meeting + // +%> +Join a Course +| +Join a Selected Course +| +Create Your Own Meeting +| +Home + +

Demo #2: Join a Selected Course

-
-

Demo #2: Join a Selected Meeting.

-
@@ -54,24 +58,22 @@ if (request.getParameterMap().isEmpty()) { border=3> - Join a selected meeting. - + Join a Selected Course. -

Enter your name:
- +

Enter your name:
+ -

Meeting:  -

-
- +


+ + @@ -79,32 +81,32 @@ if (request.getParameterMap().isEmpty()) {

<% -} else if (request.getParameter("action").equals("create")) { - // - // Got an action=create - // - - String username = URLEncoder.encode(request.getParameter("username"),"UTF-8"); - String meetingID = URLEncoder.encode(request.getParameter("meetingID"),"UTF-8"); - - String joinURL = getJoinURL(username, meetingID); + } else if (request.getParameter("action").equals("create")) { + // + // Got an action=create + // - if ("".equals(joinURL)) { -%> - Error: getJoinURL() returned an empty URL -<% - } else { + String username = request.getParameter("username"); + String meetingID = request.getParameter("meetingID"); + + String joinURL = getJoinURL(username, meetingID, "Welcome %%CONFNAME%%." ); + + if (joinURL.startsWith("http://")) { %> -<% } -} %> - -<%@ include file="demo_footer.jsp"%> +<% + } else { +%> +Error: getJoinURL() failed +

<%=joinURL%> <% + } + } + %> <%@ include file="demo_footer.jsp"%> - - + + diff --git a/bigbluebutton-web/web-app/demo/demo3.jsp b/bigbluebutton-web/web-app/demo/demo3.jsp index 0bb711fb0e..21377b36ae 100755 --- a/bigbluebutton-web/web-app/demo/demo3.jsp +++ b/bigbluebutton-web/web-app/demo/demo3.jsp @@ -26,7 +26,7 @@ Author: Fred Dixon -API Demo - 3 +Create Your Own Meeting @@ -38,22 +38,25 @@ Author: Fred Dixon <%@ include file="bbb_api.jsp"%> -<%@ include file="demo_header.jsp"%> - <%@ page import="java.util.regex.*"%>
-<% -if (request.getParameterMap().isEmpty()) { - // - // Assume we want to create a meeting - // - %> +<% + if (request.getParameterMap().isEmpty()) { + // + // Assume we want to create a meeting + // +%> +Join a Course +| +Join a Selected Course +| +Create Your Own Meeting +| +Home -


-

Demo #3: Create a You Own Meeting.

-
+

Demo #3: Create Your Own Meeting

@@ -77,6 +80,10 @@ if (request.getParameterMap().isEmpty()) {
<% -} else if (request.getParameter("action").equals("create")) { - // - // User has requested to create a meeting - // - - String username = request.getParameter("username1"); - String meetingID = URLEncoder.encode(username+"'s meeting","UTF-8"); + } else if (request.getParameter("action").equals("create")) { + // + // User has requested to create a meeting + // - String meetingToken = ""; - - String joinURL = getJoinURL(URLEncoder.encode(username,"UTF-8"), meetingID); + String username = request.getParameter("username1"); + String meetingID = username + "'s meeting"; - String p = "meetingToken=[^&]*"; - Pattern pattern = - Pattern.compile( p ); + String meetingToken = ""; - Matcher matcher = - pattern.matcher( joinURL ); - - if (matcher.find()) { - meetingToken = joinURL.substring(matcher.start(), matcher.end()); - } else { - out.print("Error: Did not find meeting token."); - } - //out.print ("Match : " + meetingToken ); - String inviteURL = BigBlueButtonURL+"demo/demo3.jsp?action=invite&meetingID="+meetingID+"&"+meetingToken; - - %> + // + // This is the URL for to join the meeting as moderator + // + String joinURL = getJoinURL(username, meetingID, "Welcome to " + + meetingID); + + // + // We're going to extract the meetingToken to enable others to join as viewers + // + String p = "meetingToken=[^&]*"; + Pattern pattern = Pattern.compile(p); + Matcher matcher = pattern.matcher(joinURL); + + if (matcher.find()) { + meetingToken = joinURL.substring(matcher.start(), matcher + .end()); + } else { + out.print("Error: Did not find meeting token."); + } + //out.print ("Match : " + meetingToken ); + String inviteURL = BigBlueButtonURL + + "demo/demo3.jsp?action=invite&meetingID=" + URLEncoder.encode(meetingID, "UTF-8") + + "&" + meetingToken; +%>

Meeting Created

@@ -129,21 +142,20 @@ $(document).ready(function(){ -
<%=username %>'s meeting has been +
<%=username%>'s meeting has been created.
-

 

- - Step 2. Invite others using the following link: +

 

+ + Step 2. Invite others using the following link:
-

 

- Step 3. Click the following link to start your meeting: +

  +

Step 3. Click the following link to start your meeting:

 

Start Meeting

 

@@ -160,34 +172,36 @@ $(document).ready(function(){ <% - -} else if (request.getParameter("action").equals("enter")) { - // - // The user is now attempting to joing the meeting - // - String meetingID = request.getParameter("meetingID"); - String username = request.getParameter("username"); - String meetingToken = request.getParameter("meetingToken"); - - String enterURL = BigBlueButtonURL+"demo/demo3.jsp?action=join&username="+URLEncoder.encode(username,"UTF-8")+"&meetingID="+URLEncoder.encode(meetingID,"UTF-8"); - - - if ( isMeetingRunning( meetingToken, URLEncoder.encode(meetingID,"UTF-8")).equals("true") ) { + } else if (request.getParameter("action").equals("enter")) { // - // The meeting has started -- bring the user into the meeting. + // The user is now attempting to joing the meeting // - %> + String meetingID = request.getParameter("meetingID"); + String username = request.getParameter("username"); + String meetingToken = request.getParameter("meetingToken"); + + String enterURL = BigBlueButtonURL + + "demo/demo3.jsp?action=join&username=" + + URLEncoder.encode(username, "UTF-8") + "&meetingID=" + + URLEncoder.encode(meetingID, "UTF-8"); + + if (isMeetingRunning(meetingToken, + URLEncoder.encode(meetingID, "UTF-8")).equals("true")) { + // + // The meeting has started -- bring the user into the meeting. + // +%> -<% +<% } else { - // - // The meeting has not yet started, so check until we get back the status that the meeting is running - // - String checkMeetingStatus = getURLisMeetingRunning(meetingToken, URLEncoder.encode(meetingID,"UTF-8") ); - - %> + // + // The meeting has not yet started, so check until we get back the status that the meeting is running + // + String checkMeetingStatus = getURLisMeetingRunning( + meetingToken, URLEncoder.encode(meetingID, "UTF-8")); +%>
-

<%=meetingID %> has not yet started.

+

<%=meetingID%> has not yet started.


@@ -222,10 +236,11 @@ function mycallback() { -

Hi <%=username %>,

-

Now waiting for the moderator to start <%=meetingID %>.

+

Hi <%=username%>,

+

Now waiting for the moderator to start <%=meetingID%>.


-

(Your browser will automatically refresh and join the meeting when it starts.)

+

(Your browser will automatically refresh and join the meeting + when it starts.)

@@ -235,16 +250,14 @@ function mycallback() { <% } -} else if (request.getParameter("action").equals("invite")) { - // - // We have an invite to an active meeting. Ask the person for their name - // so they can join. - // - String meetingID = request.getParameter("meetingID"); - String meetingToken = request.getParameter("meetingToken"); - - - %> + } else if (request.getParameter("action").equals("invite")) { + // + // We have an invite to an active meeting. Ask the person for their name + // so they can join. + // + String meetingID = request.getParameter("meetingID"); + String meetingToken = request.getParameter("meetingToken"); +%>

Invite

@@ -259,13 +272,14 @@ function mycallback() { -

You have been invited to join
<%=meetingID %>. +

You have been invited to join
+ <%=meetingID%>. Enter your name:
-
@@ -278,20 +292,32 @@ function mycallback() { <% -} else if (request.getParameter("action").equals("join")) { - // - // We have an invite request to join an existing meeting and the meeting is running - // - String username = URLEncoder.encode(request.getParameter("username"),"UTF-8"); - String meetingID = URLEncoder.encode(request.getParameter("meetingID"),"UTF-8"); - String joinURL = getJoinURL(username, meetingID); - %> + } else if (request.getParameter("action").equals("join")) { + // + // We have an invite request to join an existing meeting and the meeting is running + // + // We don't need to pass a meeting descritpion as it's already been set by the first time + // the meeting was created. + String joinURL = getJoinURL(request.getParameter("username"), request.getParameter("meetingID"), null); + + if (joinURL.startsWith("http://")) { +%> -<% } %> +<% + } else { +%> + +Error: getJoinURL() failed +

<%=joinURL%> + +<% + } + } + %> <%@ include file="demo_footer.jsp"%> diff --git a/bigbluebutton-web/web-app/demo/error.jsp b/bigbluebutton-web/web-app/demo/error.jsp index 4385403886..fffb2c7c1c 100755 --- a/bigbluebutton-web/web-app/demo/error.jsp +++ b/bigbluebutton-web/web-app/demo/error.jsp @@ -1,120 +1,121 @@ -<%@ page isErrorPage="true" %> -<%@ page language="java" %> -<%@ page import="java.util.*,java.io.*" %> -<% - Object statusCode = request.getAttribute("javax.servlet.error.status_code"); - Object exceptionType = request.getAttribute("javax.servlet.error.exception_type"); - Object message = request.getAttribute("javax.servlet.error.message"); -%> - - - - -Error Page - - - -

Home

-
-

An Error has occured:

- - - - - - - - - - - - - - - - - - - - - - -
Status Code<%= statusCode %>
Exception Type<%= exceptionType %>
Message<%= message %>
Exception - <% - if( exception != null ) - { - out.print("
");
-		    exception.printStackTrace(new PrintWriter(out));
-		    out.print("
"); - } - %> -
Root Cause - <% - if( (exception != null) && (exception instanceof ServletException) ) - { - Throwable cause = ((ServletException)exception).getRootCause(); - if( cause != null ) - { - out.print("
");
-			cause.printStackTrace(new PrintWriter(out));
-			out.print("
"); - } - } - %> -
- -
-Header List - - - - - -<% -String name = ""; -String value = ""; - -java.util.Enumeration headers = request.getHeaderNames(); -while(headers.hasMoreElements()) -{ - name = (String) headers.nextElement(); - value = request.getHeader(name); -%> - - - - -<% -} -%> -
NameValue
<%=name%><%=value%>
- -Attribute List - - -<% -java.util.Enumeration attributes = request.getAttributeNames(); -while(attributes.hasMoreElements()) -{ - name = (String) attributes.nextElement(); - - if (request.getAttribute(name) == null) - { - value = "null"; - } - else - { - value = request.getAttribute(name).toString(); - } -%> - - - - -<% -} -%> -
<%=name%><%=value%>
- - - +<%@ page isErrorPage="true" %> +<%@ page language="java" %> +<%@ page import="java.util.*" %> +<%@ page import="java.io.*" %> + +<% + Object statusCode = request.getAttribute("javax.servlet.error.status_code"); + Object exceptionType = request.getAttribute("javax.servlet.error.exception_type"); + Object message = request.getAttribute("javax.servlet.error.message"); +%> + + + +Error Page + + + +

Home

+
+

An Error has occured:

+ + + + + + + + + + + + + + + + + + + + + + +
Status Code<%= statusCode %>
Exception Type<%= exceptionType %>
Message<%= message %>
Exception + <% + if( exception != null ) + { + out.print("
");
+		    exception.printStackTrace(new PrintWriter(out));
+		    out.print("
"); + } + %> +
Root Cause + <% + if( (exception != null) && (exception instanceof ServletException) ) + { + Throwable cause = ((ServletException)exception).getRootCause(); + if( cause != null ) + { + out.print("
");
+			cause.printStackTrace(new PrintWriter(out));
+			out.print("
"); + } + } + %> +
+ +
+Header List + + + + + +<% +String name = ""; +String value = ""; + +java.util.Enumeration headers = request.getHeaderNames(); +while(headers.hasMoreElements()) +{ + name = (String) headers.nextElement(); + value = request.getHeader(name); +%> + + + + +<% +} +%> +
NameValue
<%=name%><%=value%>
+ +Attribute List + + +<% +java.util.Enumeration attributes = request.getAttributeNames(); +while(attributes.hasMoreElements()) +{ + name = (String) attributes.nextElement(); + + if (request.getAttribute(name) == null) + { + value = "null"; + } + else + { + value = request.getAttribute(name).toString(); + } +%> + + + + +<% +} +%> +
<%=name%><%=value%>
+ + + \ No newline at end of file