[jira] Commented: (SLING-557) Improve Map support for JCR Node based Resources

2008-07-03 Thread Felix Meschberger (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12610201#action_12610201
 ] 

Felix Meschberger commented on SLING-557:
-

Defined ValueMap interface in Sling API and implementation for node based 
resources in Rev. 673658.

Not closing this issue yet as unit tests for this should be added.

 Improve Map support for JCR Node based Resources
 

 Key: SLING-557
 URL: https://issues.apache.org/jira/browse/SLING-557
 Project: Sling
  Issue Type: Improvement
  Components: JCR Resource
Affects Versions: JCR Resource 2.0.2, Scripting API 2.0.2
Reporter: Felix Meschberger
Assignee: Felix Meschberger

 SLING-395 added support for adapting a JCR-Node based resource to a Map. This 
 first implementation converts property values to their Java equivalent as per 
 the JSR-170 specification.
 As the JCR Value interface also allows on-the-fly conversion of values, it 
 would be helpfull for the Map adapter to also support this kind of on-the-fly 
 conversion. See also the discussion on [1]
 This issue will introduce a new interface to the Sling API:
 package org.apache.sling.api.resource;
 public interface ValueMap extends MapString, Object {
 // returns the named value or null if not existing
 @Overwrite
 Object get(String name);
 // return named value converted to type T or
 // null if not existing
 T T get(String name, ClassT type);
 // return named value converted to the type T of
 // the default value or the default value if the
 // named value does not exist
 T T get(String name, T defaultValue);
 }
 This interface will be implemented for JCR-Node based Resources
 [1] http://markmail.org/message/ouyvit4rpnzlgy4a

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[RT] Post processing of POSTs

2008-07-03 Thread Carsten Ziegeler
I currently have the use case that I would like to add do additional 
changes when a POST is sent to Sling. One example is to set a last 
modified date on a node when something is changed/updated in the repository.


While this can be done through observation using observation is not 
optimal especially as the user context is lost.


One idea I had is to add kind of a post processor to the sling post 
servlet which is invoked after all changes are done and before the 
session is safed. The problem here is now that the post processor should 
know what has been done in order to do the right thing.


Fortunately, the sling post servlet uses the html response to keep track 
of all changes. Unfortunately this is remembered in a string buffer 
which is not suitable for further processing.


So what about keeping track of the changes in the html response in a way 
that it makes possible for the post processor to inspect what has changed?


WDYT?
Carsten
--
Carsten Ziegeler
[EMAIL PROTECTED]


Re: [RT] Post processing of POSTs

2008-07-03 Thread Paul Noden
Hi Carsten,

I find the idea of the post processing interesting, however regarding
your use case, we can post a field called created and sling will
automatically populate that with the created date. To have the same
functionality with modified would be nice, and I had assumed that
this was already in place?

Paul Noden


Re: [RT] Post processing of POSTs

2008-07-03 Thread Felix Meschberger

Hi,

Carsten Ziegeler schrieb:
I currently have the use case that I would like to add do additional 
changes when a POST is sent to Sling. One example is to set a last 
modified date on a node when something is changed/updated in the 
repository.


While this can be done through observation using observation is not 
optimal especially as the user context is lost.


One idea I had is to add kind of a post processor to the sling post 
servlet which is invoked after all changes are done and before the 
session is safed. The problem here is now that the post processor should 
know what has been done in order to do the right thing.


Fortunately, the sling post servlet uses the html response to keep track 
of all changes. Unfortunately this is remembered in a string buffer 
which is not suitable for further processing.


So what about keeping track of the changes in the html response in a way 
that it makes possible for the post processor to inspect what has changed?


This once was the case, but since this functionality was private and not 
really used, I converted the modification list to a StringBuffer. This 
may of course be reverted ...



In addition, if we add post-processing, we should probably also add 
pre-processing for symmetry, right ? But how ?


Regards
Felix


Re: [RT] Post processing of POSTs

2008-07-03 Thread Dominik Süß
Hi,

for preprocessing I would see even more usecases - if you think of
serverside backendprocesses like booking a flight you just can process the
request after submitting, but should do the backendaction before persisting
the node.

