Index: lams_bb_integration/.classpath =================================================================== diff -u -r3b9ddc508e73ba1d53a30bf7e6a45d400da05096 -rfed04df1e8898b6fbb49fcb09ffa61877d14cc1b --- lams_bb_integration/.classpath (.../.classpath) (revision 3b9ddc508e73ba1d53a30bf7e6a45d400da05096) +++ lams_bb_integration/.classpath (.../.classpath) (revision fed04df1e8898b6fbb49fcb09ffa61877d14cc1b) @@ -12,5 +12,6 @@ + Index: lams_bb_integration/RELEASE_NOTES.TXT =================================================================== diff -u -r1ab33003cd3e0467df4e556f45b32a06246856b1 -rfed04df1e8898b6fbb49fcb09ffa61877d14cc1b --- lams_bb_integration/RELEASE_NOTES.TXT (.../RELEASE_NOTES.TXT) (revision 1ab33003cd3e0467df4e556f45b32a06246856b1) +++ lams_bb_integration/RELEASE_NOTES.TXT (.../RELEASE_NOTES.TXT) (revision fed04df1e8898b6fbb49fcb09ffa61877d14cc1b) @@ -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/WEB-INF/bb-manifest.xml =================================================================== diff -u -r1ab33003cd3e0467df4e556f45b32a06246856b1 -rfed04df1e8898b6fbb49fcb09ffa61877d14cc1b --- lams_bb_integration/WEB-INF/bb-manifest.xml (.../bb-manifest.xml) (revision 1ab33003cd3e0467df4e556f45b32a06246856b1) +++ lams_bb_integration/WEB-INF/bb-manifest.xml (.../bb-manifest.xml) (revision fed04df1e8898b6fbb49fcb09ffa61877d14cc1b) @@ -5,7 +5,7 @@ - + Index: lams_bb_integration/build.xml =================================================================== diff -u -r1ab33003cd3e0467df4e556f45b32a06246856b1 -rfed04df1e8898b6fbb49fcb09ffa61877d14cc1b --- lams_bb_integration/build.xml (.../build.xml) (revision 1ab33003cd3e0467df4e556f45b32a06246856b1) +++ lams_bb_integration/build.xml (.../build.xml) (revision fed04df1e8898b6fbb49fcb09ffa61877d14cc1b) @@ -2,7 +2,7 @@ - + Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java =================================================================== diff -u -ra992ac61e8e1ba2366392c77d1783147f48dbc5c -rfed04df1e8898b6fbb49fcb09ffa61877d14cc1b --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java (.../LamsLearningDesignDeleteServlet.java) (revision a992ac61e8e1ba2366392c77d1783147f48dbc5c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java (.../LamsLearningDesignDeleteServlet.java) (revision fed04df1e8898b6fbb49fcb09ffa61877d14cc1b) @@ -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 =================================================================== diff -u -r1ab33003cd3e0467df4e556f45b32a06246856b1 -rfed04df1e8898b6fbb49fcb09ffa61877d14cc1b --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java (.../LamsLearningDesignServlet.java) (revision 1ab33003cd3e0467df4e556f45b32a06246856b1) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java (.../LamsLearningDesignServlet.java) (revision fed04df1e8898b6fbb49fcb09ffa61877d14cc1b) @@ -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 =================================================================== diff -u -r068e4100028edf75e5f748dd330c8996b13b7d46 -rfed04df1e8898b6fbb49fcb09ffa61877d14cc1b --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/RenderDesignImageServlet.java (.../RenderDesignImageServlet.java) (revision 068e4100028edf75e5f748dd330c8996b13b7d46) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/RenderDesignImageServlet.java (.../RenderDesignImageServlet.java) (revision fed04df1e8898b6fbb49fcb09ffa61877d14cc1b) @@ -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 =================================================================== diff -u -r9a03b20823e468258baaebcf262a56a7c5ebae5d -rfed04df1e8898b6fbb49fcb09ffa61877d14cc1b --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/StartLessonServlet.java (.../StartLessonServlet.java) (revision 9a03b20823e468258baaebcf262a56a7c5ebae5d) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/StartLessonServlet.java (.../StartLessonServlet.java) (revision fed04df1e8898b6fbb49fcb09ffa61877d14cc1b) @@ -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"); + } }