I need re-usable async http parsing code. Does mina perhaps contain some api
for just the parsing portion? (I always have a belief that parsers should be
separate and re-usable and not tied to the framework so I hope mina's is
reusable as well).
ie. It would be great to feed in bytes like so and it returns null if there is
not yet enough bytes
private byte[] previousData
byte[] data = incomingMergedWithPreviousData(previousData);
HttpResponse resp = httpResponseParser.parse(data); //HttpResponse has two
subclasses maybe? HttpHeaders and HttpChunk (in case chunking is going on)
If(resp == null) {
previousData = data;
Return;
}
previousData = new byte[0]; //reset since we are done parsing
//fire response to someone to process it
OR maybe I could re-use the code a different way. All I know is I get bytes
that don't always have all the http headers yet since it is asynch stuff. Any
way to parse stuff?
NOTE: Also, I want to do chunking so I am not sure it should return
HttpResponse every time but maybe an List where one subclass is HttpHeaders and
another is HttpChunk.
thanks,
Dean