Index: lams_launchlearnerurl/.classpath
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/.classpath,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/.classpath 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_launchlearnerurl/.cvsignore
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/.cvsignore,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/.cvsignore 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,2 @@
+build
+bin
Index: lams_launchlearnerurl/.project
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/.project,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/.project 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,17 @@
+
+
+ lams_launchlearnerurl
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
Index: lams_launchlearnerurl/build.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/build.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/build.properties 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,8 @@
+product=ROOT
+
+# Project physical and logical paths
+product.path.java=org.lamsfoundation.lams.launchlearnerurl
+product.path.filesystem=org/lamsfoundation/lams/launchlearnerurl
+
+# Project is a core one, not a Tool
+product.core=true
\ No newline at end of file
Index: lams_launchlearnerurl/build.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/build.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/build.xml 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+ ${ant.project.name}: Deploying WAR
+
+
+
+
+
+
+ ${ant.project.name}: Building WAR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_launchlearnerurl/src/java/org/lamsfoundation/lams/launchlearnerurl/LaunchLearnerUrlServlet.java
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/src/java/org/lamsfoundation/lams/launchlearnerurl/LaunchLearnerUrlServlet.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/src/java/org/lamsfoundation/lams/launchlearnerurl/LaunchLearnerUrlServlet.java 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,94 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: LaunchLearnerUrlServlet.java,v 1.1 2014/11/28 22:26:12 andreyb Exp $ */
+package org.lamsfoundation.lams.launchlearnerurl;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.util.Configuration;
+import org.lamsfoundation.lams.util.ConfigurationKeys;
+
+/**
+ * Decodes lessonId from url and sends redirect to lams learner.
+ *
+ * @author Andrey Balan
+ */
+public class LaunchLearnerUrlServlet extends HttpServlet {
+
+ private static Logger log = Logger.getLogger(LaunchLearnerUrlServlet.class);
+
+ private static final String CODE = "jbdnuteywk";
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // encodedLessonId = "/sqwer"
+ String encodedLessonId = request.getPathInfo();
+ String lamsUrl = Configuration.get(ConfigurationKeys.SERVER_URL);
+
+ // redirect to login page if accessing / URL
+ if (StringUtils.isBlank(encodedLessonId) || encodedLessonId.length() < 2 ) {
+ response.sendRedirect(lamsUrl);
+ return;
+ }
+
+ // cut off the first '/'
+ encodedLessonId = encodedLessonId.substring(1);
+
+ // it should contain now only the characters from that string
+ if (!encodedLessonId.matches("[" + CODE + "]*")) {
+ log.warn("LessonId: " + encodedLessonId + " contains wrong characters.");
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, "LessonId: " + encodedLessonId + " contains wrong characters.");
+ return;
+ }
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(0), '0');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(1), '1');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(2), '2');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(3), '3');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(4), '4');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(5), '5');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(6), '6');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(7), '7');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(8), '8');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(9), '9');
+
+ Long lessonId;
+ try {
+ lessonId = Long.valueOf(encodedLessonId);
+ } catch (NumberFormatException e) {
+ log.warn("LessonId " + encodedLessonId + " is wrong.");
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+
+ String redirectURL = lamsUrl + "launchlearner.do?lessonID=" + lessonId;
+ response.sendRedirect(redirectURL);
+
+ }
+
+}
Index: lams_launchlearnerurl/src/java/org/lamsfoundation/lams/launchlearnerurl/LaunchLearnerUrlServlet2.java
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/src/java/org/lamsfoundation/lams/launchlearnerurl/LaunchLearnerUrlServlet2.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/src/java/org/lamsfoundation/lams/launchlearnerurl/LaunchLearnerUrlServlet2.java 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,97 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: LaunchLearnerUrlServlet2.java,v 1.1 2014/11/28 22:26:12 andreyb Exp $ */
+package org.lamsfoundation.lams.launchlearnerurl;
+
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.util.Configuration;
+import org.lamsfoundation.lams.util.ConfigurationKeys;
+
+/**
+ * Decodes lessonId from url and sends redirect to lams learner.
+ *
+ * @author Andrey Balan
+ */
+public class LaunchLearnerUrlServlet2 extends HttpServlet {
+
+ private static Logger log = Logger.getLogger(LaunchLearnerUrlServlet2.class);
+
+ private static final String CODE = "jbdnuteywk";
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // encodedLessonId = "/sqwer"
+ String encodedLessonId = request.getPathInfo();
+ String lamsUrl = Configuration.get(ConfigurationKeys.SERVER_URL);
+
+ //code should start with "s"
+ if (StringUtils.isBlank(encodedLessonId) || encodedLessonId.length() < 2 ) {//||!(encodedLessonId.charAt(1) == 's')
+ // if not, redirect to login page
+ response.sendRedirect(lamsUrl);
+
+ return;
+ }
+
+ // cut off the first '/'
+ encodedLessonId = encodedLessonId.substring(1);
+
+ // it should contain now only the characters from that string
+ if (!encodedLessonId.matches("[" + CODE + "]*")) {
+ log.warn("LessonId: " + encodedLessonId + " contains wrong characters.");
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, "LessonId: " + encodedLessonId + " contains wrong characters.");
+ return;
+ }
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(0), '0');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(1), '1');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(2), '2');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(3), '3');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(4), '4');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(5), '5');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(6), '6');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(7), '7');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(8), '8');
+ encodedLessonId = encodedLessonId.replace(CODE.charAt(9), '9');
+
+ Long lessonId;
+ try {
+ lessonId = Long.valueOf(encodedLessonId);
+ } catch (NumberFormatException e) {
+ log.warn("LessonId " + encodedLessonId + " is wrong.");
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+
+ String redirectURL = lamsUrl + "launchlearner.do?lessonID=" + lessonId;
+ response.sendRedirect(redirectURL);
+
+ }
+
+}
Index: lams_launchlearnerurl/web/WEB-INF/jboss-web.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/web/WEB-INF/jboss-web.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/web/WEB-INF/jboss-web.xml 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,9 @@
+
+
+
+
+
+ java:/jaas/lams
+
+
+
Index: lams_launchlearnerurl/web/WEB-INF/web.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_launchlearnerurl/web/WEB-INF/web.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_launchlearnerurl/web/WEB-INF/web.xml 28 Nov 2014 22:26:12 -0000 1.1
@@ -0,0 +1,39 @@
+
+
+
+ LAMS
+
+ Learning Activity Management System
+
+
+ LaunchLearnerUrl
+ org.lamsfoundation.lams.launchlearnerurl.LaunchLearnerUrlServlet
+
+ debug
+ 999
+
+
+ detail
+ 2
+
+ 1
+
+
+
+ LaunchLearnerUrl
+ /*
+
+
+
+ 120
+
+
+
+
+
+ Free access Content
+ /*
+
+
+
+