I have a website that have an integration against an Alfresco installation through CMIS. The problem is that the content-url that I get from Alfresco is ugly. The major problem is that the filename is "content.xxx" (xxx-being the file-extension).
In another project we have solved this by streaming the document through the website and then to the visitor, but for this case (internal web) that doesn't make any sence and only introduce another source for problems. But I can't make the user to accept content.xxx as filename for all files they are going to use so I need a way to fix this.
Is streaming the file through the website my best choise after all?
It appears that you may be using the deprecated CMIS URLs. When I get the content stream for an object named "test.txt" using the appropriate CMIS URLs and the AtomPub binding (/alfresco/cmisatom) I use the following URL:
/alfresco/cmisatom/1b8980cc-1f1b-4ac3-b26f-17aeee0cefc9/content/test.txt?id=workspace%3A%2F%2FSpacesStore%2Fc20d54f9-01b6-4c80-861b-094c2246ab21%3B1.0
If I then connect using the deprecated URL (/alfresco/s/api/cmis) the content stream URL becomes:
/alfresco/s/cmis/s/workspace:SpacesStore/i/c20d54f9-01b6-4c80-861b-094c2246ab21/content.txt
Can you double-check that you are using the non-deprecated URL and see if this addresses your issue?
Related
I am using an Azure static web app to host a website. I want to host the apple file on the backend for deep linking. I am running into the problem however that the apple documentation requires there is no extension on the file when it is uploaded. I have tried to override the content-type / mime methods to "application/json" via route rules, general headers, and extension rules. Nothing seems to change this file from being retrieved with the content type "application/octet-stream". Any guidance on how to get these two implementations to work together would be amazing. Thank you in advance.
Edit the file metadata to set the content type.
Are you using CloudFront? If so, be sure to invalidate the cache for this file.
I have a fileshare server (from apache opencmis project) that I want to access directly by a web page. So by using javascript probably. My question is :
-Is it possible to work on a cmis repository using http request (like here for alfresco server)?
I find that there is very few information on the subject.
Thanks
edit : Maybe my need isn't clear after reading me again. So to simplify I'm looking for a litle static html/javascript code. My purpose is to upload a new file to folder (I know his ObjectId) or modify content of a file.
Ps : Only LGPL, Apache or similar licence.
Thanks again!
There is a rudimentary example here:
https://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/src/main/webapp/web/index.html?view=markup
I´m making a web application in MVC, I have a view where I select a file from my pc directory (like opendialog form in windows applications), bootstrap´s fileupload gets the file name but I want to know his physical path to. Because I want to save it in my data base (where file come from).
Anybody can help me??
Thank you in advance!
You can't, this information is never sent to the server for obvious security reasons. Only the filename is sent to the server. So you cannot store the physical path where the file originated from the client machine on your server.
When you upload a file via a web browser, the actual file path is not supplied. This is seen as being a security feature.
There is no way to circumvent this using pure HTML. Some people get around it by using a plugin such as Flash or Silverlight to upload the file, but I recommend living with this feature if you can.
I am trying to download the given URL:
http://www.addic7ed.com/original/9521/7
but when i try to download the file using my Java Code:
URL url = new URL("http://www.addic7ed.com/original/9521/7");
ReadableByteChannel rbc = Channels.newChannel(url.openStream());
FileOutputStream fos = new FileOutputStream("abc.srt");
fos.getChannel().transferFrom(rbc, 0, 1 << 24);
The html page gets downloaded whereas the file to be downloaded should be a .srt extension file.
But when I try to download the above link using Internet Download Manager the file gets downloaded.
IDM converts the above given URL into http://www.addic7ed.com/srtcache/Supernatural/Supernatural%20-%2004x06%20-%20Yellow%20Fever.720p%20CTU.English.orig.Addic7ed.com.srt
So my question is how to achieve this in JAVA...?? Are there any API available to achieve this.
Have you looked at the HTML file? I suspect that it is actually an error page from the server, and that it contains clues about what is actually going on.
Here are some possibilities:
Maybe you need to supply authentication credentials.
Maybe the server is sending a redirect (3xx) response, and that the client side is not performing the redirect.
Maybe you need to set some extra headers to make the server realize that it should not turn the response as HTML. For example, an Accept header.
But note that the details will depend on the server that you are trying to talk to.
If I was trying to download files programmatically in Java, I would either use HttpUrlConnection or the Apache HttpClient libraries. Both will give you more control over the download process than simply using URL.openStream()
This is probably because the http response from http://www.addic7ed.com/original/9521/7 is a 302 redirect which your java code is not correctly handling. IDM correctly handles the redirect. A great tool to use if you are on a *nix based systme, or have cygwin installed on windows is curl.
curl -v http://myurl
will display all the http traffic information (request/response)
Have you tried with?
URL url = new URL("http://www.addic7ed.com/original/9521/7");
Good day lovely computer peoples!
I've uploaded a .dmg file to my server, but when I test to see if it is downloadable by pointing the web browser to it's place in the directory (i.e. using it's URL) I get a 404.
Any possible ideas of why this could be happening?
Thanks
EDIT 1
I realize that the 404 means that it can't find the item, but I'm staring at both addresses (the one in the browser and the one in the FTP client that I use) and they seem identical. I have some underscores in the name of the .dmg. Could that be the problem?
You need to make sure you add a mime type for the file extension. Most servers now days do not allow access to files that don't have explicit file extension declarations in their list of mime types.
You didn't say what server you're using so I can't give you specific instructions on how to do it but in most servers it's fairly easy. Just google your webserver name and "add mime type" with the quotes.
The myfile.dmg is not found. Double check the file location and the URL you are pointing to.