0 Replies Latest reply on Jul 17, 2006 8:16 AM by Alejandro_Stornelli

    i can't found my request attributes in FlexContext.getHttpRequest()

    Alejandro_Stornelli

      I´m including an swf (the compiled version of my mxml page) in a jsp which is part of my Struts application, like this:

      <embed pluginspage=' http://www.macromedia.com/go/getflashplayer'
      width='750'
      height='200'
      src=' http://pc8251e:7001/samples/pruebasAle/chooser.swf'/>

      This is the chooser.mxml

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      layout="absolute"
      creationComplete="{myClientillo.getList()}">


      <mx:RemoteObject id="myClientillo" destination="chooserProvider"
      showBusyCursor="true" />

      <mx:DataGrid height="200" width="750" dataProvider="{myClientillo.getList.lastResult}" >
      <mx:columns>
      <mx:Array>
      <mx:DataGridColumn dataField="id" headerText="Id"/>
      <mx:DataGridColumn dataField="campo1" headerText="Nombre"/>
      <mx:DataGridColumn dataField="campo2" headerText="Apellido"/>
      </mx:Array>
      </mx:columns>
      </mx:DataGrid>

      </mx:Application>

      I' ve configured in the remoting-config.xml the Remote Object chooserProvider like this:

      <destination id="chooserProvider" >
      <properties>
      <source>samples.providers.ChooserProvider</source>
      <scope>application</scope>
      </properties>
      </destination>

      In the samples.providers.ChooserProvider.java, I want to acces the attributes that are setted in the HTTP request. I tried using the FlexContext.getHttpRequest() and the FlexContext.getFlexSession(), but the attributes doesn´t exist. Here is the code of the ChooserProvider.java

      public Object[] getList()
      {

      System.out.println("OTRA VEZ EN ChooserProvider.getList()");

      HttpServletRequest req = FlexContext.getHttpRequest();

      FlexSession flxSession = FlexContext.getFlexSession();

      System.out.println("FlexContext.getHttpRequest(): "+req);
      System.out.println("FlexContext.getFlexSession() : "+flxSession);

      Enumeration enum = req.getAttributeNames();
      while (enum.hasMoreElements()) {
      String element = (String) enum.nextElement();
      System.out.println(element+" <> "+req.getAttribute(element));
      }

      Enumeration en = flxSession.getAttributeNames();
      while (en.hasMoreElements()) {
      String element = (String) en.nextElement();
      System.out.println(element+" --> "+flxSession.getAttribute(element));
      }

      ArrayList list=new ArrayList();
      return list.toArray();

      }

      but this is the output in the console

      OTRA VEZ EN ChooserProvider.getList()
      FlexContext.getHttpRequest(): Http Request: /samples/messagebroker/amf
      FlexContext.getFlexSession() : flex.messaging.HttpFlexSession@1a0d111
      weblogic.servlet.network_channel.port <> 7001
      __flexSession --> flex.messaging.HttpFlexSession@1a0d111

      Where are the attributes that i have setted in the request in the previous page? How can I access them ?

      I'm using weblogic 8.1 and Flex 2 with Flex Data Services