2006/unicorn/src/org/w3c/unicorn/action ObserveAction.java,1.6,1.7

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv19144/src/org/w3c/unicorn/action

Modified Files:
	ObserveAction.java 
Log Message:
added messages display on result page

Index: ObserveAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/ObserveAction.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ObserveAction.java	1 Sep 2009 16:00:24 -0000	1.6
+++ ObserveAction.java	1 Sep 2009 16:07:29 -0000	1.7
@@ -6,6 +6,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -88,6 +89,8 @@
 			return;
 		}
 		
+		Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
+		
 		ObserveAction.logger.trace("doGet");
 
 		// Language negotiation
@@ -126,8 +129,13 @@
 					mapOfSpecificParameter, mapOfOutputParameter);
 		}
 		
-		if (aUnicornCall.getTask() == null)
+		if (aUnicornCall.getTask() == null) {
 			aUnicornCall.setTask(Framework.mapOfTask.getDefaultTaskId());
+			Message mess = new Message(Message.Level.WARNING, "No task specified! Unicorn used its default task: " + Framework.mapOfTask.get(Framework.mapOfTask.getDefaultTaskId()).getLongName("en"), null);
+			ArrayList<Message> messages = new ArrayList<Message>();
+			messages.add(mess);
+			mapOfStringObject.put("messages", messages);
+		}
 
 		/*if (aUnicornCall.getTask() == null) {
 			ObserveAction.logger.error("No task selected.");
@@ -141,7 +149,7 @@
 			aUnicornCall.doTask();
 
 			this.createOutput(resp, aUnicornCall,
-					mapOfSpecificParameter, mapOfOutputParameter);
+					mapOfSpecificParameter, mapOfOutputParameter, mapOfStringObject);
 		} catch (final Exception aException) {
 			ObserveAction.logger.error("Exception : " + aException.getMessage(),
 					aException);
@@ -176,6 +184,8 @@
 			throws ServletException, IOException {
 		ObserveAction.logger.trace("doPost");
 		
+		Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
+		
 		// Check that we have a file upload request
 		final boolean bIsMultipart = ServletFileUpload.isMultipartContent(new ServletRequestContext(req));
 
@@ -248,7 +258,7 @@
 			aUnicornCall.doTask();
 
 			this.createOutput(resp, aUnicornCall,
-					mapOfSpecificParameter, mapOfOutputParameter);
+					mapOfSpecificParameter, mapOfOutputParameter, mapOfStringObject);
 		} catch (final Exception aException) {
 			ObserveAction.logger.error("Exception : " + aException.getMessage(),
 					aException);
@@ -406,12 +416,13 @@
 	private void createOutput(final HttpServletResponse aHttpServletResponse,
 			final UnicornCall aUnicornCall,
 			final Map<String, String[]> mapOfSpecificParameter,
-			final Map<String, String> mapOfOutputParameter) throws IOException {
+			final Map<String, String> mapOfOutputParameter,
+			Map<String, Object> mapOfStringObject) throws IOException {
 		aHttpServletResponse.setContentType(mapOfOutputParameter
 				.get("mimetype")
 				+ "; charset=" + mapOfOutputParameter.get("charset"));
 		try {
-			Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
+			//Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
 			mapOfStringObject.put("unicorncall", aUnicornCall);
 
 			logger.debug("Request output formater with parameters: " 

Received on Tuesday, 1 September 2009 16:07:42 UTC