Uploaded image for project: 'Errai'
  1. Errai
  2. ERRAI-1098

Ability to manipulate the payload before marshalling

    XMLWordPrintable

    Details

      Description

      I require the ability to manipulate the payload before it is sent through marshalling.

      This is how I hacked it in, as far as I know there isn't another way to do this:

      public class ErraiProtocolServer extends ErraiProtocol {
        public static ByteArrayInputStream encodePayloadToByteArrayInputStream(final Map<String, Object> payload) {
          try {
            if(payload.containsKey("MethodReply")) {
              payload.put("MethodReply", HibernateUtil.cleanFromProxies(payload.get("MethodReply")));
            }
            return new ByteArrayInputStream(encodePayload(payload).getBytes("UTF-8"));
          } catch (UnsupportedEncodingException e) {
            throw new AssertionError("UTF-8 appears not to be supported by this JRE, but that's impossible");
          }
        }
      }
      

      I am stripping out hibernate proxies before it is sent to the marshalling to avoid lazy load issues.

        Attachments

          Activity

            People

            Assignee:
            mbarkley Max Barkley (Inactive)
            Reporter:
            ben.dol Ben Dol (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: