You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Doug Chestnut <dh...@virginia.edu> on 2005/12/30 08:18:13 UTC

page envelope date format

Is there any reason why we can't change the date_format in the 
pageEnvelopeModule (used to produce the document-lastmodified string) to 
   this format:
Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123

Currently, in 1.4, when a page is requested, the last_modified header is 
set (via the setheader action in the publications sitemap using the 
page-envelope:document-lastmodified string) in the wrong format and is 
ignored:

bash-3.00$ wget -S 
http://lenya.zones.apache.org:9999/default/live/index.html
--04:52:28--  http://lenya.zones.apache.org:9999/default/live/index.html
            => `index.html'
Resolving lenya.zones.apache.org... 207.7.158.201
Connecting to lenya.zones.apache.org[207.7.158.201]:9999... connected.
HTTP request sent, awaiting response...
  1 HTTP/1.1 200 OK
  2 Date: Fri, 30 Dec 2005 04:52:28 GMT
  3 Server: Jetty/5.1.4 (SunOS/5.10 x86 java/1.4.2_09
  4 X-Cocoon-Version: 2.1.9-dev
  5 Expires: Thu, 01 Jan 1970 00:00:00 GMT
  6 Set-Cookie: JSESSIONID=2bebakmnkkllx;Path=/
  7 Last-Modified: 2005-12-30 04:43:11
  8 Vary: User-Agent
  9 Content-Type: text/html; charset=utf-8
10 Content-Length: 3016
11 Connection: keep-alive

100%[====================================>] 3,016         --.--K/s 


Last-modified header invalid -- time-stamp ignored.
04:52:29 (28.76 MB/s) - `index.html' saved [3016/3016]


Perhaps there is a better place for the header to be set?

--Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: page envelope date format

Posted by so...@apache.org.
On 1/5/06, Josias Thoeny <jo...@wyona.com> wrote:
> On Wed, 2006-01-04 at 18:28 -0500, solprovider@apache.org wrote:
> > Can we make the module a generic "function" ability?  Can it accept
> > multiple parameters?
> > {function:functionName:parameter1:parameter2,...}
> > {function:convert-iso8602-rfc822:{page-envelope:document-lastmodified}}
> > {function:substring-before:mylongstring:ring}  = "mylongst"
> > I had several issues that could have been quickly solved by "standard"
> > functions such as string manipulation in the XMAPs.  I am certain that
> > if such a framework exists, it will quickly be filled with most of the
> > "standards".
>
> I agree that it would be nice have e.g. string functions in the sitemap.
> But it seems to me this approach would mean to invent a new expression
> language. I'm not sure if that's a good idea, because cocoon contains a
> lot of expression languages already (Xpath, JEXL, etc).
> XPath can be used in input-modules, and you can for example do string
> operations by (mis-)using any input module which extends
> AbstractJXPathModule [1]. An example with the SessionModule:
> {session:substring-after('{page-envelope:document-id}','/')}
>
> Note: this expression has nothing to do with the session, it just uses
> the xpath capability of the session module.
> It would be easy to turn this into a cleaner solution by using a new
> input module which extends AbstractJXPathModule instead of the session
> module.
>
> Probably this approach is not very useful for more complicated stuff
> like a date conversion.
> What about using xpath for simple things and specific modules for more
> complicated tasks?
> WDYT?
> Josias
> [1] http://cocoon.apache.org/2.1/apidocs/index.html

Thanks.  I did not know there was a method for accessing string
functions.  I wish I had known about that 6 months ago.  Now I have to
revise my "Useful Commands for XMAPs" page.

That seems useful for the "standard" functions.  Should the date
conversion functions be added to a new module for all non-standard
functions?  Should there be a dataConversion module?  Or can they be
added to SessionModule?

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: page envelope date format

Posted by Josias Thoeny <jo...@wyona.com>.
On Wed, 2006-01-04 at 18:28 -0500, solprovider@apache.org wrote:
> On 1/4/06, Doug Chestnut <dh...@virginia.edu> wrote:
> > Andreas Hartmann wrote:
> > > Josias Thoeny wrote:
> > >>> That is certainly a good idea regarding performance, but maybe it's
> > >>> not the best way from a SoC point of view. Would an additional i18n
> > >>> transformation step (i18n:date pattern="" src-pattern="") be an option?
> > > Another option would be an i18n:date module, source
> > > and target patterns could be configured in cocoon.xconf:
> > > <component-instance name="i18n-iso8601-rfc822>
> > >   <pattern in="yyyy-mm-dd ..."
> > >            out="ddd, dd mmm ..."/>
> > > </component-instance>
> > >
> > > {i18n-iso8601-rfc822:{page-envelope:document-lastmodified}}
> > Thanks for the replys.  It seems like the "date-converting input-module"
> > option might be the best for the sake of reuse.  We certainly don't want
> > to have to deal with this in each input module (not sure if there are
> > any other lenya input modules dealing with dates, but there might be at
> > some point).
> 
> Can we make the module a generic "function" ability?  Can it accept
> multiple parameters?
> {function:functionName:parameter1:parameter2,...}
> 
> {function:convert-iso8602-rfc822:{page-envelope:document-lastmodified}}
> {function:substring-before:mylongstring:ring}  = "mylongst"
> {function:substring:mylongstring:1:{function:indexof:mylongstring:o}} = "myl"
> (Do we use 0 or 1 as the first character?)
> 
> I had several issues that could have been quickly solved by "standard"
> functions such as string manipulation in the XMAPs.  I am certain that
> if such a framework exists, it will quickly be filled with most of the
> "standards".

I agree that it would be nice have e.g. string functions in the sitemap.
But it seems to me this approach would mean to invent a new expression
language. I'm not sure if that's a good idea, because cocoon contains a
lot of expression languages already (Xpath, JEXL, etc).
XPath can be used in input-modules, and you can for example do string
operations by (mis-)using any input module which extends
AbstractJXPathModule [1]. An example with the SessionModule:

{session:substring-after('{page-envelope:document-id}','/')}

Note: this expression has nothing to do with the session, it just uses
the xpath capability of the session module.
It would be easy to turn this into a cleaner solution by using a new
input module which extends AbstractJXPathModule instead of the session
module.

Probably this approach is not very useful for more complicated stuff
like a date conversion. 
What about using xpath for simple things and specific modules for more
complicated tasks?

WDYT?

Josias


[1] http://cocoon.apache.org/2.1/apidocs/index.html


 

> 
> solprovider
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: page envelope date format

Posted by so...@apache.org.
On 1/4/06, Doug Chestnut <dh...@virginia.edu> wrote:
> Andreas Hartmann wrote:
> > Josias Thoeny wrote:
> >>> That is certainly a good idea regarding performance, but maybe it's
> >>> not the best way from a SoC point of view. Would an additional i18n
> >>> transformation step (i18n:date pattern="" src-pattern="") be an option?
> > Another option would be an i18n:date module, source
> > and target patterns could be configured in cocoon.xconf:
> > <component-instance name="i18n-iso8601-rfc822>
> >   <pattern in="yyyy-mm-dd ..."
> >            out="ddd, dd mmm ..."/>
> > </component-instance>
> >
> > {i18n-iso8601-rfc822:{page-envelope:document-lastmodified}}
> Thanks for the replys.  It seems like the "date-converting input-module"
> option might be the best for the sake of reuse.  We certainly don't want
> to have to deal with this in each input module (not sure if there are
> any other lenya input modules dealing with dates, but there might be at
> some point).

Can we make the module a generic "function" ability?  Can it accept
multiple parameters?
{function:functionName:parameter1:parameter2,...}

{function:convert-iso8602-rfc822:{page-envelope:document-lastmodified}}
{function:substring-before:mylongstring:ring}  = "mylongst"
{function:substring:mylongstring:1:{function:indexof:mylongstring:o}} = "myl"
(Do we use 0 or 1 as the first character?)

