[jira] [Commented] (SLING-6478) Add a Sling model annotation+injector for request parameters

2017-01-20 Thread Christophe Jelger (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-6478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15831956#comment-15831956
 ] 

Christophe Jelger commented on SLING-6478:
--

No, but I can add the extra check for the {{@Source}} annotation and the 
{{request-parameters}} value.

> Add a Sling model annotation+injector for request parameters
> 
>
> Key: SLING-6478
> URL: https://issues.apache.org/jira/browse/SLING-6478
> Project: Sling
>  Issue Type: New Feature
>  Components: Extensions
>Reporter: Christophe Jelger
>Priority: Minor
> Attachments: SLING-6478-patch.diff
>
>
> It would be handy to have a @RequestParameter annotation to inject request 
> parameters in Sling models.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-6478) Add a Sling model annotation+injector for request parameters

2017-01-20 Thread Jason E Bailey (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-6478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15831950#comment-15831950
 ] 

Jason E Bailey commented on SLING-6478:
---

Would this work as a target of a Source annotation?

i.e.
{code:java}
@Inject @Source("request-parameters")
String foo;
{code}

> Add a Sling model annotation+injector for request parameters
> 
>
> Key: SLING-6478
> URL: https://issues.apache.org/jira/browse/SLING-6478
> Project: Sling
>  Issue Type: New Feature
>  Components: Extensions
>Reporter: Christophe Jelger
>Priority: Minor
> Attachments: SLING-6478-patch.diff
>
>
> It would be handy to have a @RequestParameter annotation to inject request 
> parameters in Sling models.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-6478) Add a Sling model annotation+injector for request parameters

2017-01-19 Thread Christophe Jelger (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-6478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15829705#comment-15829705
 ] 

Christophe Jelger commented on SLING-6478:
--

I just attached a diff to add that functionality. Note that the 
{{@RequestParameter}} annotation can be used to inject {{String}}, {{Integer}}, 
and {{Date}} fields. The injector automatically converts integers and dates. To 
inject a {{Date}}, the annotation must have the {{simpleDateFormat}} attribute 
which defines the conversion format. I added these basic converters to be able 
to define a Sling model that can represent a basic HTML form with text, 
integer, and date input fields.

Following the discussion thread 
http://apache-sling.73963.n3.nabble.com/Sling-Model-and-Request-Parameters-tt4065648.html#a4065663,
 the injector ensures that a request parameter is only injected if and only if 
the {{@RequestParameter}} was used. That is, the injector returns null if 
{{@Inject}} was used.

> Add a Sling model annotation+injector for request parameters
> 
>
> Key: SLING-6478
> URL: https://issues.apache.org/jira/browse/SLING-6478
> Project: Sling
>  Issue Type: New Feature
>  Components: Extensions
>Reporter: Christophe Jelger
>Priority: Minor
> Attachments: SLING-6478-patch.diff
>
>
> It would be handy to have a @RequestParameter annotation to inject request 
> parameters in Sling models.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)