REST DSL Support for default headers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

REST DSL Support for default headers

Bob Paulin-2
Hi,

Within https://issues.apache.org/jira/browse/CAMEL-9312 support was
added for defaulting query string values in the REST DSL.


Other frameworks such as spring mvc also provide support for this in the
header fields.

@RequestMapping(value = "/test")
public String test(@RequestHeader(value="X-SOME-HEADER", defaultValue="A
VALUE") String someHeader)

In camel this is possible however when the route is called the default
value is not set from the rest definition.

.param()
    .name("X-SOME-HEADER")
    .type(RestParamType.header)
    .defaultValue("A VALUE")
.endParam()


I could not find a reason this support was not included so I'm guessing
it would be a welcome addition.  Happy to help on a patch.

Thanks!

- Bob


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: REST DSL Support for default headers

Claus Ibsen-2
Hi Bob

Yeah sure you are welcome to create a JIRA and work on a patch (PR).
We love contributions.

On Fri, Jun 5, 2020 at 5:13 PM Bob Paulin <[hidden email]> wrote:

>
> Hi,
>
> Within https://issues.apache.org/jira/browse/CAMEL-9312 support was
> added for defaulting query string values in the REST DSL.
>
>
> Other frameworks such as spring mvc also provide support for this in the
> header fields.
>
> @RequestMapping(value = "/test")
> public String test(@RequestHeader(value="X-SOME-HEADER", defaultValue="A
> VALUE") String someHeader)
>
> In camel this is possible however when the route is called the default
> value is not set from the rest definition.
>
> .param()
>     .name("X-SOME-HEADER")
>     .type(RestParamType.header)
>     .defaultValue("A VALUE")
> .endParam()
>
>
> I could not find a reason this support was not included so I'm guessing
> it would be a welcome addition.  Happy to help on a patch.
>
> Thanks!
>
> - Bob
>


--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: REST DSL Support for default headers

Bob Paulin
Thanks!  Created https://issues.apache.org/jira/browse/CAMEL-15163

- Bob

On 2020/06/06 05:21:24, Claus Ibsen <[hidden email]> wrote:

> Hi Bob
>
> Yeah sure you are welcome to create a JIRA and work on a patch (PR).
> We love contributions.
>
> On Fri, Jun 5, 2020 at 5:13 PM Bob Paulin <[hidden email]> wrote:
> >
> > Hi,
> >
> > Within https://issues.apache.org/jira/browse/CAMEL-9312 support was
> > added for defaulting query string values in the REST DSL.
> >
> >
> > Other frameworks such as spring mvc also provide support for this in the
> > header fields.
> >
> > @RequestMapping(value = "/test")
> > public String test(@RequestHeader(value="X-SOME-HEADER", defaultValue="A
> > VALUE") String someHeader)
> >
> > In camel this is possible however when the route is called the default
> > value is not set from the rest definition.
> >
> > .param()
> >     .name("X-SOME-HEADER")
> >     .type(RestParamType.header)
> >     .defaultValue("A VALUE")
> > .endParam()
> >
> >
> > I could not find a reason this support was not included so I'm guessing
> > it would be a welcome addition.  Happy to help on a patch.
> >
> > Thanks!
> >
> > - Bob
> >
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>