I had several issues that could have been quickly solved by "standard"
functions such as string manipulation in the XMAPs.  I am certain that
if such a framework exists, it will quickly be filled with most of the
"standards".

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: page envelope date format

Posted by Doug Chestnut <dh...@virginia.edu>.
Hi Andreas, Josias,
Thanks for the replys.  It seems like the "date-converting input-module" 
option might be the best for the sake of reuse.  We certainly don't want 
to have to deal with this in each input module (not sure if there are 
any other lenya input modules dealing with dates, but there might be at 
some point).

--Doug

Andreas Hartmann wrote:
> Josias Thoeny wrote:
> 
> [...]
> 
>>> That is certainly a good idea regarding performance, but maybe it's
>>> not the best way from a SoC point of view. Would an additional i18n
>>> transformation step (i18n:date pattern="" src-pattern="") be an option?
>>
>>
>>
>> Sounds good, but how can such a transformation be applied when the
>> parameter is passed to an action as in:
>>
>> <map:act type="set-header">
>>   <map:parameter name="Last-Modified"
>> value="{page-envelope:document-lastmodified}" />
>> </map:act>
> 
> 
> Sorry, I didn't read about the context of the question.
> I guess your solution is the easiest way.
> 
> Another option would be an i18n:date module, source
> and target patterns could be configured in cocoon.xconf:
> 
> <component-instance name="i18n-iso8601-rfc822>
>   <pattern in="yyyy-mm-dd ..."
>            out="ddd, dd mmm ..."/>
> </component-instance>
> 
> {i18n-iso8601-rfc822:{page-envelope:document-lastmodified}}
> 
> Just a random thought.
> 
> -- Andreas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: page envelope date format

Posted by Andreas Hartmann <an...@apache.org>.
Josias Thoeny wrote:

[...]

>>That is certainly a good idea regarding performance, but maybe it's
>>not the best way from a SoC point of view. Would an additional i18n
>>transformation step (i18n:date pattern="" src-pattern="") be an option?
> 
> 
> Sounds good, but how can such a transformation be applied when the
> parameter is passed to an action as in:
> 
> <map:act type="set-header">
>   <map:parameter name="Last-Modified"
> value="{page-envelope:document-lastmodified}" />
> </map:act>

Sorry, I didn't read about the context of the question.
I guess your solution is the easiest way.

Another option would be an i18n:date module, source
and target patterns could be configured in cocoon.xconf:

<component-instance name="i18n-iso8601-rfc822>
   <pattern in="yyyy-mm-dd ..."
            out="ddd, dd mmm ..."/>
</component-instance>

{i18n-iso8601-rfc822:{page-envelope:document-lastmodified}}

Just a random thought.

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: page envelope date format

Posted by Josias Thoeny <jo...@wyona.com>.
On Wed, 2006-01-04 at 09:44 +0100, Andreas Hartmann wrote:
> Josias Thoeny wrote:
> > On Fri, 2005-12-30 at 02:18 -0500, Doug Chestnut wrote:
> > 
> >>Is there any reason why we can't change the date_format in the 
> >>pageEnvelopeModule (used to produce the document-lastmodified string) to 
> >>   this format:
> >>Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
> > 
> > 
> > Hi Doug,
> > 
> > The date format used by lenya ("2005-12-30 04:43:11") follows the ISO
> > 8601 standard, see e.g. [1].
> > Therefore I'd rather not change the format of the document-lastmodified
> > attribute provided by the page-envelope.
> > Maybe we could add another attribute document-lastmodified-rfc822 which
> > converts the date format s.t. it may be used for the reponse header?
> > Or write a date-converting input-module?
> > Or add the format as an additional parameter:
> > {page-envelope:document-lastmodified:iso8601}
> > {page-envelope:document-lastmodified:rfc822}?
> 
> That is certainly a good idea regarding performance, but maybe it's
> not the best way from a SoC point of view. Would an additional i18n
> transformation step (i18n:date pattern="" src-pattern="") be an option?

