Adobe Content Server - set filename for .acsm file - adobe

I'm using Adobe Content Server (ACS) on our site. I would like to know is it possible in the process of generating GBlink to set filename of the .acsm file?
Right now every .acsm file that users downloaded has name "URLLink.acsm". I found only one mention of this problem on the forum but no solution is suggested. I'll appreciate any help.

This is actually possible and requires to you modify the web.xml file in the fulfillment.war package. If you open the .war package in a program such as 7-Zip, browse to WEB-INF where you can find web.xml. On or around line 110, you'll find this bit of code:
<servlet-mapping>
<servlet-name>URLLink</servlet-name>
<url-pattern>URLLink.acsm</url-pattern>
</servlet-mapping>
You'll want to change it to this:
<servlet-mapping>
<servlet-name>URLLink</servlet-name>
<url-pattern>*.acsm</url-pattern>
</servlet-mapping>
Then in your bookstore you can code URLLink.acsm in the GBLink to be anything you want such as: 'BlahBlahBlah.acsm'.

Unfortunately the only way you can do this is by essentially reverse-proxying the fetching of the ACSM file on behalf of the user - i.e. if you call out to the GBlink yourself, grab the file returned, and then push it on in response to the user's request.
In doing so you will need to set the Content-Type appropriately (application/vnd.adobe.adept+xml), and then you can finally do what you want to do by setting the Content-Disposition header explicitly, to arbitrarily name the file, for example:
Content-Disposition: attachment; filename=mycustomname.acsm
I've ended up doing this in some edge case code, not because I was particularly concerned about arbitrarily naming the file, but because certain mobile browsers, when requesting the GBlink to get the ACSM file directly, would insist on displaying the ACSM XML content directly in the browser. Setting a Content-Disposition: attachment to force download was the only way to solve that, and since Adobe Content Server itself is so inflexible, reverse-proxying the GBlink fetch was really the only way to arbitrarily change the headers on the ACSM response.

Related

Force file download in a browser using ASP.Net MVC when the file is located on a different server without downloading it on my server first

Here's what I would like to accomplish:
I have a file stored in Windows Azure Blob Storage (or for that matter any file which is not on my web server but accessible via a URL).
I want to force download a file without actually downloading the file on my web server first i.e. browser should automatically fetch the file from this external URL and prompts the user to download it.
Possible Solutions Explored:
Here's what I have explored so far (and why they won't work):
Using something like FileContentResult as described here Returning a file to View/Download in ASP.NET MVC to download the file. This solution would require me to fetch the contents on my server and then stream from my server to the browser. For this reason this solution won't work.
Using HTML 5 download attribute: HTML 5 download attribute would have worked perfectly fine however the problem is that while it is really a very neat solution, it is not supported in all browsers.
Changing the file's content type: Another thing I could do (at least for the files that I own) to change the content type property of the file to something that the browser wouldn't understand and thus would be forced to download the file. This might work in some browsers however not in all as IE is smart enough to go beyond the content type and sees the file's content to determine the content type. Furthermore if I don't own the files, then I won't have access to changing the content type of the file.
Simply put, in my controller action I should be able to specify the URL of the file and somehow browser should force download the file.
Is this something which can be accomplished? If yes, then any ideas how I could accomplish this?
Simply put, in my controller action I should be able to specify the URL of the file and somehow browser should force download the file [without exposing the URL of the file to the client].
You can't. If the final URL is to remain hidden, your server must serve the data, so your server must download the file from the URL.
Your client can't download a file it can't get the URL to.
You can create file transfer WCF service (REST) which will stream your content from blob storage or from other sources through your file managers to client browser directly by URL.
https://{service}/FileTransfer/DownloadFile/{id, synonym, filename etc}
Blob path won't be exposed, web application will be free from file transfer issues.

Reloading swf files in proxy server

consider my file
Test.mxml
output file
Test.swf
Each time i make some changes in Test.mxml corresoping swf file is generated.
But this is causing some problem in proxy server.
When i change the version of swf file generated its working fine(im able to see new changes as proxy server will load the new renamed file)(i tried versioning)
I cant see my changed swf file, its giving me cached swf file because of which the changes are not reflected.
A few approaches to handle this:
It may be possible to tell your proxy not to cache this file if you have any control over it.
Sometimes people use the "Random number" technique to prevent files from being cached. that is, in your HTML page that wraps your SWF; add a random number to the SWF location. Conceptually like this myswf.swf?someRandomNumber .
Every time you deploy a new build you could change the filename.
You can also try having your browser send the no-cache headers, which causes the (WebSphere Edge) proxy server to dump its cached copy too. In Firefox, at least, Shift-Reload does this. I think that's true in IE and maybe Chrome too.

Adding crossdomain to root of Azure blob storage