Regards,
Dominik

On Thu, Jul 3, 2008 at 4:38 PM, Felix Meschberger [EMAIL PROTECTED]
wrote:

 Hi,

 Carsten Ziegeler schrieb:

  I currently have the use case that I would like to add do additional
 changes when a POST is sent to Sling. One example is to set a last modified
 date on a node when something is changed/updated in the repository.

 While this can be done through observation using observation is not
 optimal especially as the user context is lost.

 One idea I had is to add kind of a post processor to the sling post
 servlet which is invoked after all changes are done and before the session
 is safed. The problem here is now that the post processor should know what
 has been done in order to do the right thing.

 Fortunately, the sling post servlet uses the html response to keep track
 of all changes. Unfortunately this is remembered in a string buffer which is
 not suitable for further processing.

 So what about keeping track of the changes in the html response in a way
 that it makes possible for the post processor to inspect what has changed?


 This once was the case, but since this functionality was private and not
 really used, I converted the modification list to a StringBuffer. This may
 of course be reverted ...


 In addition, if we add post-processing, we should probably also add
 pre-processing for symmetry, right ? But how ?

 Regards
 Felix



Re: [RT] Post processing of POSTs

2008-07-03 Thread Bertrand Delacretaz
On Thu, Jul 3, 2008 at 4:45 PM, Dominik Süß [EMAIL PROTECTED] wrote:

 ...for preprocessing I would see even more usecases - if you think of
 serverside backendprocesses like booking a flight you just can process the
 request after submitting, but should do the backendaction before persisting
 the node

I agree that pre-processing might be needed as well.

Another way of implementing this would be to let the POST script take
complete control of the request processing, while making the
SlingPostServlet operations available to it.

The script could then pick and choose which of these operations it
wants to execute. That might require some refactoring of the
SlingPostServlet stuff, but I think it's already fairly modular so
that shouldn't be too bad.

-Bertrand


[jira] Closed: (SLING-559) Request parameter re-encoding does not work

2008-07-03 Thread Tobias Bocanegra (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-559?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tobias Bocanegra closed SLING-559.
--


works as a charm. thanks.

 Request parameter re-encoding does not work
 ---

 Key: SLING-559
 URL: https://issues.apache.org/jira/browse/SLING-559
 Project: Sling
  Issue Type: Bug
  Components: Engine
Affects Versions: Engine 2.0.2
Reporter: Tobias Bocanegra
Assignee: Felix Meschberger
 Fix For: Engine 2.0.4

 Attachments: SLING-559-GET.esp


 Issue SLING-508 introduced a smart way to re-encode request parameters, if 
 they are sent in a different encoding that the default.
 imo there is a bug that causes this functionality to fail:
 in ParameterSupport.getContainerParameters() new 
 ContainerRequestParameter are generated with the respective encoding. but the
 constructor does never call setEncoding() and the re-encode is never 
 performed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (SLING-562) Pretty print the json dump

2008-07-03 Thread Tobias Bocanegra (JIRA)
Pretty print the json dump
--

 Key: SLING-562
 URL: https://issues.apache.org/jira/browse/SLING-562
 Project: Sling
  Issue Type: Improvement
  Components: Commons JSON
Affects Versions: Servlets Get 2.0.2, Commons JSON 2.0.2
Reporter: Tobias Bocanegra
Priority: Minor
 Attachments: json_tidy.r673772.patch

the current json exports are using the JSONWriter which writes a very compact 
for of json.
this is certainly good for performance, but a big pain when developping / 
debugging.
It would be cool if a 'pretty print' flag can be passed to the export that 
enables nice
formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true

I patched the current JSONWriter and JsonItemWriter and added the respective 
flag to the servlet.

WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (SLING-562) Pretty print the json dump

2008-07-03 Thread Tobias Bocanegra (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tobias Bocanegra updated SLING-562:
---

Attachment: json_tidy.r673772.patch

 Pretty print the json dump
 --

 Key: SLING-562
 URL: https://issues.apache.org/jira/browse/SLING-562
 Project: Sling
  Issue Type: Improvement
  Components: Commons JSON
Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
Reporter: Tobias Bocanegra
Priority: Minor
 Attachments: json_tidy.r673772.patch


 the current json exports are using the JSONWriter which writes a very compact 
 for of json.
 this is certainly good for performance, but a big pain when developping / 
 debugging.
 It would be cool if a 'pretty print' flag can be passed to the export that 
 enables nice
 formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
 I patched the current JSONWriter and JsonItemWriter and added the respective 
 flag to the servlet.
 WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-562) Pretty print the json dump

2008-07-03 Thread Roy T. Fielding (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12610336#action_12610336
 ] 

Roy T. Fielding commented on SLING-562:
---

I think using segment parameters would be better, like

  http://localhost/content/site/en.3.json;tidy/more/path


 Pretty print the json dump
 --

 Key: SLING-562
 URL: https://issues.apache.org/jira/browse/SLING-562
 Project: Sling
  Issue Type: Improvement
  Components: Commons JSON
Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
Reporter: Tobias Bocanegra
Priority: Minor
 Attachments: json_tidy.r673772.patch


 the current json exports are using the JSONWriter which writes a very compact 
 for of json.
 this is certainly good for performance, but a big pain when developping / 
 debugging.
 It would be cool if a 'pretty print' flag can be passed to the export that 
 enables nice
 formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
 I patched the current JSONWriter and JsonItemWriter and added the respective 
 flag to the servlet.
 WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-562) Pretty print the json dump

