I used navigateToURL method to navigate to aspx web page. I used url request as Post method but when i check this in the webpage the http method turned to Get method. Any one please help. I loaded the Flex page into the windows application
This is most likely due to a security restruction. If you are executing navigateToURL from an AIR app, the POST will be treated as a GET. Please see the security notes at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateToURL()
Make sure your URLRequest object has URLVariables attached to it (even if the the variables are empty). If you have no data then the player will convert the POST to GET. This is normal, expected behavior.
http://mate.asfusion.com/forums/topic.php?id=70
Related
I have the HTML template resource "steg3rad.html" stored in my appcache manifest. In my javascript file I fetch the template file using an jQuery AJAX GET request. Sometimes jQuery adds a callback parameter to the GET request. This results in Chrome not managing to load the resource from the appcache, see screenshot below. This causes errors in my pages.
Why can Chrome/the appcache not handle the parameters?
It looks like the Ajax cache option is set to false.
I think the whole point with the callback parameter we see in the screenshot is to make each call unique, and there is little point in caching something that is always unique. (Read more about the cache option in the Ajax API documentation.)
So, essentially you're telling the browser to cache something in one place (the appcache manifest) and you're telling it to not cache that same thing in another place (the ajax request). Maybe you get the behavior you want if you remove the ambiguity by setting the Ajax cache option to true?
When making an HTTP request (using URLLoader, for example) that results in a redirect, is it possible to access any of the URLs in the redirect chain?
For example, let's say that the following happens:
We make a request to example.com/a.gif
example.com redirects to example2.com/b.gif
example2.com redirects to example3.com/c.gif
I've stared at the documentation for URLLoader and its various events for a while, and it doesn't seem like there's a way to either:
Instruct URLLoader to not follow redirects
Access any of the URLs involved after the initial request
Does anyone know if there's a way to do this? I'm not attached to using URLLoader, so if there's another class that supports this functionality, I'd be fine with using it.
Can anyone point me in the right direction? Thanks in advance!
Edit - I should clarify: I know how to detect the redirects outside of AS3 using a DOM debugger. I'm specifically interested in accessing the redirect chain within AS3. It would appear that it's possible using the AIR player via the HttpStatusEvent, but the relevant properties aren't available when using Flash Player.
Edit 2 - I've also tried using an HTTP client lib (as3httpclientlib, to be specific). This works except for the fact that it loads cross-domain policies from port 843 rather than by making an HTTP request to /crossdomain.xml. The context I'm working in requires the latter, so using something with Socket underlying it won't work unless there's a way to force Socket to load cross-domain policies from HTTP instead of port 843.
The redirects are generally in place because the original URL shouldn't be used anymore. The file doesn't exist at example.com/a.gif so in theory you don't need to know about it. Why do you need the intermediate request path?
I'm not aware of an actionscript way of finding the redirect chain for any request, but if you want to do it for a specific chain you can use HttpFox for Firefox, or hit f12 in google chrome and look at the network tab when making a request to the URL that redirects. This will only work if the client is redirected by the server to the new address (a HTTP 302 responce or similar.) If the server chooses to return the contents of example3.com/c.gif when someone's browser asks for example.com/a.gif there is nothing you can do.
I have an HTML page and it needs to send a POST request for another HTML page that's embedding a Flex application. How can I access the request body from that request in Flex?
Even though you say that you are POSTING a request from one HTML page to another; that is not actual what happens. The POST rewuest is sent to a server. That server may then process the request somehow and spit out a new HTML page. But, you cannot POST from one HTML page to another.
Since Flex is a client side technology, you cannot use a POST Request to pass data into it. You also wouldn't be able to access the POST request from Javascript as a parallel.
So, you can have your server process the data, and prepare it to send back to your Flex app. You could do this using FlashVars. If you have a greater data set, then you could somehow save the data to the server, and load it into the Flex app using HTTPService, RemoteObject, or WebService.
you can use FlashVar and External Interface to pass data from parent page to embeded Flex app
Please take a look on Communicating with the wrapper
Hopes that Helps
In the end I used a GET request and attached the data to the URL. I know it's ugly, but couldn't find any other way...
I have an application that connects to an AMF gateway exclusively (in a certain mode) and I have a service that renders some HTML that I want to display in a new window outside of the Flex application.
Is it possible, in Flex, to use navigateToURL to send an AMF object and open the response in a new window?
EDIT: More specifically, does anyone have insight into how an AMF request can be properly constructed in actionscript and sent via the POST data of a URLRequest?
UPDATE: Still looking for a clear spec for AMF that makes it obvious how to construct the service call related headers in AMF and what headers are required. Some guidance in this area would be helpful. I've done more reading and have seen some people talk about some custom solutions they have that work in a similar way to what I've mentioned above, although it seems like those solutions are guarded assets. But this further enforces my belief that this is quite possible.
I'd say no... Even if you could create an AMF packet by hand in AS3, how would you pass it to the URL using navigateToURL? How would the browser know how to handle the AMF values returned from your service call?
I suggest you call the AMF gateway service in your Flash app; do the processing that needs done; and then return a URL to the results. In the result handler method, you can open the URL using navigateToURL.
#Flextras is along the right lines - the AMF gateway in particular with AMFPHP isn't used with a URLRequest, instead you use the RPC remoting - most typically RemoteObject where you specify the receiving gateway (ie: endpoint or more generically the destination channel - but this one needs to be in your services-config which resides on the server), and you typically assign a responder to handle the result/failure events (in which your response is almost always a class marked as a [RemoteAlias]).
See: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/rpc/remoting/mxml/RemoteObject.html#includeExamplesSummary
I put together an applet that uploads images via as3httpclientlib to a servlet. The applet works fine in debug mode (through flash builder) and until today it worked when deployed.
From the servlet logs, it appears the servlet never receives the image(s) byte stream, therefore my hunch is the applet is not posting the multipart data.
Can anyone suggest what I should do next to find the cause of the problem?
I suppose you ran into problem described here:
In Flash Player 10 and later, if you
use a multipart Content-Type (for
example "multipart/form-data") that
contains an upload (indicated by a
"filename" parameter in a
"content-disposition" header within
the POST body), the POST operation is
subject to the security rules applied
to uploads:
The POST operation must be performed
in response to a user-initiated
action, such as a mouse click or key
press.
If the POST operation is
cross-domain (the POST target is not
on the same server as the SWF file
that is sending the POST request), the
target server must provide a URL
policy file that permits cross-domain
access.
So I think you should run your application using debugger and check Flex client logs for exceptions described above.