This discussion is archived
11 Replies Latest reply: Nov 18, 2005 12:40 AM by 391516 RSS

how to accress header attributes in HTMLDB

391516 Newbie
Currently Being Moderated
Hi,
I want to access some information which is in HTTP header. I can do it in JSP as request.getHeader(''some_attribute_name");
How will I do it in HTMLDB???

Thanks in advance

regards
Kaushik Sen
  • 1. Re: how to accress header attributes in HTMLDB
    451057 Newbie
    Currently Being Moderated
    Hi Kaushik,

    You can use owa_util.get_cgi_env. There are a couple of releated procedures in the package.

    Regards Pete
  • 2. Re: how to accress header attributes in HTMLDB
    VANJ Journeyer
    Currently Being Moderated
    I dont think that will work. He is looking for HTTP header values, not CGI environment variables.

    To the OP: Why would you need HTTP header values?

    As far as I know, the mod_plsql/OWA generates only 2 headers
    Content-type: text/html
    Content-length: nn
    Thanks
  • 3. Re: how to accress header attributes in HTMLDB
    DietmarAust Oracle ACE
    Currently Being Moderated
    I agree with Pete on this one.

    These are some of the most common values used in JSPs/Servlets:

    AUTH_TYPE request.getAuthType()
    CONTENT_LENGTH request.getContentLength()
    CONTENT_TYPE request.getContentType()
    DOCUMENT_ROOT getServletContext().getRealPath()
    PATH_INFO request.getPathInfo()
    PATH_TRANSLATED request.getPathTranslated()
    QUERY_STRING request.getQueryString()
    REMOTE_ADDR request.getRemoteAddr()
    REMOTE_HOST request.getRemoteHost()
    REMOTE_USER request.getRemoteUser()
    REQUEST_METHOD request.getMethod()
    SCRIPT_NAME request.getServletPath()
    SERVER_NAME request.getServerName()
    SERVER_PORT request.getServerPort()
    SERVER_PROTOCOL request.getProtocol()
    SERVER_SOFTWARE getServletContext().getServerInfo()
    HTTP_REFERER by request.getHeader("Referer")
    HTTP_COOKIE by request.getHeader("Cookie")
    HTTP_USER_AGENT by request.getHeader("User-Agent")

    And those variables are accessible via owa_util.get_cgi_env():
    'SERVER_SOFTWARE';
    'SERVER_NAME';
    'GATEWAY_INTERFACE';
    'REMOTE_HOST';
    'REMOTE_ADDR';
    'AUTH_TYPE';
    'REMOTE_USER';
    'REMOTE_IDENT';
    'HTTP_ACCEPT';
    'HTTP_USER_AGENT';
    'SERVER_PROTOCOL';
    'SERVER_PORT';
    'SCRIPT_NAME';
    'PATH_INFO';
    'PATH_TRANSLATED';
    'HTTP_REFERER';
    'HTTP_COOKIE';

    They match pretty well, although I am not sure whether you can access all http header variables (in addition to the list above) using owa_util.get_cgi_env.

    Are the ones you need missing from the list?

    Regards,
    ~Dietmar.

    Message was edited by:
    daust_de
  • 4. Re: how to accress header attributes in HTMLDB
    451057 Newbie
    Currently Being Moderated
    For a full list try this. Go to the SQL Workshop>SQL Commands and run this:
    begin
    owa_util.print_cgi_env;
    end;
  • 5. Re: how to accress header attributes in HTMLDB
    391516 Newbie
    Currently Being Moderated
    Thanks, a bit more detail is required. Actually I am developing an application in HTMLDB and this application needs to be integrated with SiteMinder. I need various information through SiteMinder variables which will be avilable to me through HTTP Headers, for example SM_USER, SM_AUTHORIZED etc.

    Can I do some thing like owa_util.get_cgi_env("SM_USER"), like this I want to access the siteminder variables which will be in Header attributes.. Is this possible... Please help.

    regards
    Kaushik Sen
  • 6. Re: how to accress header attributes in HTMLDB
    60437 Employee ACE
    Currently Being Moderated
    You might want to research how to use the utl_http package.

    Scott
  • 7. Re: how to accress header attributes in HTMLDB
    DietmarAust Oracle ACE
    Currently Being Moderated
    Hi,

    now we're getting somewhere :).

    This can easily be done by adding these variables to the DAD configuration so that they will be passed to the stored procedure.

    After configuration you should be able to access them via owa_util.get_cgi_env("SM_USER").

    Here is an example on how to pass additional header variables to the procedure:
    (look for PlsqlCGIEnvironmentList )

    <Location /pls/DAD_name>
    SetHandler pls_handler
    Order deny,allow
    AllowOverride None
    PlsqlDatabaseConnectString hostname:port:SID
    PlsqlDatabasePassword schema_password
    PlsqlDatabaseUsername schema_name
    PlsqlDefaultPage schema_name.show_user_info
    PlsqlDocumentTablename schema_name.wwdoc_document
    PlsqlDocumentPath docs
    PlsqlDocumentProcedure schema_name.wwdoc_process.process_
    download
    PlsqlAuthenticationMode Basic
    PlsqlPathAlias url
    PlsqlPathAliasProcedure schema_name.wwpth_api_alias.process_
    download
    PlsqlSessionCookieName schema_name
    PlsqlCGIEnvironmentList OSSO-USER-DN
    PlsqlCGIEnvironmentList OSSO-USER-GUID
    PlsqlCGIEnvironmentList OSSO-SUBSCRIBER
    PlsqlCGIEnvironmentList OSSO-SUBSCRIBER-DN
    PlsqlCGIEnvironmentList OSSO-SUBSCRIBER-GUID
    </Location>

    Reference: http://www.boku.ac.at/oradoc/ias/10g(9.0.4)/manage.904/b10852/mod_osso.htm

    You can also find more information on using mod_plsql and cgi environment variables here:
    http://manuals.it.swin.edu.au/oracle10.1/server.101/b12303/concept.htm#1006127
    http://manuals.it.swin.edu.au/oracle10.1/server.101/b12255/confmods.htm#1014712

    Please let us know whether it works.

    Greetinx,
    ~Dietmar.
  • 8. Re: how to accress header attributes in HTMLDB
    DietmarAust Oracle ACE
    Currently Being Moderated
    Another thought ...

    If you are using Oracle Application Server and the OID for Single Sign On (as well somewhere else) then should be able to integrate OID with Siteminder quite easily.

    And for HTML DB you could then simply protect your application as a partner application to Oracle Single Sign On - everything right out of the box, no coding.

    Just in case you use it.

    Regards,
    ~Dietmar.
  • 9. Re: how to accress header attributes in HTMLDB
    391516 Newbie
    Currently Being Moderated
    thanks for ur valuable help!!! I am not using any application server, the environment is HTMLDB, modpl/sql, and Oracle HTTP server . Just let me know how should I add the SiteMinder variables in DAD using HTMLDB. I am new to it.

    Thanks in advance
    Kaushik
  • 10. Re: how to accress header attributes in HTMLDB
    DietmarAust Oracle ACE
    Currently Being Moderated
    Hi Kaushik,

    sure.

    Look at your dad configuration in your Oracle Http server home, usually the file marvel.conf or dads.conf.

    1) Modify your DAD as shown below.
    <Location /pls/htmldb>
        Order deny,allow
        PlsqlDocumentPath docs
        AllowOverride None
        PlsqlDocumentProcedure wwv_flow_file_manager.process_download
        PlsqlDatabaseConnectString localhost:1521:o1020
        PlsqlNLSLanguage AMERICAN_AMERICA.WE8ISO8859P1
        PlsqlAuthenticationMode Basic
        SetHandler pls_handler
        PlsqlDocumentTablename wwv_flow_file_objects$
        PlsqlDatabaseUsername HTMLDB_PUBLIC_USER
        PlsqlDefaultPage htmldb
        PlsqlDatabasePassword @BZvJYqadreElOqj5poCB5gE=
        Allow from all
        PlsqlErrorStyle ModplsqlStyle
        PlsqlCGIEnvironmentList SM_USER
    PlsqlCGIEnvironmentList SM_AUTHORIZED

    </Location>
    You can add additional variables by just adding another line with PlsqlCGIEnvironmentList .

    2) Then restart your Http-Server

    3) Try the steps from Pete's post before to see the variables:
    For a full list try this. Go to the SQL Workshop>SQL Commands and run this:
    begin
    owa_util.print_cgi_env;
    end;

    Now you should see the values of the two variables.

    4) Write a stored procedure using owa_util.get_cgi_env('SM_USER');

    That should be it.

    I have tested it, can see the variables and I can set it to fixed values. I can't test it with Siteminder since I don't use it.
    Does it work for you?

    ~Dietmar.
  • 11. Re: how to accress header attributes in HTMLDB
    391516 Newbie
    Currently Being Moderated
    Thanks a lot !!!! It works for me.
    regards
    Kaushik