I am trying to access some assets on azure from flash. This requires a crossdomain file to be at the root of the blob, ie http://xxxxxxx.blob.core.windows.net/crossdomain.xml
I found that using Azure Storage Explorer there didn't seem to be a way of adding files to the root, I found this post http://www.odity.co.uk/articles/azure-crossdomain-xml-inside-root-of-blob-storage/ which details a programmatic approach. However I have implemented the code and tried to test and am getting the following error which suggests to me it may not be possible to add files to the root?
<Error>
<Code>OutOfRangeInput</Code>
<Message>
One of the request inputs is out of range. RequestId:5853bdc0-89ed-47f6-986e-f42badd38e75 Time:2012-06-13T09:37:58.0222882Z
</Message>
</Error>
Can anyone clarify if it is possible?
Could you post the code you're using to create the root container?
Besides that you could also use CloudBerry to create the $root container and upload files to it:
http://blog.cloudberrylab.com/2010/04/cloudberry-explorer-for-azure.html
an easy way to achieve this is to create a special (blobs) container named "$root" (root starting with a $ sign). In the url of anything placed in this container can be written as under the root, so instead of writing
http://{my-storage-url}/$root/myFile
you can use:
http://{my-storage-url}/myFile
Last step is copy to the crossdomain.xml file to the $root container. I use Visual Studio to manage files in the azure storage blobs.
see also
Working with the Root Container
Be careful when using crossdomain.xml, since it can render your site vulnerable to attacks.

How to serve resx file in ASP.NET?

How can i serve a locale appropriate .resx file to a http client in ASP.NET?
e.g.
GET /App_LocalResources/MeshModdler.resx
Background
i have a client-side binary that needs to ask a web-server for the appropriate language resources (i.e. it does not have all possible translations; it asks for the one it needs).
Right now the client-side binary prefers to be given an xml file containing all the localized resources (strings, etc). This XML file has a format that looks curiously like Microsoft's resx format (one might think the format was copied - and they would not be wrong).
Ideally we can use the power of an ASP.NET web-server to locate the appropriate resx file based on the http client's Accept-Language, e.g.
GET /App_LocalResources/MeshModdler.resx
Accept-Language: az-Cyrl-AZ
Ideally the web-server would try to return, in order of preference:
MeshModdler.az-Cyrl-AZ.resx
MeshModdler.az-AZ.resx
MeshModdler.az.resx
MeshModdler.resx
But instead the server returns:
HTTP/1.1 404 Not Found
Bonus Chatter
i know this is not possible. So in addition to a cannot be done answer, i would also accept an answer that just does what i want:
harnesses the power of an ASP.NET web-server to perform resource resolution and fallback
allows new localization resx files to be dropped into a folder and have them picked up
will not require resorting to creating a dummy page that builds what looks like a resx file, but has to thunk every entry with:
<root>
<data name="TesselateMesh.Caption">
<value><%$ Resources:MeshModdler, TesselateMesh.Caption1 %></value>
</data>
...
</root>
Additional Chatter
The hack for now will be to rename the resx files to xml:
MeshModdler.az-Cyrl-AZ.xml
MeshModdler.az-AZ.xml
MeshModdler.az.xml
MeshModdler.xml
And re-invent the fallback code:
GET /MeshModdler.az-Cyrl-AZ.xml
404 Not found
GET /MeshModdler.az-AZ.xml
404 Not found
GET /MeshModdler.az.xml
200 Ok
But it would be nice to work with ASP.NET, not against it.
You can create an ASHX file that takes a resource name file and looks up the correct .ResX file on the server. (moving your current fallback logic to /GetResource.ashx?Name=MeshModeler)

Download a file stored in database

I have file content in sql database as binary format and also saved the file with its extension .
I want to have pop up for save as ,so that client can save the file on her system in the same document format.
i.e if it .doc then it should get save in .doc format only.
Please provide the code for the same.
You need to
Set up IIS to to handle files of the types you want. For example, you need to map .pdf, .jpg, etc, to be handled by the ASP.net dll. Also is important to make sure "Verify file exists" is off: http://msdn.microsoft.com/en-us/library/bb515343.aspx
Create a HTTP Handler for the files to retrieve the binary from the database and .BinaryWrite it out to the output stream: http://www.developer.com/net/asp/article.php/3565541/Use-Custom-HTTP-Handlers-in-Your-ASPNET-Applications.htm
Set up your web.config file to map the file types required to the handler you created (this is detailed in the url provided for point 2)
You say that you want it to open as a download box, and not just open in the browser. To do this you have to use the content-disposition HTTP header. So in your custom handler you write, make sure to add a header specifiying the content-disposition as attachment. http://support.microsoft.com/kb/260519 will tell you what you need.
I want to have pop up for save as ,so
that client can save the file on her
system in the same document format.
i.e if it .doc then it should get save
in .doc format only.
You take care of this when you write out the content disposition HTTP header. Refer to the MS link I provided and make sure you specify a filename with the correct extension.
Also note the comments above. If this helps you, you need to accept it as the answer. Also go back and accept some answers on your older questions. Otherwise people are not inclined to help you. I will help you again if you mark this as answer, or leave me a comment about why it does not answer your question.
Good luck
bgs264

Resources