Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35795

Re: Rest parameter without value

From Jukka Lahtinen <jtfjdehf@hotmail.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Rest parameter without value
Date 2016-10-17 09:50 +0300
Organization A noiseless patient Spider
Message-ID <m34m4ba2pq.fsf@saunalahti.fi> (permalink)
References <m3lgxr8681.fsf@saunalahti.fi> <ntr9b4$1v2r$1@gioia.aioe.org> <m3lgxnh6fn.fsf@saunalahti.fi>

Show all headers | View raw


Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> writes:
> Arne Vajhøj <arne@vajhoej.dk> writes:
>> On 10/14/2016 8:28 AM, Jukka Lahtinen wrote:

>>> Now the request with a path parameter should in some occasions contain a
>>> parameter without a value.
>>> What I have tried looks essentially like this:
>>> String url = "http://machine/path/v3.0/{keyvalue}";

> I guess I'll try if this works when I just use
> url = "http://machine/path/v3.0/{keyvalue}?foo";
> when the valueless parameter is needed.

When I tested this against the real server application, it turned out
not to work as I expected.
I got it working when I used something like this:

        UriBuilder builder = UriBuilder.fromUri( url ).path( path ).
                        resolveTemplate( "keyvalue", keyvalue );
        WebTarget target = client.target( builder );
        if (foo) {
            target = target.queryParam( "foo", Boolean.TRUE);
        }
        Response resp = target.request().headers( buildHeaders()).get();

In other words, the QueryParam wasn't (or at least didn't need to be)
valueless after all, it worked with a Boolean value.
This may be a bug in the documentation of the server application.

In this case, the parameter that looked valueless isn't a key value, but
a switch that controls what the server application does if it doesn't
find the data in its database.

-- 
Jukka Lahtinen

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Rest parameter without value Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2016-10-14 15:28 +0300
  Re: Rest parameter without value Arne Vajhøj <arne@vajhoej.dk> - 2016-10-14 14:49 -0400
    Re: Rest parameter without value Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2016-10-17 08:48 +0300
      Re: Rest parameter without value Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2016-10-17 09:50 +0300
  Re: Rest parameter without value 4ndre4 <626401fd-4bc7-4f8f-b641-563ae0f72920@626401fd-4bc7-4f8f-b641-563ae0f72920.invalid> - 2016-10-14 21:16 +0100
  Re: Rest parameter without value Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2016-10-17 08:30 +0300

csiph-web