Sounds good, but how can such a transformation be applied when the
parameter is passed to an action as in:

<map:act type="set-header">
  <map:parameter name="Last-Modified"
value="{page-envelope:document-lastmodified}" />
</map:act>

?

Josias

> 
> -- Andreas
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: page envelope date format

Posted by Andreas Hartmann <an...@apache.org>.
Josias Thoeny wrote:
> On Fri, 2005-12-30 at 02:18 -0500, Doug Chestnut wrote:
> 
>>Is there any reason why we can't change the date_format in the 
>>pageEnvelopeModule (used to produce the document-lastmodified string) to 
>>   this format:
>>Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
> 
> 
> Hi Doug,
> 
> The date format used by lenya ("2005-12-30 04:43:11") follows the ISO
> 8601 standard, see e.g. [1].
> Therefore I'd rather not change the format of the document-lastmodified
> attribute provided by the page-envelope.
> Maybe we could add another attribute document-lastmodified-rfc822 which
> converts the date format s.t. it may be used for the reponse header?
> Or write a date-converting input-module?
> Or add the format as an additional parameter:
> {page-envelope:document-lastmodified:iso8601}
> {page-envelope:document-lastmodified:rfc822}?

That is certainly a good idea regarding performance, but maybe it's
not the best way from a SoC point of view. Would an additional i18n
transformation step (i18n:date pattern="" src-pattern="") be an option?

-- Andreas



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: page envelope date format

Posted by Josias Thoeny <jo...@wyona.com>.
On Fri, 2005-12-30 at 02:18 -0500, Doug Chestnut wrote:
> Is there any reason why we can't change the date_format in the 
> pageEnvelopeModule (used to produce the document-lastmodified string) to 
>    this format:
> Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123

Hi Doug,

The date format used by lenya ("2005-12-30 04:43:11") follows the ISO
8601 standard, see e.g. [1].
Therefore I'd rather not change the format of the document-lastmodified
attribute provided by the page-envelope.
Maybe we could add another attribute document-lastmodified-rfc822 which
converts the date format s.t. it may be used for the reponse header?
Or write a date-converting input-module?
Or add the format as an additional parameter:
{page-envelope:document-lastmodified:iso8601}
{page-envelope:document-lastmodified:rfc822}?
WDYT?

Josias

[1] http://www.cl.cam.ac.uk/~mgk25/iso-time.html

> 
> Currently, in 1.4, when a page is requested, the last_modified header is 
> set (via the setheader action in the publications sitemap using the 
> page-envelope:document-lastmodified string) in the wrong format and is 
> ignored:
> 
> bash-3.00$ wget -S 
> http://lenya.zones.apache.org:9999/default/live/index.html
> --04:52:28--  http://lenya.zones.apache.org:9999/default/live/index.html
>             => `index.html'
> Resolving lenya.zones.apache.org... 207.7.158.201
> Connecting to lenya.zones.apache.org[207.7.158.201]:9999... connected.
> HTTP request sent, awaiting response...
>   1 HTTP/1.1 200 OK
>   2 Date: Fri, 30 Dec 2005 04:52:28 GMT
>   3 Server: Jetty/5.1.4 (SunOS/5.10 x86 java/1.4.2_09
>   4 X-Cocoon-Version: 2.1.9-dev
>   5 Expires: Thu, 01 Jan 1970 00:00:00 GMT
>   6 Set-Cookie: JSESSIONID=2bebakmnkkllx;Path=/
>   7 Last-Modified: 2005-12-30 04:43:11
>   8 Vary: User-Agent
>   9 Content-Type: text/html; charset=utf-8
> 10 Content-Length: 3016
> 11 Connection: keep-alive
> 
> 100%[====================================>] 3,016         --.--K/s 
> 
> 
> Last-modified header invalid -- time-stamp ignored.
> 04:52:29 (28.76 MB/s) - `index.html' saved [3016/3016]
> 
> 
> Perhaps there is a better place for the header to be set?
> 
> --Doug
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org