BonCodeAJP13.ServerPackets.BonCodeFilePathPacket.BonCodeFilePathPacket C# (CSharp) Method

BonCodeFilePathPacket() public method

constructor with path provided. we will use default application physical path if empty string is passed as path.
public BonCodeFilePathPacket ( string sPath ) : System
sPath string
return System
        public BonCodeFilePathPacket(string sPath)
        {
            if (sPath.Length == 0) sPath = BonCodeAJP13Settings.BonCodeAjp13_DocRoot;
            //get path length in bytes in case we have Unicode this differs from sPath.Length
            //*int iPathBytes = Encoding.UTF8.GetByteCount(sPath);

            //Adobe uses iso encoding so we have to convert things into it

            int iPathBytes = Encoding.GetEncoding("iso-8859-1").GetByteCount(sPath);

            //this byte will prefix the string. But does not correctly account for
            //length if path is more than 256 characters. We are implementing this
            //in this fashion because this is how Adobe uses it
            byte bytePrefix = System.Convert.ToByte(iPathBytes % 256);
            //allocate all needed space. We do not worry about max packet size. This
            //protocol extension does not handle multi-part packages so we need to transfer
            //in one shot and hope tomcat site will be able to handle.
            byte[] aUserData = new byte[iPathBytes + 5];
            int pos = 0;
            p_UserDataLength = Convert.ToUInt16(iPathBytes + 1); //have to include bytePrefix
            //write out the package
            pos = SetByte(aUserData, BonCodeAJP13Markers.BONCODEAJP13_PACKET_START, pos);
            pos = SetByte(aUserData, BonCodeAJP13Markers.BONCODEAJP13_PACKET_START2, pos);
            pos = SetUInt16(aUserData, p_UserDataLength, pos);
            pos = SetByte(aUserData, bytePrefix, pos);
            pos = SetSimpleString(aUserData, sPath, pos); //this will omit length marker

            //this packet is not well formed as per AJP13 put follows the vendor's extension
            //should have had propper formatted string data

            p_ByteStore = aUserData;
            p_PacketLength = p_ByteStore.Length;
        }

Same methods

BonCodeFilePathPacket::BonCodeFilePathPacket ( ) : System