[Design of Messaging on JBoss (Messaging/JBoss)] - Re: Netty HTTP transport
by trustin
"ataylor" wrote : The API was cool Trustin. Especially the ReplayingDecoder, it makes decoding complex messages much easier.
I'm happy to hear that. :)
"ataylor" wrote : "trustin" wrote : 1) IIUC, HTTP allows multiple headers with the same key. It seems like the current HttpMessage interface assumes there's only one value per key. Therefore, the headers should be represented as Set<String, List> instead of Map<String, String>.
|
| Ok, thats done and ive changed the API.
I forgot to mention that the header name is case insensitive. TreeMap with a custom Comparator should be used perhaps?
"ataylor" wrote : also multiple values are seperated by a comma, i.e.
|
| aheader: a,b,c
|
| actually has 3 values a, b and c. The caveat here is Date type headers such as Date, Expires etc as they have commas within them.
Commas are interpreted as header value separators only when explicitly specified in the HTTP specification AFAIK. I think we don't need to take care of commas and left it to the user application.
"ataylor" wrote : "trustin" wrote : 4) Reason (error message) is missing in HttpResponse. HttpResponseStatusCode already has the pre-defined reason phrases, but it should be customizable on a per-response basis. (Perhaps we could simply make the HttpResponseStatusCode constructor public?)
|
| enums can't have public constructors so ive added another static method for overriding the reason description.
What do you think about making it non-enum?
"ataylor" wrote : "trustin" wrote : 5) What about renaming HttpProtocol to HttpVersion? P of HTTP already stands for 'protocol'. Also, HttpRequest.get/setProtocol() needs to be renamed to get/setVersion() or get/setProtocolVersion().
|
| I agree, done.
I ran svn up, but it's not showing up.
"ataylor" wrote : "trustin" wrote : 6) java.net.URI already has a query property. I think we don't need the parameter accessor methods in the HttpRequest interface. We could provide a helper class like UriBuilder later.
|
| not sure i follow completely, i need the URI for encoding purposes so i need an accessor. Unless you meant replace it with a String?
When you create a new URI instance, you can specify query parameters and get them by calling URI.getQuery(). Of course, it's not a convenient form and it requires additional processing. My point is we don't need to hold duplicate information though. We could provide two helper classes:
a) UriBuilder - helps a user to build a URI easily.
UriBuilder ub = new UriBuilder("http://www.jboss.org/hello");
ub.addParameter("name", "Andy");
URI uri = ub.toUri();
b) UriQueryDecoder - helps a user to decode the query string
UriQueryDecoder uqd = new UriQueryDecoder(uri);
uqd.getParameter("name");
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186875#4186875
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186875
15 years, 7 months