6 Replies Latest reply: May 3, 2013 4:28 AM by Klaus Linhard RSS

    X-APEX-STATUS-CODE

    Klaus Linhard
      Hello,

      i am running the following configuration:

      Oracle Database 11.2.0.3
      Application Express 4.2.1
      apex_listener.2.0.1.64.14.25 on Glassfish 3.01

      Everything related to the restful webservices works fine. But i cannot find where to set Parameter-Alias "X-APEX-STATUS-CODE" in the new listener.


      Regarding the following resource template (its an example related to the Apex Listener 1.1)

      URI Template - gallery

      HTTP Method - POST

      Handler Type - PL/SQL Block

      title      Slug      Header      IN      String
      status      X-APEX-STATUS-CODE      Header      OUT      Integer
      location      X-APEX-FORWARD      Header      OUT      String

      declare
      image_id integer;
      begin
      select scott.gallery_seq.nextval into image_id from dual;
      insert into scott.gallery
      values(image_id,:title,:contentType,:body);
      :status := 201;
      :location := 'gallery/' || image_id;
      end;

      How can i return the status (201) with the new listener because as i said, i cannot find where to set the alias as "X-APEX-STATUS-CODE"


      Thanks for your help !

      Kind Regards
      Klaus

      Edited by: Klaus Linhard on Apr 26, 2013 1:02 PM
        • 1. Re: X-APEX-STATUS-CODE
          AndyH
          >
          Everything related to the restful webservices works fine. But i cannot find where to set Parameter-Alias "X-APEX-STATUS-CODE" in the new listener.
          title      Slug      Header      IN      String
          status      X-APEX-STATUS-CODE      Header      OUT      Integer
          location      X-APEX-FORWARD      Header      OUT      String
          :status := 201;
          :location := 'gallery/' || image_id;
          How can i return the status (201) with the new listener because as i said, i cannot find where to set the alias as "X-APEX-STATUS-CODE"
          You create X-APEX-STATUS-CODE and X-APEX-FORWARD as OUT parameters bound to status and location (for the above code) within your 'POST' handler - I'm assuming that you're using the APEX front-end to do this configuration?
          • 2. Re: X-APEX-STATUS-CODE
            Klaus Linhard
            Yes, i create this configuration with APEX 4.2.1 front end but there is no possibilty to set the Alias (as it was in APEX_LISTENER 1...)

            Is it the "Source type = Response" which can be used for X-APEX-STATUS-CODE in APEX 4.2.1 ?

            --Klaus

            Edited by: Klaus Linhard on Apr 29, 2013 2:45 AM
            • 3. Re: X-APEX-STATUS-CODE
              AndyH
              Klaus Linhard wrote:
              Yes, i create this configuration with APEX 4.2.1 front end but there is no possibilty to set the Alias (as it was in APEX_LISTENER 1...)

              Is it the "Source type = Response" which can be used for X-APEX-STATUS-CODE in APEX 4.2.1 ?
              No.

              When you are looking at your POST handler, do you see a section on the right hand side, below the source code, called Parameters? This is where you declare the header field and bind it to a ':parameter' in your source code.
              • 4. Re: X-APEX-STATUS-CODE
                Klaus Linhard
                Hm, thats very unclear.
                I have the following post handler which works (returns the 201)

                Source:
                ...
                select 201 into :status from dual;
                end;

                Parameter:
                Name: status
                Bind Variable Name: status
                Access Method: OUT
                Source Type: Response
                Parameter Type: Integer

                When i change the Source Type to "Header" then it don't work.
                And again the question , where is the Alias "X-APEX-STATUS-CODE " we have in Apex-Listener 1. ?

                Thanks again for your help !

                Klaus
                • 5. Re: X-APEX-STATUS-CODE
                  Colm Divilly-Oracle
                  Klaus Linhard wrote:
                  Hm, thats very unclear.
                  I have the following post handler which works (returns the 201)

                  Source:
                  ...
                  select 201 into :status from dual;
                  end;

                  Parameter:
                  Name: status
                  Name: X-APEX-STATUS-CODE
                  Bind Variable Name: status
                  Access Method: OUT
                  Source Type: Response
                  Source Type: Header
                  Parameter Type: Integer

                  When i change the Source Type to "Header" then it don't work.
                  And again the question , where is the Alias "X-APEX-STATUS-CODE " we have in Apex-Listener 1. ?
                  The terminology has changed in 2.0.x, the term 1.1.x 'Name' => 'Bind Variable Name', 1.1x 'Aliasing' => 'Name'

                  The link below is to a screen shot that should make this clear:

                  https://dl.dropboxusercontent.com/u/74957972/parameters.png
                  • 6. Re: X-APEX-STATUS-CODE
                    Klaus Linhard
                    The screenshot is very helpful !

                    Thank you very much

                    - Klaus