Author: shane.bryzak(a)jboss.com
Date: 2009-12-07 10:30:54 -0500 (Mon, 07 Dec 2009)
New Revision: 11787
Modified:
modules/remoting/trunk/pom.xml
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelRegistry.java
modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
Log:
fix various model handler exceptions
Modified: modules/remoting/trunk/pom.xml
===================================================================
--- modules/remoting/trunk/pom.xml 2009-12-07 15:30:05 UTC (rev 11786)
+++ modules/remoting/trunk/pom.xml 2009-12-07 15:30:54 UTC (rev 11787)
@@ -80,6 +80,14 @@
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
+
+ <!-- non portable dependency -->
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>1.0.0</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
Modified:
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java
===================================================================
---
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java 2009-12-07
15:30:05 UTC (rev 11786)
+++
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java 2009-12-07
15:30:54 UTC (rev 11787)
@@ -69,7 +69,7 @@
final Element env = doc.getRootElement();
final RequestContext ctx = new RequestContext(env.element("header"));
- if (!ctx.getConversationId().isEmpty())
+ if (ctx.getConversationId() != null && !ctx.getConversationId().isEmpty())
{
// this is non portable ;/
conversationManager.beginOrRestoreConversation(ctx.getConversationId());
Modified:
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java
===================================================================
---
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java 2009-12-07
15:30:05 UTC (rev 11786)
+++
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java 2009-12-07
15:30:54 UTC (rev 11787)
@@ -63,7 +63,7 @@
final Element env = doc.getRootElement();
final RequestContext ctx = new RequestContext(env.element("header"));
- if (!ctx.getConversationId().isEmpty())
+ if (ctx.getConversationId() != null && !ctx.getConversationId().isEmpty())
{
conversationManager.beginOrRestoreConversation(ctx.getConversationId());
}
@@ -73,7 +73,7 @@
for (Element modelElement : (List<Element>)
env.element("body").elements("model"))
{
String operation = modelElement.attributeValue("operation");
- String id = modelElement.attributeValue("id");
+ String callId = modelElement.attributeValue("callId");
if ("fetch".equals(operation))
{
@@ -89,24 +89,31 @@
Element paramsElement = actionElement.element("params");
Element refsElement = actionElement.element("refs");
- action = new Call(beanManager, id, targetElement.getTextTrim(),
- qualifiersElement.getTextTrim(), methodElement.getTextTrim());
+ action = new Call(beanManager, callId, targetElement.getTextTrim(),
+ qualifiersElement != null ? qualifiersElement.getTextTrim() : null,
+ methodElement != null ? methodElement.getTextTrim() : null);
- for (Element refElement : (List<Element>)
refsElement.elements("ref"))
+ if (refsElement != null)
{
- action.getContext().createWrapperFromElement(refElement);
+ for (Element refElement : (List<Element>)
refsElement.elements("ref"))
+ {
+ action.getContext().createWrapperFromElement(refElement);
+ }
+
+ for (Wrapper w : action.getContext().getInRefs().values())
+ {
+ w.unmarshal();
+ }
}
- for (Wrapper w : action.getContext().getInRefs().values())
+ if (paramsElement != null)
{
- w.unmarshal();
+ for (Element paramElement : (List<Element>)
paramsElement.elements("param"))
+ {
+ action.addParameter(action.getContext().createWrapperFromElement(
+ (Element) paramElement.elements().get(0)));
+ }
}
-
- for (Element paramElement : (List<Element>)
paramsElement.elements("param"))
- {
- action.addParameter(action.getContext().createWrapperFromElement(
- paramElement));
- }
}
for (Element beanElement : (List<Element>)
modelElement.elements("bean"))
@@ -117,8 +124,8 @@
model.addBean(beanElement.attributeValue("alias"),
beanNameElement.getTextTrim(),
- beanQualifierElement.getTextTrim(),
- beanPropertyElement.getTextTrim());
+ beanQualifierElement != null ? beanQualifierElement.getTextTrim() :
null,
+ beanPropertyElement != null ? beanPropertyElement.getTextTrim() :
null);
}
// TODO Unmarshal expressions - don't support this until security
implications investigated
Modified:
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelRegistry.java
===================================================================
---
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelRegistry.java 2009-12-07
15:30:05 UTC (rev 11786)
+++
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelRegistry.java 2009-12-07
15:30:54 UTC (rev 11787)
@@ -4,11 +4,11 @@
import java.util.HashMap;
import java.util.Map;
-import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
-@ConversationScoped
+@SessionScoped
public class ModelRegistry implements Serializable
{
private static final long serialVersionUID = -2952670948046596460L;
Modified: modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
===================================================================
--- modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-07
15:30:05 UTC (rev 11786)
+++ modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-07
15:30:54 UTC (rev 11787)
@@ -863,7 +863,7 @@
Seam.Remoting.Model.prototype.createFetchRequest = function(a) { // a = action
var callId = "" + Seam.Remoting.__callId++;
- var d = "<model operation=\"fetch\" callId=\"" + callId +
">";
+ var d = "<model operation=\"fetch\" callId=\"" + callId +
"\">";
var refs = new Array();
if (a) {
@@ -897,7 +897,7 @@
if (this.beans.length > 0) {
for (var i = 0; i < this.beans.length; i++) {
var b = this.beans[i];
- d += "<bean alias=\"" + b.alias +
"\"><name>" + b.name + "</name>";
+ d += "<bean alias=\"" + b.alias +
"\"><name>" + b.bean + "</name>";
if (b.qualifiers && b.qualifiers.length > 0) {
d += "<qualifiers>";
for (var j = 0; j < b.qualifiers.length; j++) {