Foren

Get full path from DLFolder [resolved]

Dave Willis, geändert vor 14 Jahren.

Get full path from DLFolder [resolved]

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
I have uploaded some video files to the Document Library and I need someway to get the full path to them so I can embed them in a JSP but I'm not sure how to do that. There doesn't appear to a method in DLFolder or DLFolderLocalServiceUtil that does this. DLFolder.getPath() just returns the path within the Document Library. Suggestions? Thanks!
-Dave
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
Bump.
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
Ba-bump bump.
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
bump, bump, BUMP, BA-bump bump, ba-BUMP BUMP
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
Do I need to break out a full drum solo here?
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
I guess no one knows how to use the Document Library from an Action class. If I figure it out, I'll post it here for anyone that might need to know this in the future.
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
Nothing new to report yet. Still trying to figure it out.
thumbnail
Kumar **, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Junior Member Beiträge: 29 Beitrittsdatum: 07.07.09 Neueste Beiträge
Hi

May I know what type of video files u uploaded [ extensions]?
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
They are .m4v and will be played through a Flash player.
Cato Aune, geändert vor 14 Jahren.

RE: Get full path from DLFolder

New Member Beiträge: 9 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Dave,

you can have a look at the view.jsp in the Document Library. Around line 260 is the code for making the urls used in the Document Library, maybe that could help a little bit.


Regards,

Cato
thumbnail
Brett Swaim, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Regular Member Beiträge: 112 Beitrittsdatum: 14.04.06 Neueste Beiträge
If you know your DLFileEntry id, this works:

themeDisplay.getPathMain() + "/document_library/get_file?p_l_id=" + themeDisplay.getPlid() + "&folderId=" + fileEntry.getFolderId() + "&name=" + HttpUtil.encodeURL(HtmlUtil.unescape(fileEntry.getName()));
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
Thanks! I'm really close now. I modified my JSP to include the code you showed me and it seems to be generating the correct path. When I view source on the page I see this:

flashvars={vidfile:"/c/document_library/get_file?p_l_id=10140&folderId=13707&name=DLFE-3.m4v"}


If I copy that URL and paste it into my address bar it pops up asking me if I want to download the file or open it, so it's definitely the right path and the file exists. Unfortunately the video does not play and Tomcat gives me this error:

23:21:37,859 WARN  [PortalImpl:3051] Current URL /c/document_library/get_file?p_l_id=10140 generates exception: No DLFileEntry exists with the key {folderId=0, name=}


I don't understand why it thinks the folderId is 0 and the name is null. That data is quite clearly in the path. I tried escaping the ampersand using the HTML entity & but it made no difference.

If it makes a difference, and if you haven't already figured it out from the first line of code, this is being passed to a Flash player.
Dave Willis, geändert vor 14 Jahren.

RE: Get full path from DLFolder

Expert Beiträge: 301 Beitrittsdatum: 13.07.09 Neueste Beiträge
Okay, I just needed to HttpEncode() the entire URL to deal with that because of the way Flash uses ampersands to separate vars.
lm ni, geändert vor 12 Jahren.

RE: Get full path from DLFolder

New Member Beiträge: 2 Beitrittsdatum: 28.12.10 Neueste Beiträge
Hi ,I'm a chinese ,I'm not good at english! I do this like:

<div id="player2"><a href="">Get the Flash Player</a> to see this player.</div>
<script type="text/javascript">
var s1=new SWFObject("<%=renderResponse.encodeURL(renderRequest.getContextPath()+"/js/flvplayer.swf")%>","single","300","170","7");
s1.addParam("allowfullscreen","true");
s1.addVariable("file","<%=URLEncoder.encode(getVediotoPlayURL) %>");
s1.addVariable("image","<%=imagepath %>");
s1.addVariable("width","300");
s1.addVariable("height","170");
s1.addVariable('type', 'flv');
s1.write("player2");
</script>

use URLEncoder.encode() it will ok!

in java file like this:

multimedia.getCompanyId(), CompanyConstants.SYSTEM, path);
String contentType = "video/x-flv";
response.setContentType(contentType);
response.setHeader(
HttpHeaders.CACHE_CONTROL, HttpHeaders.CACHE_CONTROL_PUBLIC_VALUE);
response.setHeader(HttpHeaders.PRAGMA, HttpHeaders.PRAGMA_PUBLIC_VALUE);

String contentDisposition =
"attachment; filename=\"" + fileName + "\"";
response.setContentLength(contentLength);
response.setHeader(
HttpHeaders.CONTENT_DISPOSITION, contentDisposition);
write(response, is, contentLength);



In addition ,i want to know how do you get full path from DLFolder, thanks!