Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
想用grails做一個檔案管理的系統
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
derekypp peng  
View profile   Translate to Translated (View Original)
 More options Nov 6, 7:45 pm
From: derekypp peng <derek...@gmail.com>
Date: Sat, 7 Nov 2009 08:45:06 +0800
Local: Fri, Nov 6 2009 7:45 pm
Subject: 想用grails做一個檔案管理的系統

想用grails做一個檔案管理的系統
請問要怎麼讓只有用戶A能下載 XXX.ZIP 檔
而用戶B卻沒有辦法下載

因為我想到 我給用戶A是一個下載網址 http://www.myproject/XXX.ZIP
雖然用戶B是看不到的,可是他從別人那邊把網址COPY過來 他就可以下載了


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex wang  
View profile   Translate to Translated (View Original)
 More options Nov 6, 7:48 pm
From: Alex wang <idea.w...@gmail.com>
Date: Sat, 7 Nov 2009 08:48:43 +0800
Local: Fri, Nov 6 2009 7:48 pm
Subject: Re: [grailsunion:696] 想用grails做一個檔案管理的系統

首先将你的下载文件不要放到一个普通目录里,最好的方式是放到非web目录里,然后所有的下载行为通过定义一个

def download = {
  //permission check
  //your download code with IO process from your private file directory

}

当然,如果文件较小,也可以放到数据库里,这样操作更方便一点。

2009/11/7 derekypp peng <derek...@gmail.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
derekypp peng  
View profile   Translate to Translated (View Original)
 More options Nov 6, 7:51 pm
From: derekypp peng <derek...@gmail.com>
Date: Sat, 7 Nov 2009 08:51:41 +0800
Local: Fri, Nov 6 2009 7:51 pm
Subject: Re: [grailsunion:697] Re: 想用grails做一個檔案管理的系統

Alex的意思是說在
def download = {
  //permission check  --> 這裡用session 來判斷*User* 有沒有登入 並且是不是有權限的User 者

}

可是為什麼要放在非web的目錄裡?

2009/11/7 Alex wang <idea.w...@gmail.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex wang  
View profile   Translate to Translated (View Original)
 More options Nov 6, 7:53 pm
From: Alex wang <idea.w...@gmail.com>
Date: Sat, 7 Nov 2009 08:53:38 +0800
Local: Fri, Nov 6 2009 7:53 pm
Subject: Re: [grailsunion:698] Re: 想用grails做一個檔案管理的系統

首先IO读取文件,文件无论放在哪里都能读取
第二,放到非web目录,终端客户就无法看到了,也就安全了.

当然了,这样做也是有代价的,就是性能会有所损失,可以考虑放到缓存里。

2009/11/7 derekypp peng <derek...@gmail.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
derekypp peng  
View profile   Translate to Translated (View Original)
 More options Nov 6, 7:57 pm
From: derekypp peng <derek...@gmail.com>
Date: Sat, 7 Nov 2009 08:57:27 +0800
Local: Fri, Nov 6 2009 7:57 pm
Subject: Re: [grailsunion:700] Re: 想用grails做一個檔案管理的系統

首先IO读取文件,文件无论放在哪里都能读取  ---> 能不能給段代碼參考一下
因為我不知道怎麼從c:\xxx.zip  轉換成 http:/myproject/zip 這樣作法
謝謝。

2009/11/7 Alex wang <idea.w...@gmail.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex wang  
View profile   Translate to Translated (View Original)
 More options Nov 6, 8:02 pm
From: Alex wang <idea.w...@gmail.com>
Date: Sat, 7 Nov 2009 09:02:34 +0800
Local: Fri, Nov 6 2009 8:02 pm
Subject: Re: [grailsunion:701] Re: 想用grails做一個檔案管理的系統

def download(address)
{
    def file = new FileOutputStream(address.tokenize("/")[-1])
    def out = new BufferedOutputStream(file)
    out << new URL(address).openStream()
    out.close()

}

这个是下载网页地址的,你修改一下就应该能用了,groovy做IO操作超简洁。

2009/11/7 derekypp peng <derek...@gmail.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
wang xin  
View profile   Translate to Translated (View Original)
 More options Nov 6, 11:34 pm
From: wang xin <xinwa...@gmail.com>
Date: Sat, 7 Nov 2009 15:34:18 +1100
Local: Fri, Nov 6 2009 11:34 pm
Subject: Re: [grailsunion:702] Re: 想用grails做一個檔案管理的系統

为什么不是filter呢?所有*.zip都经过一个判断用户权限的filter,如果有权限,就继续,没有权限,就转错误页面。

2009/11/7 Alex wang <idea.w...@gmail.com>

--
Xin Wang
xinwa...@gmail.com

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex wang  
View profile   Translate to Translated (View Original)
 More options Nov 7, 9:54 pm
From: Alex wang <idea.w...@gmail.com>
Date: Sun, 8 Nov 2009 10:54:59 +0800
Local: Sat, Nov 7 2009 9:54 pm
Subject: Re: [grailsunion:714] Re: 想用grails做一個檔案管理的系統

这个方式也可行 :)

2009/11/7 wang xin <xinwa...@gmail.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google