incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravindra Bharathi <srbharat...@gmail.com>
Subject Re: updating ApacheFlexSDK URL in Om's installer
Date Thu, 26 Jul 2012 16:40:21 GMT
Could something like the below be included as part of the Flex installer
code to parse the mirror site ?

*declare the service that'll fetch the url*

<fx:Declarations>
 <!-- Place non-visual elements (e.g., services, value objects) here -->
<fx:String id="flex_repo" >
http://www.apache.org/dyn/closer.cgi/incubator/flex/4.8.0-incubating/apache-flex-sdk-4.8.0-incubating-bin.zip
</fx:String>
 <s:HTTPService id="getMirrorService" resultFormat="text"
   result="getMirrorService_resultHandler(event)"
   fault="getMirrorService_faultHandler(event)" />
</fx:Declarations>

*Fetch the html* from
http://www.apache.org/dyn/closer.cgi/incubator/flex/4.8.0-incubating/apache-flex-sdk-4.8.0-incubating-bin.zip
(or from http://www.apache.org/dyn/closer.cgi/incubator/flex/ )

protected function getMirrorURL():void
{
// logStr +="Get Mirror Site\n";
 getMirrorService.url=flex_repo;
getMirrorService.send();
}

*Parse the html to sniff out the first mirror site*

protected function getMirrorService_resultHandler(event:ResultEvent):void
{
 var resultStr:String=event.result.toString();

//get to the part that says 'we suggest the following mirror site for your
download:'

var i:int=resultStr.indexOf("site for your download:</p>");
//get the next href link after this text
var j:int=resultStr.indexOf("<a href=",i);
var k:int=resultStr.indexOf(">",j);
 var mirror_site:String=resultStr.substring(j+9,k-1);
// if you use the zip file as the url for the fetch_mirror service , split
the link into path and file
 var l:int=mirror_site.lastIndexOf("/");
var fileName:String=mirror_site.substring(l+1,mirror_site.length);
 var filePath:String=mirror_site.substring(0,l+1);

//set the file and path of file node with name=ApacheFlexSDK
 var x:XMLList=configXML.files.file.(attribute("name")=="ApacheFlexSDK");
x.@path=filePath;
 x.@file=fileName;
   /*write config file back if necessary - if used as an external wrapper */
//writeConfigFile();
}


On Fri, Jul 27, 2012 at 12:09 AM, Carol Frampton <cframpto@adobe.com> wrote:

>
>
> On 7/26/12 12 :04PM, "Daniel Shahaf" <d.s@daniel.shahaf.name> wrote:
>
> >Try this link: http://www.apache.org/dyn/closer.cgi/incubator/flex/
> >
> >I'm pretty sure there is a query string parameter you can add to make it
> >do a redirect, too, rather than just tell you what the preferred mirror
> >is.
> >
> >Thanks for asking,
> >
> >Daniel
> >
> >Carol Frampton wrote on Thu, Jul 26, 2012 at 08:56:37 -0700:
> >> {sent on behalf of Erik de Bruin <erik@ixsoftware.nl> who is a member
> >>of flex-dev}
> >>
> >> Hi all,
> >>
> >> I'm writing on behalf of the Apache Flex (incubating) community. We're
> >> working on a tool that helps an end-user to download and install our
> >> binaries to the correct location on their system for use in an IDE.
> >>
> >> We would like to do this the proper way, which in our understanding is
> >> by using a dynamically assigned download mirror instead of a
> >> hard-coded link. I've read all of the documentation I could find and
> >> I've come up with the following solution:
> >>
> >> 1. create a wrapper around the generic 'mirrors.cgi', as described in
> >>[1];
> >> 2. create a HTML file containing only the tag: [preferred]. We need
> >> only one mirror URL as this is an automated download process;
> >> 3. place these two in the root of our project site;
> >> 4. call the wrapper CGI as a web service from our application, and use
> >> the result for the domain section of the URL.
> >>
> >> My questions:
> >> - is this a valid solution?
> >> - is there an 'easier' way to get a single dynamic mirror URL?
> >> - what did I miss, what did I forget to ask?
> >>
> >> Thank you very much for your assistance and patience,
> >>
> >> EdB
> >>
> >> [1] http://www.apache.org/dev/release-download-pages.html
> >> </message>
> >>
> >> EdB
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message