Index: lams_central/conf/xdoclet/struts-actions.xml
===================================================================
diff -u
--- lams_central/conf/xdoclet/struts-actions.xml (revision 0)
+++ lams_central/conf/xdoclet/struts-actions.xml (revision 377a1a547dae390df3b37784e2be3d191b094d8d)
@@ -0,0 +1,13 @@
+
\ No newline at end of file
Index: lams_central/conf/xdoclet/struts-forms.xml
===================================================================
diff -u -ra0a9327d7d5157b5fc508ddd2246ea7355e5f298 -r377a1a547dae390df3b37784e2be3d191b094d8d
--- lams_central/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision a0a9327d7d5157b5fc508ddd2246ea7355e5f298)
+++ lams_central/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision 377a1a547dae390df3b37784e2be3d191b094d8d)
@@ -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
===================================================================
diff -u -rde1940e60766f8901436c6ab567c692685d5b35c -r377a1a547dae390df3b37784e2be3d191b094d8d
--- lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostAction.java (.../WDDXPostAction.java) (revision de1940e60766f8901436c6ab567c692685d5b35c)
+++ lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostAction.java (.../WDDXPostAction.java) (revision 377a1a547dae390df3b37784e2be3d191b094d8d)
@@ -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
===================================================================
diff -u -rde1940e60766f8901436c6ab567c692685d5b35c -r377a1a547dae390df3b37784e2be3d191b094d8d
--- lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostActionForm.java (.../WDDXPostActionForm.java) (revision de1940e60766f8901436c6ab567c692685d5b35c)
+++ lams_central/src/java/org/lamsfoundation/lams/web/development/WDDXPostActionForm.java (.../WDDXPostActionForm.java) (revision 377a1a547dae390df3b37784e2be3d191b094d8d)
@@ -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
===================================================================
diff -u -rc277bb1c30c1283b5f66c6f651855c51a5f87bc5 -r377a1a547dae390df3b37784e2be3d191b094d8d
--- lams_central/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision c277bb1c30c1283b5f66c6f651855c51a5f87bc5)
+++ lams_central/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 377a1a547dae390df3b37784e2be3d191b094d8d)
@@ -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.