Index: lams_central/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_central/conf/xdoclet/struts-actions.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/conf/xdoclet/struts-actions.xml 13 Sep 2006 05:44:06 -0000 1.1 @@ -0,0 +1,13 @@ + \ No newline at end of file Index: lams_central/conf/xdoclet/struts-forms.xml =================================================================== RCS file: /usr/local/cvsroot/lams_central/conf/xdoclet/struts-forms.xml,v diff -u -r1.2 -r1.3 --- lams_central/conf/xdoclet/struts-forms.xml 24 Aug 2006 01:54:03 -0000 1.2 +++ lams_central/conf/xdoclet/struts-forms.xml 13 Sep 2006 05:44:06 -0000 1.3 @@ -18,4 +18,11 @@ - \ No newline at end of file + + + \ No newline at end of file Index: lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostAction.java,v diff -u -r1.4 -r1.5 --- lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostAction.java 3 Apr 2006 23:28:17 -0000 1.4 +++ lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostAction.java 13 Sep 2006 05:43:56 -0000 1.5 @@ -36,17 +36,21 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; /** - * Takes a action ( URL ) and a file containing a WDDX packet + * Takes an action ( URL ) and a file containing a WDDX packet * and forwards the contents of the WDDX packet to the action. *

* This is used to simulate Flash sending a WDDX packet to @@ -55,10 +59,9 @@ * The error handling just throws a RuntimeException if something * goes wrong. Not nice but this is only run during development.... *

- * @struts:action name="WDDXPostActionForm" - * path="/WDDXPost" - * validate="false" - * parameter="method" + * This action is commented out in the struts-action.xml and hence + * in thestruts-config.xml so if you want to run this, you will need + * to uncomment it in the struts-config.xml. */ public class WDDXPostAction extends Action { @@ -80,12 +83,22 @@ throw e; } + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ( user == null ) { + RuntimeException e = new RuntimeException("WDDXPostAction called with url "+action + +" but user details are missing from shared session. Not processing the WDDX file."); + log.error(e); + throw e; + } + FormFile file = postForm.getWddxFile(); if ( file == null ) { RuntimeException e = new RuntimeException("Unable to process WDDX file, file is missing."); log.error(e); throw e; } + Cookie[] cookies = req.getCookies(); // we've got the URL action and the WDDX input. Now try sending the WDDX to the URL URL url = new URL(action); @@ -113,7 +126,8 @@ if ( ! packetStart.equalsIgnoreCase(" tag. Invalid format."); } - log.debug("Sending packet "+packet); + + log.warn("WDDXPostAction Processing action "+action+" for user "+user+" packet is "+packet); // POST requests are required to have Content-Length String lengthString = String.valueOf(byteStream.size()); Index: lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostActionForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostActionForm.java,v diff -u -r1.3 -r1.4 --- lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostActionForm.java 3 Apr 2006 23:28:17 -0000 1.3 +++ lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostActionForm.java 13 Sep 2006 05:43:56 -0000 1.4 @@ -32,10 +32,6 @@ /** * @author fmalikoff - * - * @struts:form name="WDDXPostActionForm" - * include-pk="true" - * include-all="true" */ public class WDDXPostActionForm extends ActionForm { Index: lams_central/web/WEB-INF/struts/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/WEB-INF/struts/Attic/struts-config.xml,v diff -u -r1.15 -r1.16 --- lams_central/web/WEB-INF/struts/struts-config.xml 6 Jul 2006 04:44:20 -0000 1.15 +++ lams_central/web/WEB-INF/struts/struts-config.xml 13 Sep 2006 05:45:10 -0000 1.16 @@ -14,25 +14,53 @@ - + + + + + + + + + + + + + + + + + + + + + + + - + + + + --> - +

- +

Test posting file to form - this should be WDDX XML to a URL expecting the XML in the post body.

@@ -42,6 +42,8 @@

+

If this call doesn't work, check your struts-config.xml file. The struts action and form + for this page is normally commented out and will need to be uncommented. Look for WDDXPost.