Read Http header in Flex

Hi, I have a Flex web application accessed through a portal by users
of different organisations.
When user logs on to portal, user can access the Flex application without further authentication. However I need to know user credentials
in order to control the functionality within the Flex app.
If I can read the Http Header when Flex app is initialised, I will get all the required info.
In jsp, I can use request.getHeader("")
What is the best way to read Http Headers from a Flex App?

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="load()">
<mx:Script>
        <![CDATA[
        public var xmlLoader:URLLoader=new URLLoader();
function load():void{
            var xmlString:URLRequest = new URLRequest("items.xml");
          xmlLoader.load(xmlString);
        xmlLoader.addEventListener(Event.COMPLETE,init);
   function init(event:Event):void{
       var xDoc:XMLDocument = new XMLDocument();
    xDoc.ignoreWhite = true;
   var  myXML:XML=XML(xmlLoader.data);  
   var fr:String=myXML.items.item[0].Value.toString();
]]>
    </mx:Script>
</mx:Application>
Suppose this is ur items.xml file
<items>
  <item>
    <name>jk</name>
    <Value>high</Value>
  </item>
  <item>
    <name>coat</name>
<Value>medium</Value>
  </item>
   <item>
<name>milk</name>
<Value>low</Value>
   </item>
</items>
May be u need some imports
Then the output will be :high(becoz items is  a xml list containing many xml nodes...item[0] is first xml node and Value is the element..toString methods converts it into a string)

Similar Messages

  • How to read http  header from Forms

    Hi,
    I have a forms application deployed on 10g AS. We are planning to integrate Oracle Identity management with our forms application. Currently, I access my forms application with an url, say http://hostname/forms/frmservlet?config=test. And, I get a Signon form, where I capture the logon and pwd, and specific to the user credential, I show another form. By integrating my appln with Identity management, I would be protecting my resource in the oracle access system, the WebGate component will do the backend authentication process along with the access server and the directoy service. Upon successful authentication, the DN form the LDAP repository (lets say the userid of my forms application) for the user is returned to the WebGate as http header information/cookie by the Access System. Now without altering the code in frmservlet Servlet, I need to capture the http header info (which contains the userid for the forms application of the user) in my default Signon form. How can I capture this?
    Can someone please help
    Regards,
    Suresh

    hi
    the following link may helpful to you
    http://e-docs.bea.com/wls/docs81/webserv/anttasks.html#1111537
    Regards
    Prasanna Yalam

  • SOAP Sender Adatper - Read custom http header field

    Hello,
    i try to read a custom http header into the dynamic configuration of a message - but it is not working as expected - in ASMA i configured to get the value of MYHEADER1 into XHEADERNAME1 - when testing with a MYHEADER1 value, the value is not put into XHEADERNAME1.
    Is it possible to get custom HTTP Headers in the message?
    bf
    franz

    I have quite the same problem!
    I try to make the receiver determination based on the content of XHeaderName1, but none of the Dynamic Configuration parameters is shown in the sxi_monitor.
    I've described my scenario in more detail in this thread
    http://scn.sap.com/message/13586532#13586532
    Does anyone have an idea?

  • How to read http cookies from adobe desktop Air app using flex/flash builder in AS 3.0 ??

    Im developing Adobe desktop air app where i need to read the session id from the cookie of a http request.
    I have found a property called URLRequest.manageCookies supported by AIR so i Hope there should be a way to read the cookies as well. Im Using Flash Builder 4.5
    Please provide any reference code or guide me for this research;
    searched a lot regarding on this web.
    Most results lead to local shared object or reading cookies fr a webpage using javascript and ExternalInterface.
    I want to read http cookies not Local shared Object and in a desktop AIR application.
    Im using Flash builder 4.5
    Thanks
    Hari

    Sorry, but you are at the wrong forum; this one is only for discussions on the forums themselves. The Air forums are here:
    http://forums.adobe.com/community/air

  • Custom Inserted HTTP Header not showing up in Iplanet Logs

    ALL:
    I have some iPlanet Enterprise/6.0 web servers sitting behind a LoadBalancer. The LoadBalancer is setup in an 'one-armed mode', and takes a client HTTP request passes it onto the server, but during this process, changes the client source IP to that of local static IP that the LoadBalancer has. Due to our setup we cannot change this.
    By changing the client source IP to a local address, we have lost any useful user session tracking that was done by source IP.
    To get around this, I have the LoadBalancer inserting an HTTP header with the client real source IP. Reading the NSAPI Programmer's Guide (Table 7-1 "http://docs.sun.com/source/816-5686-10/07_magnu.htm"), there is an option "%Req->headers.headername%" that can be used with 'flex-int' to log any header value.
    My output from snoop looks as follows:
    HTTP: ----- HyperText Transfer Protocol -----
    HTTP:
    HTTP: GET /plugin.do HTTP/1.1
    HTTP: OrigClientAddr:10.5.4.28
    HTTP: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
    HTTP: Accept-Language: en-us
    HTTP: Accept-Encoding: gzip, deflate
    HTTP: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
    HTTP:
    I have set the value to "%Req->headers.OrigClientAddr%" and it still does not show up in the log file. Any clues?
    Works fine in Apache with:
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{OrigClientAddr}i\" \"%{User-Agent}i\"" headerinsert
    CustomLog logs/access_log headerinsert

    Always nice to find resolution to one's own question.
    Fix was to change the header value to all lower case.
    From:
    "%Req->headers.OrigClientAddr%"
    To:
    "%Req->headers.origclientaddr%"

  • Custom Http header in remote object

    Hi, how to set custom http header in http request while using remote object in flex?

    Thank You, Patrick.
    You are best :)
    I read this APEX_WEB_SERVICE documentation before,
    but after I read once more time
    I found most important words "global variable g_request_headers".
    I think these variables must be described more in documentation.
    On APEX I did:
    1) Create New Page -> Form -> Form and Report On Webservice Results.
    2) Set all webservice paramters in page wizard.
    3) And create a new page process after submit:
    Begin
    apex_web_service.g_request_headers(1).name := 'username';
    apex_web_service.g_request_headers(1).value := ' ... ';
    apex_web_service.g_request_headers(2).name := 'password';
    apex_web_service.g_request_headers(2).value := ' ... ';
    End;
    4) It's most important that this process must be done before the webservice process.
    Good luck

  • SSRS web services 401 if you pass "Authorization" http header

    We use both SSRS 2008 R2 and 2012. When i access a report using url access (direct ssrs server hit) and add a "Authorization: Bearer xyzelkalklsjsdfalsjdf" http header, i get a 401 from somewhere in the request pipeline. I have a custom httpmodule
    registered at the top of the chain which does some OAuth related security checks. But when this header is included, the request never reaches the httpmodule. If i change the header slightly ex: "YAuthorization: ljlxzcvc..", then the request reaches
    the httpmodule and everything works. So obviously SSRS is looking for a particular header named "Authorization" and does something with it. Point to note: we have implemented a custom forms authentication module and we are doing some rich authorization
    using the extensible ssrs api. 
    Now my questions are:
    1. What is happening here? Who is acting on my request before my HttpModule registered on top in ssrs\reporting service\web.config gets it?
    2. How do i ensure my httpmodule executes before whatever component is terminating my request with a 401

    Sorry if this sounds like I am new to this but I am.
    So, the extended version is the format that would be used if you were not utilizing the files that the wsdl2java function creates?
    And this is done to when you want more flexibiility for the user to call your service?
    So, you would push to have the stub files used when you want to control how the web service is used?
    thanks for the feedback.

  • How to read file header/open filein binary mode

    i am using FileConnenction API to read from a file. how can i open a file in binary mode so that i can read file header. In other words i want to open a file in binary mode.

    You can always try looking at the [Header Signatures|http://www.techpathways.com/uploads/headersig.txt]. But it would probably be easier to adjust your application so it doesn't have to guess.
    ~

  • OIF11g - Help on sending user attributes in HTTP header

    Hello, I have a OIF11g setup configured for both IdP and SP. Upon successfull authentication against LDAP, I need to end some user attributes on the HTTP header to the SP application. I do no have OAM in my setup, so there is no option of Webgate or Policy Manager to do that. As far as I read the config doc, I'm in the impression that we need to write a custom authentication engine to accept user credentials and code to authenticate against LDAP and also add attributes to the response header.
    Before I go down that path, just wanted to confirm if anybody has done this with OIF?
    Thanks,
    Sunil.

    Bernhard:
    Actually the headers are not set to null. I have an intermediate index.jsp page which is the first page that is redirected to by the AM - it is this page which calls my LoginServlet.
    The value appears consistently on this index.jsp page but after it is forwarded to the LoginServlet it starts behaving inconsistently. I check the system.out log in my websphere /logs folder and that tells me that LoginServlet does not consistenly get these values from the header.
    The wierd part is that if I use cookies or attributes, it works perfectly - each time every time. However, only in the case of headers (which is the method i am required to do) it behaves inconsistently.
    ANY feedback/help on this would be really appreciated bern.. thanks..
    ~saahil

  • Which OAM setting for passing values in HTTP header to application

    Experts, what is the setting in OAM 11gR2 that is set to pass a userid pulled from a LDAP directory (which is already configured with OAM) as a HTTP Header to an application.
    This is typically in cases where OAM is protecting or providing to protected resources on a Web Server or application.
    Is this setting (in OAM) by default set to userid? I wanted to know exactly where and how to set this value in OAM Console settings.

    In the protected resource policy and protected authorization policy in the responses tab set parameters to return headers for example if you want to return userid under name set header name like user_name, type header and the value as $user.userid. By default I guess OAM_REMOTE_USER is set in the http headers which contains the user id.

  • External Web Service - User and password in HTTP header

    Hi!
    How is it possible to add user and password in the HTTP header in a external web service call? 
    I have created a "Portal Service from WSDL file - Client side" with the wizard in SAP Developer Studio.  I following the Java Development Guide - Web Service Security, and use the <i>secured service connection</i>.  I have also created a new <i>System Landscape</i>, but should the new system be based on HTTP, my own PAR or what?
    How can I check that the user and password is added to the HTTP header or the SOAP envelope? Do I have to scan http traffic with a proxy as Paros or can I find the request sent from SAP EP in the logs?
    Cheers
    Asle

    Hello All,
    I have been struggling a bit while putting a reasonable security framework on a jax-rpc style web service. I'm using JWSDP1.2 to set up the webservice. I've tried to outline my problem below. Please correct me where I'm wrong.
    I've been through the Sun's WS tutorials, but they are not really clear on security. However, from them I surmised that there are two decent authentication techniques. HTTP Basic and mutual authentication (MA) . Both have their drawbacks though. HTTP Basic suffers from poor encryption while MA is a bit difficult to set up on both client and server sides. Another problem with MA is that there is no central repository for users/passwords.
    OK, what I would really like to do is use my own user database to verify users/passwords i.e. use a HTTP Basic like authentication (but at application level) but run it over SSL for encryption. It seems simple, but is it possible?
    Also, I have noted that when I use HTTP Basic on the service side, and use a java client, then setting username/password has no effect. In other words, I can always access the web-service, even with wrong username/password.
    Sorry for the long post. Hope someone can help. Thanks.

  • Problem setting Unicode (utf-8) in http header using tomcat

    Hi:
    I am trying to set a file name in utf-8 to http header using the following code:
    response.setContentType("text/html; charset=utf-8");
    response.setHeader("Content-disposition", "attachment; filename=&#35299;&#27770;.zip");
    // I actually has file name in utf-8 here to set to the header, and I know that the name is correctly
    // and I also looked into the response object MimeHeaders object and saw the head is correctly there
    then write the content of zip file using ServletOutputStream.
    The problem I have is that the file name is not displayed correctly when prompted to save or open in the pop up window next. I found out using Fiddler that the request header is wrong:
    Content-disposition: attachment; filename=&#65533;zn&#65533;�.zip
    I am using Tomcat 5.0.28. Any idea how to get this working?
    Thanks in advance!

    You are setting the charset for the content to be UTF-8. (That is why the method is called setContentType.) But HTTP headers are not part of the content and so that has no effect on the header.
    The original specification for HTTP only allowed US-ASCII characters in headers. It is possible that more recent versions have features that allow for non-ASCII header data, but I don't know if that is the case or how you would use those features if they exist.

  • To block iplanet webserver version in http header

    Please let me know how to block the iplanet version being displayed in http header.
    I am using iplanet webserver 4.1 sp12

    Please refer to http://docs.sun.com/source/817-0533-10/rn41sp12.html#39181
    Hope this helps.

  • Adding custom information in HTTP Header in an outgoing request from GWWS

    Is there a way to send custom header information with the a webservice request (HTTP post) that happens via GWWS server?
    All the methods I read about deal with managing the soap envelop that gets sent.
    We are looking for ways which will allow us to put custom information in the headers.
    I am aware there is something we can do using the Salt Plugins.
    For example, we can write a Out bound plugin which has a capability of putting the "Authentication:Basic..." in the header.
    Then there is message conversion plugin which deals with transformation of message, which gives us control over the soap body.
    Is it possible to put information in the header for outgoing request (from GWWS) to a specific web service?
    Thanks and Sincere Regards,
    Mrugendra

    Maurice,
    Thanks for confirming this.
    It clarifies the doubts that I was having while reading through the documentation Xu pointed to.
    Yes, we need to add HTTP Headers (not SOAP header).
    For now we just need to add Basic Authentication HTTP Header for outbound service calls.
    We have developed a plugin to do that for now.
    And even if the salt plugin takes care of adding the Basic Authentication in the HTTP Header for outgoing calls, I guess we do not have any option to include some custom information in the HTTP Header which might be required in the future.
    At-least, not unless we request that enhancement.
    Bringing the plugin into our mix requires a lot of changes to our architecture including inclusion of AUTHSVR in the UBB,
    Which, in turn, makes it imperative to change the endpoint clients of our application.
    In addition to that, the incoming web service calls also need to include TUXEDO authentication information, which would again require either communicating the authentication information to the consumers of our service or device some kind of a proxy which would add the authentication information for all the incoming requests!
    With these facts in mind, we were wondering if we have an easier way to include the HTTP header information.
    As you say, Maurice, it seems it is not possible yet.
    Thank you again for your replies.
    Sincere Regards,
    Mrugendra

  • Passing username & password in HTTP Header

    Hi all,
    My 1st query.
    I want to access a url which asks for username & password.
    how can i put my username & password in the http header so that when i call that url it shouldn't ask for the username & password.can anyone plz show it as a piece of servlet code.
    Thanks,
    Neha

    I am uing the HttpUrlConnection and the way I set is using the "setRequestProperty()" method. The follwoing code snippet actually encodes the user + passwd and sets it in the HTTP header.
    if(this.user != null) {
    BASE64Encoder encoder = new BASE64Encoder();
    StringBuffer buf = new StringBuffer(user).append(":").append(this.passwd);
    String encoded = encoder.encode(buf.toString().getBytes());
    httpCon.setRequestProperty("Authorization", "Basic " + encoded);

Maybe you are looking for

  • JRockit Installation fails on Redhat ES 4

    Hello there, I'm trying to install JRockit 1.4.2_05 on a Redhat ES4 system. I'm aware that this is a very new distribution, based on Fedora Core 3 which I see someone else has had problems with from a previous post. How can I tell the difference betw

  • Workspace hangs when trying to open HFM applicaiton?

    hello, 2 weeks ago on multiple occasions users were unable to connect to our HFM application through Smartview. In all cases restarting all services corrected the issue. I didn't have a lot of time to trouble shoot prior to restarting to allow users

  • Forms demo for Oracle developer Suite 10.1.2.0.2

    Hello people, I have tried to follow the instructions for the form demo and have installed Oracle devleoper sute 10.1.2.0.2. In the instructions it instructs you to edit the %ORACLE_HOME%\forms\j2ee\formsapp\formsweb\WEB-INF\web.xml where %ORACLE_HOM

  • Import rename index not working

    I recently purchased a Nikon D3100, my first camera to shoot in RAW. Being a basic photographer, I wanted to use both jpeg+raw until I am more familiar with Raw. I started out importing jpeg+raw pairs with jpg as master into Aperture until I discover

  • Full screen mode with two displays ?

    I use a second Apple Display with my iMac. When you enter into "full screen" with an app with Lion does it only become full screen on one of your displays leaving the other screen un-effected?  Or, does it black out the other screen? When you are in