public Request( float version, Header[] headers, Body[] bodyParts ) { instancesCreated++; this.version = version; this.headers = headers; this.bodyParts = bodyParts; //this.debugCall = new Call( bodyParts.Length ); }
public Body[] getResponseBodies() { Body[] bodyArray = new Body[ responseBodies.Count ]; responseBodies.CopyTo( bodyArray, 0 ); return bodyArray; }
public Request readMessage(Stream input) { FlashorbBinaryReader reader = new FlashorbBinaryReader(input); try { if (Log.isLogging(LoggingConstants.DEBUG)) Log.log(LoggingConstants.DEBUG, "MessageReader:: parsing stream"); int version = reader.ReadUnsignedShort(); int totalHeaders = reader.ReadUnsignedShort(); if (Log.isLogging(LoggingConstants.DEBUG)) Log.log(LoggingConstants.DEBUG, "MessageReader:: parsing message - version: " + version + " totalHeaders: " + totalHeaders); Header[] headers = new Header[totalHeaders]; for (int i = 0; i < totalHeaders; i++) headers[i] = readHeader(reader); int totalBodyParts = reader.ReadUnsignedShort(); if (Log.isLogging(LoggingConstants.DEBUG)) Log.log(LoggingConstants.DEBUG, "MessageReader:: Total body parts: " + totalBodyParts); Body[] bodies = new Body[totalBodyParts]; for (int i = 0; i < totalBodyParts; i++) bodies[i] = readBodyPart(reader); if (Log.isLogging(LoggingConstants.DEBUG)) Log.log(LoggingConstants.DEBUG, "MessageReader:: returning AMFMessage"); Request request = new Request(version, headers, bodies); request.SetFormatter(version == 3 ? (IProtocolFormatter)new AmfV3Formatter() : (IProtocolFormatter)new AmfFormatter()); return request; } catch (Exception exception) { if (Log.isLogging(LoggingConstants.EXCEPTION)) Log.log(LoggingConstants.EXCEPTION, "Exception: " + exception.Message + " StackTrace: " + exception.StackTrace); return null; } }