On 8/4/08, janandith jayawardena <[EMAIL PROTECTED]> wrote:
> Hi Toby,
>
>
>
>  >i see mainly 2 purposes for the suffix,:
>  >1. as an additional way of transporting a path like parameter
>  >2. as a hint for filenames for browsers when downloading a resource.
>  >eg, if your resource is addressable under /foo/bar.res and you want to
>  >provide a download link,
>  >you don't want to browser to store the file as 'bar.res'. so you add
>  >for example the original filename: /foo/bar.res/myfile.pdf
>
>
> does this mean if I have a html.jsp which is accessible using
>  http://localhost:8888/content/mynode.html.
>
>  If I have another file like test.txt in the same place html.jsp
>  http://localhost:8888/content/mynode.html/test.txt will download the file
>  according purpose 2.
no quite. if you have a file, eg. a document in
/content/mynode/file.bin which you
want to provide a download link, you write
<a href="/content/mynode/file.bin/My Report.pdf">report</a> for example.
sling selects the /content/mynode/file.bin as resource, but the
browser will store it under "My Report.pdf". this is just a convenient
way of suggesting a file name for browsers.

>  else in the purpose 1 to have a link to test.txt like a href in html.jsp.
>
>  In a script can I use suffixes instead of giving a browser path.
actually i don't know of a really good use case for suffixes as
parameters to be used in scripts.

>  > the "flush" attribute just specifies, that the output buffer is
>  > flushed before executing the include. usually you can leave this to
>  > 'false'. this has the advantage, that the output buffer is only
>  > comitted when it's either full, or the end of the response is reached.
>  > this allows the included script still to change response headers and
>  > allows for a better error handling. but it depends on the size of the
>  > output buffer, and you should not rely on an uncomitted buffer. as
>  > soon as you write directly on the response.getWriter() you need to
>  > flush the buffer before hand. otherwise you don't get the correct
>  > sequence of output.
>
>
> Is there a way I can know whether the buffer is flushed. can I get the
>  buffer in a script and check this.
afaik, there is not way of checking this. you can check if the
response was already comitted by response.isComitted() but this does
not reflect the actual state of the jsp output buffer. see:

http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletResponse.html#isCommitted()

regards, toby

>  On Mon, Aug 4, 2008 at 1:19 AM, Tobias Bocanegra
>  <[EMAIL PROTECTED]>wrote:
>
>
>  > On 8/3/08, janandith jayawardena <[EMAIL PROTECTED]> wrote:
>  > > Hi,
>  > >
>  > >  *replaceSuffix:*
>  > >
>  > >  I read the following blog post while exploring replaceSuffix for
>  > SLING-475.
>  > >
>  > >
>  > 
> http://weblogs.goshaky.com/weblogs/lars/entry/an_architecture_for_content_centric2
>  > >
>  > >  it says ,
>  > >
>  > >  "With the suffix you could for instance address parts of a resource."
>  > >
>  > >  under suffix: description.
>  > i see mainly 2 purposes for the suffix,:
>  > 1. as an additional way of transporting a path like parameter
>  > 2. as a hint for filenames for browsers when downloading a resource.
>  > eg, if your resource is addressable under /foo/bar.res and you want to
>  > provide a download link,
>  > you don't want to browser to store the file as 'bar.res'. so you add
>  > for example the original filename: /foo/bar.res/myfile.pdf
>  >
>  >
>  > >  How can I create a suffix for a resource and use it. I've tried to
>  > figure it
>  > >  out but it's still not clear.
>  > >  Perhaps a simple example will help.
>  > you can't "create" a suffix, you just use it, for example in a link or
>  > an image reference.
>  >
>  > >  *flush:*
>  > >
>  > >  What I have in mind about flush is that it completely erases everything
>  > that
>  > >  was created in the same script prior to flush="1" so that any formatting
>  > >  after flush will be the result of the jsp script.
>  > >
>  > >  I want to clear this  also. A simple example will help here too.
>  > no, you can't erase anything. flush means here: flush the buffer to
>  > the response.
>  >
>  > the "flush" attribute just specifies, that the output buffer is
>  > flushed before executing the include. usually you can leave this to
>  > 'false'. this has the advantage, that the output buffer is only
>  > comitted when it's either full, or the end of the response is reached.
>  > this allows the included script still to change response headers and
>  > allows for a better error handling. but it depends on the size of the
>  > output buffer, and you should not rely on an uncomitted buffer. as
>  > soon as you write directly on the response.getWriter() you need to
>  > flush the buffer before hand. otherwise you don't get the correct
>  > sequence of output.
>  >
>  > regards, toby
>  >
>

Reply via email to