Hello i have been trying to parse the data returned by jServer ServletRequest Input Stream into it various component part
my Main aim is to
So far, i have only been able to split by the separator but reading the field datas have been a pain , i think regex can help but i am poor at regex.
----------------------------922648808218289885256712
Content-Disposition: form-data; name="tesr"
frost here
new line
----------------------------922648808218289885256712
Content-Disposition: form-data; name="my-file"; filename="Central Idea.json"
Content-Type: application/json
{"id":"b49fc399-2942-45a9-86fe-b333ae32e92b","title":"Central Idea","mindmap":{"root":{"id":"e7cc14d4-de3e-466a-b957-db4cb031a1d1","parentId":null,"text":{"caption":"Central Idea","font":{"style":"normal","weight":"bold","decoration":"none","size":20,"color":"#000000"}},"offset":{"x":0,"y":0},"foldChildren":false,"branchColor":"#000000","children":[{"id":"1b05ef9e-ea91-4bb3-b658-240739737a19","parentId":"e7cc14d4-de3e-466a-b957-db4cb031a1d1","text":{"caption":"New Idea","font":{"style":"normal","weight":"normal","decoration":"none","size":15,"color":"#000000"}},"offset":{"x":-160,"y":-28},"foldChildren":false,"branchColor":"#dc9ca6","children":[{"id":"7e934195-b7e9-467f-bca3-0726877de9bc","parentId":"1b05ef9e-ea91-4bb3-b658-240739737a19","text":{"caption":"New Idea","font":{"style":"normal","weight":"normal","decoration":"none","size":15,"color":"#000000"}},"offset":{"x":-56,"y":-74},"foldChildren":false,"branchColor":"#dc9ca6","children":[]},{"id":"921c570f-494c-4571-b818-66c831a26cf...
----------------------------922648808218289885256712
Content-Disposition: form-data; name="kk"; filename="film links.rtf"
Content-Type: application/rtf
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\colortbl ;\red0\green0\blue255;}
{\*\generator Riched20 10.0.14393}\viewkind4\uc1
\pard\sa200\sl276\slmult1 {\f0\fs22\lang9{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Person-of-Interest-8/index.html }}{\fldrslt{http://o2tvseries.com/Person-of-Interest-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Person-of-Interest-8/Season-04/index.html }}{\fldrslt{http://o2tvseries.com/Person-of-Interest-8/Season-04/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/search/genre/Comedy }}{\fldrslt{http://o2tvseries.com/search/genre/Comedy\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/A-Discovery-of-Witches/Season-01/index.html }}{\fldrslt{http://o2tvseries.com/A-Discovery-of-Witches/Season-01/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Shadowhunters-8/index.html }}{\fldrslt{http://o2tvseries.com/Shadowhunters-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/The-Shannara-Chronicles-8/index.html }}{\fldrslt{http://o2tvseries.com/The-Shannara-Chronicles-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/The-Magicians-8/index.html }}{\fldrslt{http://o2tvseries.com/The-Magicians-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Witches-of-East-End-8/index.html }}{\fldrslt{http://o2tvseries.com/Witches-of-East-End-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Witches-of-East-End-8/Season-01/index.html }}{\fldrslt{http://o2tvseries.com/Witches-of-East-End-8/Season-01/index.html\ul0\cf0}}}}\f0\fs22\par
\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/search/genre }}{\fldrslt{http://o2tvseries.com/search/genre\ul0\cf0}}}}\f0\fs22\par
}
Content-Disposition: form-data; name="tesr"
frost here
new line
----------------------------922648808218289885256712
Content-Disposition: form-data; name="my-file"; filename="Central Idea.json"
Content-Type: application/json
{"id":"b49fc399-2942-45a9-86fe-b333ae32e92b","title":"Central Idea","mindmap":{"root":{"id":"e7cc14d4-de3e-466a-b957-db4cb031a1d1","parentId":null,"text":{"caption":"Central Idea","font":{"style":"normal","weight":"bold","decoration":"none","size":20,"color":"#000000"}},"offset":{"x":0,"y":0},"foldChildren":false,"branchColor":"#000000","children":[{"id":"1b05ef9e-ea91-4bb3-b658-240739737a19","parentId":"e7cc14d4-de3e-466a-b957-db4cb031a1d1","text":{"caption":"New Idea","font":{"style":"normal","weight":"normal","decoration":"none","size":15,"color":"#000000"}},"offset":{"x":-160,"y":-28},"foldChildren":false,"branchColor":"#dc9ca6","children":[{"id":"7e934195-b7e9-467f-bca3-0726877de9bc","parentId":"1b05ef9e-ea91-4bb3-b658-240739737a19","text":{"caption":"New Idea","font":{"style":"normal","weight":"normal","decoration":"none","size":15,"color":"#000000"}},"offset":{"x":-56,"y":-74},"foldChildren":false,"branchColor":"#dc9ca6","children":[]},{"id":"921c570f-494c-4571-b818-66c831a26cf...
----------------------------922648808218289885256712
Content-Disposition: form-data; name="kk"; filename="film links.rtf"
Content-Type: application/rtf
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\colortbl ;\red0\green0\blue255;}
{\*\generator Riched20 10.0.14393}\viewkind4\uc1
\pard\sa200\sl276\slmult1 {\f0\fs22\lang9{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Person-of-Interest-8/index.html }}{\fldrslt{http://o2tvseries.com/Person-of-Interest-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Person-of-Interest-8/Season-04/index.html }}{\fldrslt{http://o2tvseries.com/Person-of-Interest-8/Season-04/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/search/genre/Comedy }}{\fldrslt{http://o2tvseries.com/search/genre/Comedy\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/A-Discovery-of-Witches/Season-01/index.html }}{\fldrslt{http://o2tvseries.com/A-Discovery-of-Witches/Season-01/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Shadowhunters-8/index.html }}{\fldrslt{http://o2tvseries.com/Shadowhunters-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/The-Shannara-Chronicles-8/index.html }}{\fldrslt{http://o2tvseries.com/The-Shannara-Chronicles-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/The-Magicians-8/index.html }}{\fldrslt{http://o2tvseries.com/The-Magicians-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Witches-of-East-End-8/index.html }}{\fldrslt{http://o2tvseries.com/Witches-of-East-End-8/index.html\ul0\cf0}}}}\f0\fs22\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/Witches-of-East-End-8/Season-01/index.html }}{\fldrslt{http://o2tvseries.com/Witches-of-East-End-8/Season-01/index.html\ul0\cf0}}}}\f0\fs22\par
\par
\par
{{\field{\*\fldinst{HYPERLINK http://o2tvseries.com/search/genre }}{\fldrslt{http://o2tvseries.com/search/genre\ul0\cf0}}}}\f0\fs22\par
}
my Main aim is to
- Read each field data ie Content-Disposition, name. Each field is separated by separators which is the first line then end with the first line and a --
- If filename is present that means its a file upload then 2nd line would contain data for Content-Type
- The data under is the field data or the upload raw data
So far, i have only been able to split by the separator but reading the field datas have been a pain , i think regex can help but i am poor at regex.