Index: lams_bb_integration/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/.classpath,v diff -u -r1.3 -r1.4 --- lams_bb_integration/.classpath 20 Jul 2012 17:05:20 -0000 1.3 +++ lams_bb_integration/.classpath 17 Sep 2015 02:09:07 -0000 1.4 @@ -12,5 +12,6 @@ + Index: lams_bb_integration/RELEASE_NOTES.TXT =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/RELEASE_NOTES.TXT,v diff -u -r1.21 -r1.22 --- lams_bb_integration/RELEASE_NOTES.TXT 7 Aug 2015 03:24:10 -0000 1.21 +++ lams_bb_integration/RELEASE_NOTES.TXT 17 Sep 2015 02:09:07 -0000 1.22 @@ -100,3 +100,7 @@ ==================== * LDEV-3526: Switch webservice calls to POST. * LDEV-3456: Adding support for a type field to categorise designs. + +1.2.14 Release Fixes +==================== +* LDEV-3526: Adding further POST support. Index: lams_bb_integration/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/build.xml,v diff -u -r1.20 -r1.21 --- lams_bb_integration/build.xml 7 Aug 2015 03:24:10 -0000 1.20 +++ lams_bb_integration/build.xml 17 Sep 2015 02:09:07 -0000 1.21 @@ -2,7 +2,7 @@ - + Index: lams_bb_integration/WEB-INF/bb-manifest.xml =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/WEB-INF/bb-manifest.xml,v diff -u -r1.25 -r1.26 --- lams_bb_integration/WEB-INF/bb-manifest.xml 7 Aug 2015 03:24:10 -0000 1.25 +++ lams_bb_integration/WEB-INF/bb-manifest.xml 17 Sep 2015 02:09:07 -0000 1.26 @@ -5,7 +5,7 @@ - + Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java,v diff -u -r1.1 -r1.2 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java 20 Jul 2015 01:10:20 -0000 1.1 +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java 17 Sep 2015 02:09:07 -0000 1.2 @@ -45,7 +45,14 @@ private static final long serialVersionUID = -351131323404991332L; public void doGet(HttpServletRequest request, HttpServletResponse response) { - + process(request, response); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) { + process(request, response); + } + + protected void process(HttpServletRequest request, HttpServletResponse response) { String serverAddr = LamsSecurityUtil.getServerAddress(); String serverId = LamsSecurityUtil.getServerID(); Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java,v diff -u -r1.4 -r1.5 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java 7 Aug 2015 03:24:10 -0000 1.4 +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java 17 Sep 2015 02:09:07 -0000 1.5 @@ -32,10 +32,13 @@ import org.lamsfoundation.ld.integration.Constants; import blackboard.base.InitializationException; +import blackboard.data.user.User; import blackboard.platform.BbServiceException; import blackboard.platform.BbServiceManager; import blackboard.platform.context.Context; import blackboard.platform.context.ContextManager; +import blackboard.platform.context.ContextManagerFactory; +import blackboard.platform.context.UserContext; /** * Makes a call to LAMS server to get learning designs and returns it. @@ -45,7 +48,14 @@ private static final long serialVersionUID = -351131323404991332L; public void doGet(HttpServletRequest request, HttpServletResponse response) { - + process(request, response); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) { + process(request, response); + } + + protected void process(HttpServletRequest request, HttpServletResponse response) { String serverAddr = LamsSecurityUtil.getServerAddress(); String serverId = LamsSecurityUtil.getServerID(); @@ -75,10 +85,30 @@ ContextManager ctxMgr = null; Context ctx = null; try { - // get Blackboard context + // In some instances of calling this servlet, the user is missing from the context. Try a few different ways to ensure we have the user! + User user = null; + ctxMgr = (ContextManager) BbServiceManager.lookupService(ContextManager.class); ctx = ctxMgr.setContext(request); + if ( ctx != null ) { + user = ctx.getUser(); + } + if ( user == null ) { + ctxMgr = ContextManagerFactory.getInstance(); + ctx=ctxMgr.setContext(request); + if ( ctx != null ) { + user = ctx.getUser(); + } + } + if ( user == null ) { + ctx = ContextManagerFactory.getInstance().getContext(); + if ( ctx !=null ) + user = ctx.getUser(); + } + if ( user == null ) + throw new RuntimeException("Unable to get user from context: cannot proceed to get Learning Designs"); + // we have a good context, now get on with the task. String method = usePaging ? "getPagedHomeLearningDesignsJSON" : "getLearningDesignsJSON"; String learningDesigns = LamsSecurityUtil.getLearningDesigns(ctx, courseId, folderId, method, type, search, page, size, sortName, sortDate); @@ -98,5 +128,6 @@ } } } + } Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/RenderDesignImageServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/RenderDesignImageServlet.java,v diff -u -r1.1 -r1.2 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/RenderDesignImageServlet.java 11 Jun 2015 23:44:29 -0000 1.1 +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/RenderDesignImageServlet.java 17 Sep 2015 02:09:07 -0000 1.2 @@ -46,6 +46,14 @@ private static final long serialVersionUID = -351131323404991332L; public void doGet(HttpServletRequest request, HttpServletResponse response) { + process(request, response); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) { + process(request, response); + } + + public void process(HttpServletRequest request, HttpServletResponse response) { String strLearningDesignId = request.getParameter("sequence_id"); if ( strLearningDesignId != null ) { Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/StartLessonServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/Attic/StartLessonServlet.java,v diff -u -r1.2 -r1.3 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/StartLessonServlet.java 13 Aug 2015 13:08:46 -0000 1.2 +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/StartLessonServlet.java 17 Sep 2015 02:09:07 -0000 1.3 @@ -33,16 +33,20 @@ import org.lamsfoundation.ld.util.LineitemUtil; import blackboard.base.FormattedText; +import blackboard.base.InitializationException; import blackboard.data.content.Content; import blackboard.data.content.CourseDocument; import blackboard.data.course.Course; +import blackboard.data.user.User; import blackboard.persist.BbPersistenceManager; import blackboard.persist.Id; import blackboard.persist.PkId; import blackboard.persist.content.ContentDbPersister; +import blackboard.platform.BbServiceException; import blackboard.platform.BbServiceManager; import blackboard.platform.context.Context; import blackboard.platform.context.ContextManager; +import blackboard.platform.context.ContextManagerFactory; import blackboard.platform.plugin.PlugInException; import blackboard.platform.plugin.PlugInUtil; import blackboard.portal.data.ExtraInfo; @@ -60,13 +64,42 @@ private static Logger logger = Logger.getLogger(StartLessonServlet.class); public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + process(request, response); + } + public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { + process(request, response); + } + + protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException { + ContextManager ctxMgr = null; Context ctx = null; try { - // get Blackboard context + // In some instances of calling this servlet, the user is missing from the context. Try a few different ways to ensure we have the user! + User user = null; + ctxMgr = (ContextManager) BbServiceManager.lookupService(ContextManager.class); ctx = ctxMgr.setContext(request); + if ( ctx != null ) { + user = ctx.getUser(); + } + if ( user == null ) { + ctxMgr = ContextManagerFactory.getInstance(); + ctx=ctxMgr.setContext(request); + if ( ctx != null ) { + user = ctx.getUser(); + } + } + if ( user == null ) { + ctx = ContextManagerFactory.getInstance().getContext(); + if ( ctx !=null ) + user = ctx.getUser(); + } + if ( user == null ) + throw new RuntimeException("Unable to get user from context: cannot proceed to get Learning Designs"); + + // we have a good context, now get on with the task. // Set the new LAMS Lesson Content Object CourseDocument bbContent = new blackboard.data.content.CourseDocument(); @@ -232,5 +265,32 @@ return value != null ? value.trim() : ""; } + // In some instances of calling this servlet, the user is missing from the context. Try a few different ways to ensure we have the user! + private Context getContext(HttpServletRequest request) throws InitializationException, BbServiceException { + + User user = null; + + ContextManager ctxMgr = (ContextManager) BbServiceManager.lookupService(ContextManager.class); + Context ctx = ctxMgr.setContext(request); + if ( ctx != null ) { + user = ctx.getUser(); + } + if ( user == null ) { + final ContextManager contextManagerViaFactory = ContextManagerFactory.getInstance(); + ctx=contextManagerViaFactory.setContext(request); + if ( ctx != null ) { + user = ctx.getUser(); + } + } + if ( user == null ) { + ctx = ContextManagerFactory.getInstance().getContext(); + if ( ctx !=null ) + user = ctx.getUser(); + } + if ( user != null ) + return ctx; + else + throw new RuntimeException("Unable to get user from context: cannot proceed to get Learning Designs"); + } }