[java-identity-provider COMMIT] in /trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl: DecodeMessa...

noreply at shibboleth.net noreply at shibboleth.net
Mon Jun 24 16:35:54 EDT 2013


Author: putmanb
Date: Mon Jun 24 16:35:53 2013
New Revision: 4540

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4540&view=rev
Log:
EncodeMessage:
 - check whether encoder is already inited
 - uncomment SWF recordResponseComplete call, seems good to have the encoder do this
 EncodeMessage and DecodeMessage:
 - move destroy() calls to finally block
 WebFlowMessageHandlerAdaptor:
 - Checkstyle fixups

Modified:
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/DecodeMessage.java
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/EncodeMessage.java
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/WebFlowMessageHandlerAdaptor.java

Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/DecodeMessage.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/DecodeMessage.java?rev=4540&r1=4539&r2=4540&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/DecodeMessage.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/DecodeMessage.java Mon Jun 24 16:35:53 2013
@@ -69,7 +69,6 @@
             log.debug("Action {}: Decoding incoming request", getId());         
             decoder.decode();
             final MessageContext msgContext = decoder.getMessageContext();
-            decoder.destroy();
             log.debug("Action {}: Incoming request decoded into a message of type {}", getId(), 
                     msgContext.getMessage().getClass().getName());
 
@@ -78,6 +77,8 @@
         } catch (MessageDecodingException e) {
             log.debug("Action {}: Unable to decode incoming request", getId(), e);
             return ActionSupport.buildEvent(this, UNABLE_TO_DECODE);
+        } finally {
+            decoder.destroy();
         }
     }
 }

Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/EncodeMessage.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/EncodeMessage.java?rev=4540&r1=4539&r2=4540&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/EncodeMessage.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/EncodeMessage.java Mon Jun 24 16:35:53 2013
@@ -43,10 +43,10 @@
 /** A profile stage that encodes an outbound response from the outbound {@link MessageContext}. 
  * 
  * <p>
- * Note that the supplied instance of {@link MessageEncoder} should not be initialized outside of the 
- * action. This action handles supplying the message context to encode via 
- * {@link MessageEncoder#setMessageContext(MessageContext)}, followed by invoking 
- * {@link MessageEncoder#initialize()}.
+ * If the supplied instance of {@link MessageEncoder} is not already initialized, this action will
+ * handle supplying the message context to encode via {@link MessageEncoder#setMessageContext(MessageContext)}, 
+ * followed by invoking {@link MessageEncoder#initialize()}. If the encoder is already initialized,
+ * these operations will be skipped.
  * </p>
  * 
  * */
@@ -108,8 +108,15 @@
 
             log.debug("Action {}: Encoding outbound response", getId());         
             final MessageContext msgContext = profileRequestContext.getOutboundMessageContext();
-            encoder.setMessageContext(msgContext);
-            encoder.initialize();
+            
+            if (!encoder.isInitialized()) {
+                log.debug("Encoder was not initialized, injecting MessageContext and initializing");
+                encoder.setMessageContext(msgContext);
+                encoder.initialize();
+            } else {
+                log.debug("Encoder was already initialized, skipping MessageContext injection and init");
+            }
+            
             
             encoder.prepareContext();
             
@@ -120,18 +127,20 @@
             }
             
             encoder.encode();
-            encoder.destroy();
+            
             log.debug("Action {}: Outbound response encoded from a message of type {}", getId(),
                     msgContext.getMessage().getClass().getName());
             
-            // TODO Could do this here, since we know the response has been handled.
-            // Also can do as an 'end' state expression.
-            //springRequestContext.getExternalContext().recordResponseComplete();
+            // Could also do this as an 'end' state expression in WebFlow.
+            springRequestContext.getExternalContext().recordResponseComplete();
 
             return ActionSupport.buildProceedEvent(this);
         } catch (MessageEncodingException | ComponentInitializationException | MessageHandlerException e) {
             log.debug("Action {}: Unable to encode outbound response", getId(), e);

[... 58 lines stripped ...]


More information about the commits mailing list