2008-07-03 Thread Tobias Bocanegra (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12610337#action_12610337
 ] 

Tobias Bocanegra commented on SLING-562:


roy, can you clarify the intention of segment parameters?



 Pretty print the json dump
 --

 Key: SLING-562
 URL: https://issues.apache.org/jira/browse/SLING-562
 Project: Sling
  Issue Type: Improvement
  Components: Commons JSON
Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
Reporter: Tobias Bocanegra
Priority: Minor
 Attachments: json_tidy.r673772.patch


 the current json exports are using the JSONWriter which writes a very compact 
 for of json.
 this is certainly good for performance, but a big pain when developping / 
 debugging.
 It would be cool if a 'pretty print' flag can be passed to the export that 
 enables nice
 formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
 I patched the current JSONWriter and JsonItemWriter and added the respective 
 flag to the servlet.
 WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-562) Pretty print the json dump

2008-07-03 Thread Roy T. Fielding (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12610354#action_12610354
 ] 

Roy T. Fielding commented on SLING-562:
---

They are just a part of the URI path.  They are better for this purpose because 
they can be associated with each segment of the path and won't conflict with 
query processing or cache behavior.

Alternatively, just use a different extension for tidy-json. You are 
effectively requesting a different data format, so it might as well have its 
own extension.  Or you could define it like /em.3.tidy.json, where tidy is a 
filter that tidies up any number of formats.


 Pretty print the json dump
 --

 Key: SLING-562
 URL: https://issues.apache.org/jira/browse/SLING-562
 Project: Sling
  Issue Type: Improvement
  Components: Commons JSON
Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
Reporter: Tobias Bocanegra
Priority: Minor
 Attachments: json_tidy.r673772.patch


 the current json exports are using the JSONWriter which writes a very compact 
 for of json.
 this is certainly good for performance, but a big pain when developping / 
 debugging.
 It would be cool if a 'pretty print' flag can be passed to the export that 
 enables nice
 formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
 I patched the current JSONWriter and JsonItemWriter and added the respective 
 flag to the servlet.
 WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



combine jsp processing in sling with jsp processing in servlet container?

2008-07-03 Thread Torgeir Veimo
Sling seems to take over all JSP page processing, so JSP pages now  
have to remain in the repository?


What's the easiest way to enable the servlet container to retain  
processing requests which are not handeled by the sling servlet? I  
know it's technically possible to do programmatically with tomcat using


RequestDispatcher disp =  
request.getSession().getServletContext().getNamedDispatcher(default);

disp.forward(request, response);

but it would be nice if this could be done using simple configuration.  
Would be very handy when integrating sling into an existing web  
application which needs to retain JSP processing by the servlet  
container.



--
Torgeir Veimo
[EMAIL PROTECTED]