Results 1 to 4 of 4

Thread: Examples on MessageInterceptor?

  1. #1
    Join Date
    Aug 2004
    Posts
    21

    Default Examples on MessageInterceptor?

    Hi,

    are there any examples on MessageInterceptor? I have some Intertype declarations from AspectJ in my domain model. I would like to remove those fields when sending them to the client so they don't have any warnings about it. Can this be done with a MessageInterceptor? How?

    regards,

    Wim

  2. #2
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    I'm not familiar enough with ITD's to know exactly how you would go about removing them from an object instance at runtime, but it sounds like mainly you'll want to focus on using the postProcess method to manipulate the body of the outgoing Message. The body will be the actual Java object that is intended to be serialized to AMF (so the result of a remoting-destination invocation, for example).

    So something like this:
    Code:
    public class MyMessageInterceptor implements MessageInterceptor {
    
        public Message postProcess(MessageProcessingContext context, Message inputMessage, Message outputMessage) {
            Object result =  outputMessage.getBody();
            
            //...Do some sort of processing on result...
            
            outputMessage.setBody(result);
            
            return outputMessage;
        }
    
        public Message preProcess(MessageProcessingContext context, Message inputMessage) {
            //Don't need to process the incoming message, so just return it
            return inputMessage;
        }
    
    }
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

  3. #3
    Join Date
    Aug 2004
    Posts
    21

    Default

    Due to the ITD, we have to do something like this in ActionScript:

    public class MyClass
    {
    private var myProperty:Integer;
    private var ajc$interField$com_mycomp_MyAspect$myAspectPropert y:*;
    }

    The field is really added to the object, so I don't think I can remove it if the object is already created like in the postProcess method.

    I think I need to influence the conversion from the java object to the flex representation. Would that be possible?

    regards,

    Wim

  4. #4
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    Yes, it is possible...see the following section from the BlazeDS docs on "Using custom serialization between ActionScript and Java":
    http://livedocs.adobe.com/blazeds/1/..._3.html#303410
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •