Petals BC REST

Rework how HTTP headers are configured

Details

  • Type: Improvement Request Improvement Request
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.1-BC
  • Fix Version/s: 1.1.0-BC
  • Component/s: Provider mode
  • Security Level: Public
  • Description:
    Hide

    In the current version and previous, HTTP headers put in the HTTP request sent to the REST server are extracted from properties of the incoming JBI message. This has no sens, all technical information required to invoke a resource should be defined in SU.

    So, we propose to rework how HTTP headers are configured. They should be configured at SU level as:

    <jbi:jbi ...>
       <jbi:services ...>
          <jbi:provides ...>
             ...
             <rest:mapping>
                ...
                <rest:operation name="ged:consulter">
                   ...
                   <rest:headers>
                      <rest:header name="Accept">
                         <rest:constant>application/xml</rest:constant>
                      <rest:header>
                      <rest:header name="X-lol">
                         <rest:xpath>/metadatas/metadata</rest:xpath>
                      <rest:header>
                      <!-- Following value extractor will be implemented later if such use-case exists -->
                      <!-- <rest:header name="dummy">
                              <rest:jbi-header>machin</rest:jbi-header>
                           <header> -->
                   <rest:headers>
                   ...
                </rest:operation>
                ...
             </rest:mapping>
          </jbi:consumes>
       </jbi:services>
    </jbi:jbi>

    Two different value extractors will be implemented in a first time:

    • <rest:constant />: The given value is the value to use, as a constant,
    • <rest:xpath />: The value is extracted using the given XPath expression applied on the incoming XML payload.
    Show
    In the current version and previous, HTTP headers put in the HTTP request sent to the REST server are extracted from properties of the incoming JBI message. This has no sens, all technical information required to invoke a resource should be defined in SU. So, we propose to rework how HTTP headers are configured. They should be configured at SU level as:
    <jbi:jbi ...>
       <jbi:services ...>
          <jbi:provides ...>
             ...
             <rest:mapping>
                ...
                <rest:operation name="ged:consulter">
                   ...
                   <rest:headers>
                      <rest:header name="Accept">
                         <rest:constant>application/xml</rest:constant>
                      <rest:header>
                      <rest:header name="X-lol">
                         <rest:xpath>/metadatas/metadata</rest:xpath>
                      <rest:header>
                      <!-- Following value extractor will be implemented later if such use-case exists -->
                      <!-- <rest:header name="dummy">
                              <rest:jbi-header>machin</rest:jbi-header>
                           <header> -->
                   <rest:headers>
                   ...
                </rest:operation>
                ...
             </rest:mapping>
          </jbi:consumes>
       </jbi:services>
    </jbi:jbi>
    Two different value extractors will be implemented in a first time:
    • <rest:constant />: The given value is the value to use, as a constant,
    • <rest:xpath />: The value is extracted using the given XPath expression applied on the incoming XML payload.
  • Environment:
    -

Activity

Hide
Christophe DENEUX added a comment - Thu, 19 Jan 2017 - 18:29:44 +0100

Reworked in trunk

Show
Christophe DENEUX added a comment - Thu, 19 Jan 2017 - 18:29:44 +0100 Reworked in trunk

People

Dates

  • Created:
    Thu, 19 Jan 2017 - 15:09:19 +0100
    Updated:
    Tue, 24 Jan 2017 - 11:53:42 +0100
    Resolved:
    Thu, 19 Jan 2017 - 18:29:44 +0100