Author: andygumbrecht
Date: Wed Jul 31 14:50:24 2013
New Revision: 1508891
URL: http://svn.apache.org/r1508891
Log:
Make JNDIContext.AuthenticationInfo backwards compatible with ejbd protocol -
Older clients must still be able to 'talk' with a newer server.
Modified:
tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
Modified:
tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
URL:
http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java?rev=1508891&r1=1508890&r2=1508891&view=diff
==============================================================================
---
tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
(original)
+++
tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
Wed Jul 31 14:50:24 2013
@@ -57,7 +57,12 @@ public class EJBRequest implements Clust
ejbMetaData = null;
}
- public EJBRequest(final RequestMethodCode requestMethod, final
EJBMetaDataImpl ejb, final Method method, final Object[] args, final Object
primaryKey, final EJBDSerializer serializer) {
+ public EJBRequest(final RequestMethodCode requestMethod,
+ final EJBMetaDataImpl ejb,
+ final Method method,
+ final Object[] args,
+ final Object primaryKey,
+ final EJBDSerializer serializer) {
body = new Body(ejb);
this.serializer = serializer;
@@ -635,7 +640,10 @@ public class EJBRequest implements Clust
}
}
serverHash = in.readInt();
- authentication =
JNDIContext.AuthenticationInfo.class.cast(in.readObject());
+
+ if (this.getVersion() >= 3) {
+ authentication =
JNDIContext.AuthenticationInfo.class.cast(in.readObject());
+ }
if (result != null) {
throw result;
@@ -655,7 +663,11 @@ public class EJBRequest implements Clust
out.writeShort(deploymentCode);
out.writeObject(clientIdentity);
out.writeInt(serverHash);
- out.writeObject(authentication);
+
+ if (this.getVersion() >= 3) {
+ out.writeObject(authentication);
+ }
+
body.writeExternal(out);
}
Modified:
tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
URL:
http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java?rev=1508891&r1=1508890&r2=1508891&view=diff
==============================================================================
---
tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
(original)
+++
tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
Wed Jul 31 14:50:24 2013
@@ -23,10 +23,12 @@ import java.io.ObjectOutput;
public class EJBResponse implements ClusterableResponse {
/**
+ * Version provides the protocol hint for backwards compatibility:
* 1. Initial
* 2. Append times.
+ * 3. JNDIContext.AuthenticationInfo.
*/
- public static final byte VERSION = 2;
+ public static final byte VERSION = 3;
private transient byte version = VERSION;
private transient int responseCode = -1;
@@ -127,7 +129,7 @@ public class EJBResponse implements Clus
result = in.readObject();
- if (version == 2) {
+ if (version >= 2) {
final byte size = in.readByte();
@@ -168,7 +170,7 @@ public class EJBResponse implements Clus
stop(Time.SERIALIZATION);
stop(Time.TOTAL);
- if (this.version == 2) {
+ if (this.version >= 2) {
out.writeByte(timesLength);
Modified:
tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
URL:
http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java?rev=1508891&r1=1508890&r2=1508891&view=diff
==============================================================================
---
tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
(original)
+++
tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
Wed Jul 31 14:50:24 2013
@@ -156,7 +156,7 @@ class EjbRequestHandler {
Object securityToken = null;
try {
- { // login if needed with request
+ if (version >= 3) { // login if needed with request
final JNDIContext.AuthenticationInfo authentication =
req.getAuthentication();
if (authentication != null) {
try {