[jira] [Commented] (SLING-7174) Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with Export Servlet

2017-10-02 Thread Robert Munteanu (JIRA)

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

Robert Munteanu commented on SLING-7174:


thanks!

> Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with 
> Export Servlet
> 
>
> Key: SLING-7174
> URL: https://issues.apache.org/jira/browse/SLING-7174
> Project: Sling
>  Issue Type: Bug
>  Components: Extensions
> Environment: Sling 9, Java 1.8
>Reporter: Andreas Schaefer
>Assignee: Justin Edelson
> Fix For: Servlet Helpers 1.1.2, Sling Models Impl 1.4.6
>
>
> When I use MockSlingHttpServletRequest with SlingRequestProcessor to render a 
> page within sling then I will get an Unsupported Operation Exception when I 
> hit the Export Servlet.
> The reason is that the Export Servlet is retrieving Request Reader in 
> addScriptBindings():
> bindings.put(READER, request.getReader());
> In my opinion Sling should provide a Request / Response class for in-Sling 
> rendering that is for that specific purpose as using that class for testing 
> does clash with the the rendering.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (SLING-7174) Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with Export Servlet

2017-10-02 Thread Justin Edelson (JIRA)

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

Justin Edelson commented on SLING-7174:
---

that's just me forgetting to commit a file. Should be fixed now.

> Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with 
> Export Servlet
> 
>
> Key: SLING-7174
> URL: https://issues.apache.org/jira/browse/SLING-7174
> Project: Sling
>  Issue Type: Bug
>  Components: Extensions
> Environment: Sling 9, Java 1.8
>Reporter: Andreas Schaefer
>Assignee: Justin Edelson
> Fix For: Servlet Helpers 1.1.2, Sling Models Impl 1.4.6
>
>
> When I use MockSlingHttpServletRequest with SlingRequestProcessor to render a 
> page within sling then I will get an Unsupported Operation Exception when I 
> hit the Export Servlet.
> The reason is that the Export Servlet is retrieving Request Reader in 
> addScriptBindings():
> bindings.put(READER, request.getReader());
> In my opinion Sling should provide a Request / Response class for in-Sling 
> rendering that is for that specific purpose as using that class for testing 
> does clash with the the rendering.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (SLING-7174) Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with Export Servlet

2017-10-02 Thread Robert Munteanu (JIRA)

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

Robert Munteanu commented on SLING-7174:


I think the changes lead to some tests failing - see 
https://builds.apache.org/job/sling-bundles-extensions-servlet-helpers-1.8/9/

> Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with 
> Export Servlet
> 
>
> Key: SLING-7174
> URL: https://issues.apache.org/jira/browse/SLING-7174
> Project: Sling
>  Issue Type: Bug
>  Components: Extensions
> Environment: Sling 9, Java 1.8
>Reporter: Andreas Schaefer
>Assignee: Justin Edelson
> Fix For: Servlet Helpers 1.1.2, Sling Models Impl 1.4.6
>
>
> When I use MockSlingHttpServletRequest with SlingRequestProcessor to render a 
> page within sling then I will get an Unsupported Operation Exception when I 
> hit the Export Servlet.
> The reason is that the Export Servlet is retrieving Request Reader in 
> addScriptBindings():
> bindings.put(READER, request.getReader());
> In my opinion Sling should provide a Request / Response class for in-Sling 
> rendering that is for that specific purpose as using that class for testing 
> does clash with the the rendering.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (SLING-7174) Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with Export Servlet

2017-10-02 Thread Justin Edelson (JIRA)

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

Justin Edelson commented on SLING-7174:
---

Fixed in r1810562/r1810564 by properly implementing the {{getReader}} method. 
Also fixed the implementation of {{getInputStream}} to properly through 
{{IllegalStateException}} if the reader has already been accessed.

Also fixed in r1810563 by catching the exception in {{ExportServlet}} since 
even with these changes, an {{IllegalStateException}} could be thrown by a call 
to {{getReader}}.

> Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with 
> Export Servlet
> 
>
> Key: SLING-7174
> URL: https://issues.apache.org/jira/browse/SLING-7174
> Project: Sling
>  Issue Type: Bug
>  Components: Extensions
> Environment: Sling 9, Java 1.8
>Reporter: Andreas Schaefer
>Assignee: Justin Edelson
> Fix For: Servlet Helpers 1.1.2, Sling Models Impl 1.4.6
>
>
> When I use MockSlingHttpServletRequest with SlingRequestProcessor to render a 
> page within sling then I will get an Unsupported Operation Exception when I 
> hit the Export Servlet.
> The reason is that the Export Servlet is retrieving Request Reader in 
> addScriptBindings():
> bindings.put(READER, request.getReader());
> In my opinion Sling should provide a Request / Response class for in-Sling 
> rendering that is for that specific purpose as using that class for testing 
> does clash with the the rendering.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (SLING-7174) Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with Export Servlet

2017-10-02 Thread Justin Edelson (JIRA)

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

Justin Edelson commented on SLING-7174:
---

bq. If that Request / Response pair if for In-Sling rendering why is it then 
prefixed with 'Mock'

Because naming things is hard.

bq. why does it throw an Unsupported Operation Exception?

Presumably because no one thought that was an issue.

> Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with 
> Export Servlet
> 
>
> Key: SLING-7174
> URL: https://issues.apache.org/jira/browse/SLING-7174
> Project: Sling
>  Issue Type: Bug
>  Components: Extensions
> Environment: Sling 9, Java 1.8
>Reporter: Andreas Schaefer
>Assignee: Justin Edelson
>
> When I use MockSlingHttpServletRequest with SlingRequestProcessor to render a 
> page within sling then I will get an Unsupported Operation Exception when I 
> hit the Export Servlet.
> The reason is that the Export Servlet is retrieving Request Reader in 
> addScriptBindings():
> bindings.put(READER, request.getReader());
> In my opinion Sling should provide a Request / Response class for in-Sling 
> rendering that is for that specific purpose as using that class for testing 
> does clash with the the rendering.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (SLING-7174) Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with Export Servlet

2017-10-02 Thread Andreas Schaefer (JIRA)

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

Andreas Schaefer commented on SLING-7174:
-

If that Request / Response pair if for In-Sling rendering why is it then 
prefixed with 'Mock' and why does it throw an Unsupported Operation Exception?

If fixed that for our project by just returning null in the getReader() in the 
Request class and it works just fine.

> Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with 
> Export Servlet
> 
>
> Key: SLING-7174
> URL: https://issues.apache.org/jira/browse/SLING-7174
> Project: Sling
>  Issue Type: Bug
>  Components: Extensions
> Environment: Sling 9, Java 1.8
>Reporter: Andreas Schaefer
>Assignee: Justin Edelson
>
> When I use MockSlingHttpServletRequest with SlingRequestProcessor to render a 
> page within sling then I will get an Unsupported Operation Exception when I 
> hit the Export Servlet.
> The reason is that the Export Servlet is retrieving Request Reader in 
> addScriptBindings():
> bindings.put(READER, request.getReader());
> In my opinion Sling should provide a Request / Response class for in-Sling 
> rendering that is for that specific purpose as using that class for testing 
> does clash with the the rendering.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (SLING-7174) Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with Export Servlet

2017-10-02 Thread Justin Edelson (JIRA)

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

Justin Edelson commented on SLING-7174:
---

bq. In my opinion Sling should provide a Request / Response class for in-Sling 
rendering that is for that specific purpose as using that class for testing 
does clash with the the rendering.

It does. That's the purpose of the Servlet Helpers bundle.

> Using MockSlingHttpServletRequest for In-Sling Rendering fails when used with 
> Export Servlet
> 
>
> Key: SLING-7174
> URL: https://issues.apache.org/jira/browse/SLING-7174
> Project: Sling
>  Issue Type: Bug
>  Components: Extensions
> Environment: Sling 9, Java 1.8
>Reporter: Andreas Schaefer
>
> When I use MockSlingHttpServletRequest with SlingRequestProcessor to render a 
> page within sling then I will get an Unsupported Operation Exception when I 
> hit the Export Servlet.
> The reason is that the Export Servlet is retrieving Request Reader in 
> addScriptBindings():
> bindings.put(READER, request.getReader());
> In my opinion Sling should provide a Request / Response class for in-Sling 
> rendering that is for that specific purpose as using that class for testing 
> does clash with the the rendering.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)