users@jersey.java.net

[Jersey] Re: RequestURI vs AbsolutePath

From: Robert DiFalco <robert.difalco_at_gmail.com>
Date: Thu, 6 Feb 2014 16:19:05 -0800

Great suggestion on the filter. I'm not such a great Networking person and
was not familiar with a ContainerRequestFilter. I was pretty impressed with
myself that I was even able to figure out that heroku's LB was removing the
HTTPS scheme before forwarding to my server and that I could dynamically
determine this by grabbing "x-forwarded-proto" from the header. I only have
a few methods that generate a 303 response but I would *LOVE* not having to
parse out and recreate the URL scheme based on the x-forwarded-proto for
even these few cases. Seems messy. It would be just easier to use the
uriInfo.getAbsolutePathBuilder() to generate the SEE OTHER location. So it
seems like a filter could fix this up nicely in one central place.


On Thu, Feb 6, 2014 at 1:09 PM, Ted M. Young [@jitterted] <
tedyoung_at_gmail.com> wrote:

> I don't think it's bad form, seems reasonable if you need properties from
> both UriInfo and HttpHeaders. I wonder about doing that for "each method",
> though, perhaps a filter is appropriate here (e.g., ContainerRequestFilter)?
>
> ;ted
> --
> http://about.me/tedmyoung
>
>
> On Thu, Feb 6, 2014 at 12:44 PM, Robert DiFalco <robert.difalco_at_gmail.com>wrote:
>
>> Thanks!
>>
>> While I've got you, I need to get the request URI as well as the
>> x-forwarded-proto in a bunch of my REST server methods. Is it considered
>> bad form to do a "@Context ContainerRequest request" and should I instead
>> just do two context parameters in each method "@Context UriInfo info,
>> @Context HttpHeaders headers"?
>>
>> Any thoughts?
>>
>>
>>
>> On Thu, Feb 6, 2014 at 12:21 PM, Ted M. Young [@jitterted] <
>> tedyoung_at_gmail.com> wrote:
>>
>>> The Request URI includes any query parameters or fragments (#) segments.
>>> The Absolute Path is the same, but does not include the query parameters
>>> and fragments.
>>>
>>> ;ted
>>> --
>>> http://about.me/tedmyoung
>>>
>>>
>>>
>>> On Thu, Feb 6, 2014 at 12:07 PM, Robert DiFalco <
>>> robert.difalco_at_gmail.com> wrote:
>>>
>>>> I need a little guidance here? I'm not sure I understand the difference
>>>> between UriInfo#getAbsolutePathBuilder and UriInfo#getRequestUriBuilder.
>>>> When would I use one over the other?
>>>>
>>>> TIA
>>>>
>>>
>>>
>>
>