diff --git a/bbb-api-demo/build.gradle b/bbb-api-demo/build.gradle index 7418e054f49572c09db134fc2b49c4fffea997e3..90f9333820a0721bb6deb6fa9493c68fbf312506 100755 --- a/bbb-api-demo/build.gradle +++ b/bbb-api-demo/build.gradle @@ -20,4 +20,5 @@ dependencies { compile group: 'commons-codec', name: 'commons-codec', version: '1.4' compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.2' + compile group: 'commons-io', name: 'commons-io', version: '2.0' } diff --git a/bbb-api-demo/src/main/webapp/bbb_api_conf.jsp b/bbb-api-demo/src/main/webapp/bbb_api_conf.jsp index c98d0a16194367c1f9c18a2af99adc0d912f2aaa..e2edb2c8eb994ab751c096608430a7756b1964de 100755 --- a/bbb-api-demo/src/main/webapp/bbb_api_conf.jsp +++ b/bbb-api-demo/src/main/webapp/bbb_api_conf.jsp @@ -3,7 +3,7 @@ // This is the security salt that must match the value set in the BigBlueButton server //String salt = "4951c2aea43e5af6d9598610b9e0b6c7"; //String salt = "5e5ff0968546b8aaacce0462a99bca30"; -String salt = "5e5ff0968546b8aaacce0462a99bca30"; +String salt = "c9181cea77a2f2a4c93a0e17d723b942"; // This is the URL for the BigBlueButton server 4951c2aea43e5af6d9598610b9e0b6c7 String BigBlueButtonURL = "http://192.168.0.104/bigbluebutton/"; %> diff --git a/bbb-api-demo/src/main/webapp/demo7.jsp b/bbb-api-demo/src/main/webapp/demo7.jsp index bdb12b802b86e9c2753b940cecf4c433ed775b51..ba1f899c60a036cb0ca299d4890639632a0ef2dd 100755 --- a/bbb-api-demo/src/main/webapp/demo7.jsp +++ b/bbb-api-demo/src/main/webapp/demo7.jsp @@ -1,120 +1,120 @@ -<html> - <head><title>Preupload Presentation</title></head></p> <p> - <body> - <%@ include file="bbb_api.jsp"%> - <%@ include file="demo_header.jsp"%> - -<h2>Demo #5: Upload a presentation before joining a Course...</h2> - <form action="demo5.jsp" method="post" enctype - ="multipart/form-data" name="form1" id="form1"> - <table cellpadding="5" cellspacing="5" style="width: 400px;"> - <tbody> - <tr> - <td> </td> - <td style="text-align: right;">Full Name:</td> - <td style="width: 5px;"> </td> - <td style="text-align: left"><input type="text" - name="username" /> - </td> - </tr> - - <tr> - <td> </td> - <td style="text-align: left">Upload File:</td> - <td style="width: 5px;"> </td> - <td style="text-align: left"><input type="file" - name="filename" /><!-- <input type="submit" />--> - </td> - </tr> - - <tr> - <td> </td> - <td> </td> - <td> </td> - <td><input type="submit" value="Join" /> - </td> - </tr> - </tbody> - </table> - <INPUT TYPE=hidden NAME=action VALUE="create"> - </form> - </body> -</html> - - <%@ page import="java.util.List" %> - <%@ page import="java.util.Iterator" %> - <%@ page import="java.io.File" %> - <%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%> - <%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%> - <%@ page import="org.apache.commons.fileupload.*"%> - <%@ page contentType="text/html;charset=UTF-8" language="java" %> - <%@page import="sun.security.provider.SHA"%> - <%@page import="org.apache.commons.codec.binary.Base64"%> - <%@page import="java.security.MessageDigest"%> - <% - String uname=""; - boolean isMultipart = ServletFileUpload.isMultipartContent(request); - - if (!isMultipart) { - } - else { - FileItemFactory factory = new DiskFileItemFactory(); - ServletFileUpload upload = new ServletFileUpload(factory); - List<FileItem> items = null; - try { - items = upload.parseRequest(request); - } catch (FileUploadException e) { - e.printStackTrace(); - } - out.print(items.size()); - Iterator<FileItem> itr = items.iterator(); - while (itr.hasNext()) { - FileItem item = (FileItem) itr.next(); - String xml = null; - xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='http://www.samplepdf.com/sample.pdf' /> </module></modules>"; - if (item.isFormField()) - { - String name = item.getFieldName(); - String value = item.getString(); - if(name.equals("username")) - { - uname=value; - } - } else { - try { - - String itemName = item.getName(); - - if(itemName==""){ - xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='http://www.samplepdf.com/sample.pdf' /> </module></modules>"; - } - else { - byte[] b = item.get(); - String encoded = Base64.encodeBase64String(b); - xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name=\"presentation\"> <document name=\""+itemName+"\">"+encoded+"\"</document> </module></modules>"; - } - } catch (Exception e) { - e.printStackTrace(); - } - - String joinURL = getJoinURLXML(uname, "Demo Meeting", "Presentation should be uploaded. It was uploaded as an encoded file", xml ); - if (joinURL.startsWith("http://")) { - %> - <center><h1>Your presentation has been Uploaded</h1></center> - <script language="javascript" type="text/javascript"> - window.location.href="<%=joinURL%>"; - </script> - - <% - } else { - %> - - Error: getJoinURL() failed - <p /> - <%=joinURL %> - <% - } - } - } - } - %> +<html> + <head><title>Preupload Presentation</title></head></p> <p> + <body> + <%@ include file="bbb_api.jsp"%> + <%@ include file="demo_header.jsp"%> + +<h2>Demo #7: Upload a presentation before joining a Course...</h2> + <form action="demo7.jsp" method="post" enctype + ="multipart/form-data" name="form1" id="form1"> + <table cellpadding="5" cellspacing="5" style="width: 400px;"> + <tbody> + <tr> + <td> </td> + <td style="text-align: right;">Full Name:</td> + <td style="width: 5px;"> </td> + <td style="text-align: left"><input type="text" + name="username" /> + </td> + </tr> + + <tr> + <td> </td> + <td style="text-align: left">Upload File:</td> + <td style="width: 5px;"> </td> + <td style="text-align: left"><input type="file" + name="filename" /><!-- <input type="submit" />--> + </td> + </tr> + + <tr> + <td> </td> + <td> </td> + <td> </td> + <td><input type="submit" value="Join" /> + </td> + </tr> + </tbody> + </table> + <INPUT TYPE=hidden NAME=action VALUE="create"> + </form> + </body> +</html> + + <%@ page import="java.util.List" %> + <%@ page import="java.util.Iterator" %> + <%@ page import="java.io.File" %> + <%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%> + <%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%> + <%@ page import="org.apache.commons.fileupload.*"%> + <%@ page contentType="text/html;charset=UTF-8" language="java" %> + <%@page import="sun.security.provider.SHA"%> + <%@page import="org.apache.commons.codec.binary.Base64"%> + <%@page import="java.security.MessageDigest"%> + <% + String uname=""; + boolean isMultipart = ServletFileUpload.isMultipartContent(request); + + if (!isMultipart) { + } + else { + FileItemFactory factory = new DiskFileItemFactory(); + ServletFileUpload upload = new ServletFileUpload(factory); + List<FileItem> items = null; + try { + items = upload.parseRequest(request); + } catch (FileUploadException e) { + e.printStackTrace(); + } + out.print(items.size()); + Iterator<FileItem> itr = items.iterator(); + while (itr.hasNext()) { + FileItem item = (FileItem) itr.next(); + String xml = null; + xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='http://www.samplepdf.com/sample.pdf' /> </module></modules>"; + if (item.isFormField()) + { + String name = item.getFieldName(); + String value = item.getString(); + if(name.equals("username")) + { + uname=value; + } + } else { + try { + + String itemName = item.getName(); + + if(itemName==""){ + xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='http://www.samplepdf.com/sample.pdf' /> </module></modules>"; + } + else { + byte[] b = item.get(); + String encoded = Base64.encodeBase64String(b); + xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name=\"presentation\"> <document name=\""+itemName+"\">"+encoded+"\"</document> </module></modules>"; + } + } catch (Exception e) { + e.printStackTrace(); + } + + String joinURL = getJoinURLXML(uname, "Demo Meeting", "Presentation should be uploaded. It was uploaded as an encoded file", xml ); + if (joinURL.startsWith("http://")) { + %> + <center><h1>Your presentation has been Uploaded</h1></center> + <script language="javascript" type="text/javascript"> + window.location.href="<%=joinURL%>"; + </script> + + <% + } else { + %> + + Error: getJoinURL() failed + <p /> + <%=joinURL %> + <% + } + } + } + } + %> diff --git a/bbb-api-demo/src/main/webapp/demo8.jsp b/bbb-api-demo/src/main/webapp/demo8.jsp index 1d820cb697780a2110f9e59c7e9dd1a359483fe5..79d5732a2eece60d7ea4b895f256b0b6eef64c04 100755 --- a/bbb-api-demo/src/main/webapp/demo8.jsp +++ b/bbb-api-demo/src/main/webapp/demo8.jsp @@ -1,112 +1,112 @@ -<html> - <head><title>Preupload Presentation</title></head></p> <p> - <body> - <%@ include file="bbb_api.jsp"%> - <%@ include file="demo_header.jsp"%> -<% -String fileURL = BigBlueButtonURL.replace("/bigbluebutton",":8080/demo"); -String name1="Demo123.pdf"; -String name2="Demo456.pdf"; -String name3="Demo789.pdf"; -%> - -<h2>Demo #6: Send a presentation URL before joining a Course...</h2> - <form action="demo6.jsp" method="post" enctype - ="multipart/form-data" name="form1" id="form1"> - <table cellpadding="5" cellspacing="5" style="width: 400px;"> - <tbody> - <tr> - <td> </td> - <td style="text-align: right;">Full Name:</td> - <td style="width: 5px;"> </td> - <td style="text-align: left"><input type="text" - name="username" /> - </td> - </tr> - - <tr> - <td> </td> - <td style="text-align: right">File Name:</td> - <td style="width: 5px;"> </td> - <td><select name=filename> - <option value=<%=name1%>><%=name1.substring(0,name1.length()-4)%></option> - <option value=<%=name2%>><%=name2.substring(0,name2.length()-4)%></option> - <option value=<%=name3%>><%=name3.substring(0,name3.length()-4)%></option> - </select> - </td> - </tr> - - <tr> - <td> </td> - <td> </td> - <td> </td> - <td><input type="submit" value="Join" /> - </td> - </tr> - </tbody> - </table> - <INPUT TYPE=hidden NAME=action VALUE="create"> - </form> - </body> -</html> - - <%@ page import="java.util.List" %> - <%@ page import="java.util.Iterator" %> - <%@ page import="java.io.File" %> - <%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%> - <%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%> - <%@ page import="org.apache.commons.fileupload.*"%> - <%@ page contentType="text/html;charset=UTF-8" language="java" %> - <%@page import="sun.security.provider.SHA"%> - <%@page import="org.apache.commons.codec.binary.Base64"%> - <%@page import="java.security.MessageDigest"%> - <% - - String uname=""; - String fname=""; - boolean isMultipart = ServletFileUpload.isMultipartContent(request); - - if (!isMultipart) { - } - else { - FileItemFactory factory = new DiskFileItemFactory(); - ServletFileUpload upload = new ServletFileUpload(factory); - List<FileItem> items = null; - try { - items = upload.parseRequest(request); - } catch (FileUploadException e) { - e.printStackTrace(); - } - Iterator<FileItem> itr = items.iterator(); - String xml = null; - while (itr.hasNext()) { - FileItem item = (FileItem) itr.next(); - String name = item.getFieldName(); - String value = item.getString(); - if(name.equals("username")) { - uname=value; - } - if(name.equals("filename")) { - fname=value; - } - } - xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='"+fileURL+fname+"' /> </module></modules>"; - String joinURL = getJoinURLXML(uname, "Demo Meeting", "Presentation URL should be passed.", xml ); - if (joinURL.startsWith("http://")) { - %> - <center><h1>Your presentation URL has been passed</h1></center> - <script language="javascript" type="text/javascript"> - window.location.href="<%=joinURL%>"; - </script> - - <% - } else { - %> - - Error: getJoinURL() failed - <p /> - <%=joinURL %> - <% - } -} -%> +<html> + <head><title>Preupload Presentation</title></head></p> <p> + <body> + <%@ include file="bbb_api.jsp"%> + <%@ include file="demo_header.jsp"%> +<% +String fileURL = BigBlueButtonURL.replace("/bigbluebutton",":8080/demo"); +String name1="Demo123.pdf"; +String name2="Demo456.pdf"; +String name3="Demo789.pdf"; +%> + +<h2>Demo #8: Send a presentation URL before joining a Course...</h2> + <form action="demo8.jsp" method="post" enctype + ="multipart/form-data" name="form1" id="form1"> + <table cellpadding="5" cellspacing="5" style="width: 400px;"> + <tbody> + <tr> + <td> </td> + <td style="text-align: right;">Full Name:</td> + <td style="width: 5px;"> </td> + <td style="text-align: left"><input type="text" + name="username" /> + </td> + </tr> + + <tr> + <td> </td> + <td style="text-align: right">File Name:</td> + <td style="width: 5px;"> </td> + <td><select name=filename> + <option value=<%=name1%>><%=name1.substring(0,name1.length()-4)%></option> + <option value=<%=name2%>><%=name2.substring(0,name2.length()-4)%></option> + <option value=<%=name3%>><%=name3.substring(0,name3.length()-4)%></option> + </select> + </td> + </tr> + + <tr> + <td> </td> + <td> </td> + <td> </td> + <td><input type="submit" value="Join" /> + </td> + </tr> + </tbody> + </table> + <INPUT TYPE=hidden NAME=action VALUE="create"> + </form> + </body> +</html> + + <%@ page import="java.util.List" %> + <%@ page import="java.util.Iterator" %> + <%@ page import="java.io.File" %> + <%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%> + <%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%> + <%@ page import="org.apache.commons.fileupload.*"%> + <%@ page contentType="text/html;charset=UTF-8" language="java" %> + <%@page import="sun.security.provider.SHA"%> + <%@page import="org.apache.commons.codec.binary.Base64"%> + <%@page import="java.security.MessageDigest"%> + <% + + String uname=""; + String fname=""; + boolean isMultipart = ServletFileUpload.isMultipartContent(request); + + if (!isMultipart) { + } + else { + FileItemFactory factory = new DiskFileItemFactory(); + ServletFileUpload upload = new ServletFileUpload(factory); + List<FileItem> items = null; + try { + items = upload.parseRequest(request); + } catch (FileUploadException e) { + e.printStackTrace(); + } + Iterator<FileItem> itr = items.iterator(); + String xml = null; + while (itr.hasNext()) { + FileItem item = (FileItem) itr.next(); + String name = item.getFieldName(); + String value = item.getString(); + if(name.equals("username")) { + uname=value; + } + if(name.equals("filename")) { + fname=value; + } + } + xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='"+fileURL+fname+"' /> </module></modules>"; + String joinURL = getJoinURLXML(uname, "Demo Meeting", "Presentation URL should be passed.", xml ); + if (joinURL.startsWith("http://")) { + %> + <center><h1>Your presentation URL has been passed</h1></center> + <script language="javascript" type="text/javascript"> + window.location.href="<%=joinURL%>"; + </script> + + <% + } else { + %> + + Error: getJoinURL() failed + <p /> + <%=joinURL %> + <% + } +} +%>