How to set a query string on HttpResponse

"이희승 (Trustin Lee)" trustin at gmail.com
Mon Jun 14 03:22:11 EDT 2010


Ah, that's an interesting idea.  It might be useful when you are
debugging and the response is not allowed to have body.

If this is the case of jBop, he could do like the following:

    String queryString = queryStringEncoder.toUri();
    HttpResponse res = new DefaultHttpResponse(
            HttpVersion.HTTP_1_1,
            new HttpResponseStatus(500, queryString));

Cheers,
Trustin

On 06/14/2010 03:30 PM, Don Park wrote:
> HTTP response Status-Line does not normally contain a query string. But it could be part of an overly helpful Reason-Phrase. - Don
> 
> On Jun 13, 2010, at 9:48 PM, 이희승 (Trustin Lee) wrote:
> 
>> I thought an HTTP response does not contain a query string.  Just in 
>> case I am missing something, could you paste an example HTTP response 
>> that contains a query string?
>>
>> Thanks in advance,
>> Trustin
>>
>> On 06/14/2010 01:09 PM, jBop wrote:
>>>
>>> Hello,
>>>
>>> Thank you for your reply.  Unfortunately I should have clarified what I was
>>> after more.  I can see how one uses the QueryStringEncoder to encode a query
>>> string onto a URL which is then use in a DefaultHttpRequest constructor.
>>> However I don't see how one can attach a query string to a
>>> DefaultHttpResponse.  Or is a query string sent in the response via a
>>> completely diff mechanism?
>>>
>>> Thank you
>>>
>>>
>>> Trustin Lee wrote:
>>>>
>>>> Hello,
>>>>
>>>> Query string encoder and decoder are provided as separate utility
>>>> classes: QueryStringEncoder and QueryStringDecoder.
>>>>
>>>> HTH,
>>>> Trustin
>>>>
>>>> On 06/09/2010 01:29 PM, jBop wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> I can see how to set the query string for an HttpRequest but I can't seem
>>>>> to
>>>>> find a way to set the query string for an HttpResponse.  Is it something
>>>>> obvious that I'm missing?
>>>>>
>>>>> Thank you
>>>>
>>>> --
>>>> what we call human nature in actuality is human habit
>>>> http://gleamynode.net/
>>>> _______________________________________________
>>>> netty-users mailing list
>>>> netty-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>>
>>>>
>>>
>>
>> -- 
>> what we call human nature in actuality is human habit
>> http://gleamynode.net/
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
> 
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 293 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100614/28cf521c/attachment.bin 


More information about the netty-users mailing list