How to add a link to a file stored in directory?

2013-06-04 Thread Petr Janata
Hi,

thanks for links with ideas. I am new in Tapestry I use Example
App
from
Jumpstart tutorial . I added File
Upload
to
Example App and HSQL table for uploaded file names. In Example App is
used Protecting
Pages
and
I can not download uploaded file by simple href even if I am logged in as a
admin user.

How to allow to download file from upload-path?

I use simple link in  tml file

download

and I also added  onReturnStreamResponse into java file from jumpstart
tutorial from this link.

StreamResponse onReturnStreamResponse() {
return new StreamResponse() {
InputStream inputStream;

@Override
public void prepareResponse(Response response) {
ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
inputStream =
classLoader.getResourceAsStream("regoznapp/enterprise/src/main/resources/return.txt");

// Set content length to prevent chunking - see
//
http://tapestry-users.832.n2.nabble.com/Disable-Transfer-Encoding-chunked-from-StreamResponse-td5269662.html#a5269662

try {
response.setHeader("Content-Length", "" +
inputStream.available());
}
catch (IOException e) {
// Ignore the exception in this simple example.
}
}

@Override
public String getContentType() {
return "text/plain";
}

@Override
public InputStream getStream() throws IOException {
return inputStream;
}
};
}

Petr


How to add a link to a file stored in directory?

2013-05-30 Thread Petr Janata
Hi I have table with file names. I need to add link for files stored in 
directory to download them.


Any idea?

Petr

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



How to add a link to a file stored in directory

2013-05-30 Thread Petr Janata
Hi I have table with file names. I need to add link for files stored in 
directory to download them.


Any idea?

Petr

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org