You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Júnior <fj...@gmail.com> on 2016/08/09 13:10:16 UTC
Call JSP Directly on Apache Sling
Hi,
Is there any way to call a JSP directly on Apache Sling?
I'd like to call a JSP that is deployed on Apache Sling.
Any tips are welcome.
Thanks
--
Francisco Ribeiro
*SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
Re: Call JSP Directly on Apache Sling
Posted by Bertrand Delacretaz <bd...@apache.org>.
On Fri, Aug 12, 2016 at 3:09 PM, Júnior <fj...@gmail.com> wrote:
> ...with Sling we need to request a resource that has a resourceType
> pointing to the JSP or any other script....
Yes, that's because Sling is about resources and promoting a REST
style, as opposed to addressing code directly.
-Bertrand
Re: Call JSP Directly on Apache Sling
Posted by Júnior <fj...@gmail.com>.
Hi Jason,
What I wanted was to be all to call/execute a JSP like it was in a Tomcat
for example. Like /mywebapp/myjsp.jsp
But with Sling we need to request a resource that has a resourceType
pointing to the JSP or any other script.
Thank you for all considerations :)
Thanks
2016-08-12 10:03 GMT-03:00 Jason Bailey <Ja...@sas.com>:
> I think Henry did a fantastic job of explaining what is going on. But your
> terminology confuses me. This is as direct a call to a jsp as any other web
> server.
>
> -----Original Message-----
> From: Júnior [mailto:fjunior87@gmail.com]
> Sent: Friday, August 12, 2016 7:14 AM
> To: users@sling.apache.org
> Subject: Re: Call JSP Directly on Apache Sling
>
> Hi Henry,
>
> I see your point, it doesn't make sense to use a resource based framework
> for calling the rendering scritps directly.
>
> Thanks for you reply.
>
> Att.
>
>
>
> 2016-08-11 19:11 GMT-03:00 Henry Saginor <hs...@gmail.com>:
>
> > Hi Junior
> >
> > Apache Sling is a resource based framework. You create a content node
> > such as a web page (usually as JCR node in a JCR repository) with a
> > property sling:resourceType that is mapped to a location of your
> > scripts and other content properties that maybe specific to your
> > application requirements.The URL you call is a URL to that resource.
> > The framework then uses the resource type and information in the URL
> > (like selectors and extension) to map it to a script (or servlet) that
> knows how to render it.
> > This is how sling separates content from code that renders it. You
> > could map a Servlet deployed as OSGi service to a specific URL. But I
> > don’t consider that good practice.
> >
> > See Sling documentation for derails on how resource resolution works.
> > https://sling.apache.org/documentation/the-sling-engine/url-to-script-
> > resolution.html <https://sling.apache.org/documentation/the-sling-
> > engine/url-to-script-resolution.html>
> > https://sling.apache.org/documentation/the-sling-engine/servlets.html
> > <
> > https://sling.apache.org/documentation/the-sling-engine/servlets.html>
> >
> > I hope this helps.
> >
> > Henry
> >
> > > On Aug 9, 2016, at 6:55 AM, Júnior <fj...@gmail.com> wrote:
> > >
> > > Hi Jason,
> > >
> > > Thanks for you reply.
> > >
> > > By "calling directly" I mean to be processed as it was being called
> > > in a web container. So the scriptlets and tags would be processed.
> > >
> > > As I understood it correctly, I would need to have a servlet or
> > > component that would be responsible for calling that JSP, right?
> > >
> > > Thanks
> > >
> > >
> > > 2016-08-09 10:50 GMT-03:00 Jason Bailey <Ja...@sas.com>:
> > >
> > >> This really depends on what you mean by 'calling directly'
> > >>
> > >> if you put a jsp file under the /apps directory. You are putting a
> > >> file there. You can access that file directly as a file. If you are
> > >> looking
> > at
> > >> accessing the functionality that the jsp provides, the servlet,
> > >> you
> > need
> > >> to point to something that says
> > >>
> > >> 1. compile that jsp over there that the meta data is aware of into
> > >> a servlet 2. pass the arguments from the called object into that
> > >> servlet
> > >>
> > >> That's the whole basis of the sling design with the separation of
> > >> logic and content that represents that logic. If you feel really
> > >> compelled to
> > do
> > >> something where you want to put a jsp and then be able to call that
> > >> as servlet from the location you put it, in my understanding, that
> > >> would
> > be a
> > >> custom implementation where you would need to create your own
> > >> extension
> > or
> > >> selector so that when you requested the jsp file it would be
> > >> handled in
> > the
> > >> manner that you want.
> > >>
> > >> -Jason
> > >>
> > >> ________________________________________
> > >> From: Júnior <fj...@gmail.com>
> > >> Sent: Tuesday, August 9, 2016 9:10 AM
> > >> To: users@sling.apache.org
> > >> Subject: Call JSP Directly on Apache Sling
> > >>
> > >> Hi,
> > >>
> > >> Is there any way to call a JSP directly on Apache Sling?
> > >>
> > >> I'd like to call a JSP that is deployed on Apache Sling.
> > >>
> > >> Any tips are welcome.
> > >>
> > >> Thanks
> > >> --
> > >> Francisco Ribeiro
> > >> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
> > >>
> > >
> > >
> > >
> > > --
> > > Francisco Ribeiro
> > > *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
> >
> >
>
>
> --
> Francisco Ribeiro
> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>
--
Francisco Ribeiro
*SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
RE: Call JSP Directly on Apache Sling
Posted by Jason Bailey <Ja...@sas.com>.
I think Henry did a fantastic job of explaining what is going on. But your terminology confuses me. This is as direct a call to a jsp as any other web server.
-----Original Message-----
From: Júnior [mailto:fjunior87@gmail.com]
Sent: Friday, August 12, 2016 7:14 AM
To: users@sling.apache.org
Subject: Re: Call JSP Directly on Apache Sling
Hi Henry,
I see your point, it doesn't make sense to use a resource based framework for calling the rendering scritps directly.
Thanks for you reply.
Att.
2016-08-11 19:11 GMT-03:00 Henry Saginor <hs...@gmail.com>:
> Hi Junior
>
> Apache Sling is a resource based framework. You create a content node
> such as a web page (usually as JCR node in a JCR repository) with a
> property sling:resourceType that is mapped to a location of your
> scripts and other content properties that maybe specific to your
> application requirements.The URL you call is a URL to that resource.
> The framework then uses the resource type and information in the URL
> (like selectors and extension) to map it to a script (or servlet) that knows how to render it.
> This is how sling separates content from code that renders it. You
> could map a Servlet deployed as OSGi service to a specific URL. But I
> don’t consider that good practice.
>
> See Sling documentation for derails on how resource resolution works.
> https://sling.apache.org/documentation/the-sling-engine/url-to-script-
> resolution.html <https://sling.apache.org/documentation/the-sling-
> engine/url-to-script-resolution.html>
> https://sling.apache.org/documentation/the-sling-engine/servlets.html
> <
> https://sling.apache.org/documentation/the-sling-engine/servlets.html>
>
> I hope this helps.
>
> Henry
>
> > On Aug 9, 2016, at 6:55 AM, Júnior <fj...@gmail.com> wrote:
> >
> > Hi Jason,
> >
> > Thanks for you reply.
> >
> > By "calling directly" I mean to be processed as it was being called
> > in a web container. So the scriptlets and tags would be processed.
> >
> > As I understood it correctly, I would need to have a servlet or
> > component that would be responsible for calling that JSP, right?
> >
> > Thanks
> >
> >
> > 2016-08-09 10:50 GMT-03:00 Jason Bailey <Ja...@sas.com>:
> >
> >> This really depends on what you mean by 'calling directly'
> >>
> >> if you put a jsp file under the /apps directory. You are putting a
> >> file there. You can access that file directly as a file. If you are
> >> looking
> at
> >> accessing the functionality that the jsp provides, the servlet,
> >> you
> need
> >> to point to something that says
> >>
> >> 1. compile that jsp over there that the meta data is aware of into
> >> a servlet 2. pass the arguments from the called object into that
> >> servlet
> >>
> >> That's the whole basis of the sling design with the separation of
> >> logic and content that represents that logic. If you feel really
> >> compelled to
> do
> >> something where you want to put a jsp and then be able to call that
> >> as servlet from the location you put it, in my understanding, that
> >> would
> be a
> >> custom implementation where you would need to create your own
> >> extension
> or
> >> selector so that when you requested the jsp file it would be
> >> handled in
> the
> >> manner that you want.
> >>
> >> -Jason
> >>
> >> ________________________________________
> >> From: Júnior <fj...@gmail.com>
> >> Sent: Tuesday, August 9, 2016 9:10 AM
> >> To: users@sling.apache.org
> >> Subject: Call JSP Directly on Apache Sling
> >>
> >> Hi,
> >>
> >> Is there any way to call a JSP directly on Apache Sling?
> >>
> >> I'd like to call a JSP that is deployed on Apache Sling.
> >>
> >> Any tips are welcome.
> >>
> >> Thanks
> >> --
> >> Francisco Ribeiro
> >> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
> >>
> >
> >
> >
> > --
> > Francisco Ribeiro
> > *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>
>
--
Francisco Ribeiro
*SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
Re: Call JSP Directly on Apache Sling
Posted by Júnior <fj...@gmail.com>.
Hi Henry,
I see your point, it doesn't make sense to use a resource based framework
for calling the rendering scritps directly.
Thanks for you reply.
Att.
2016-08-11 19:11 GMT-03:00 Henry Saginor <hs...@gmail.com>:
> Hi Junior
>
> Apache Sling is a resource based framework. You create a content node such
> as a web page (usually as JCR node in a JCR repository) with a property
> sling:resourceType that is mapped to a location of your scripts and other
> content properties that maybe specific to your application requirements.The
> URL you call is a URL to that resource. The framework then uses the
> resource type and information in the URL (like selectors and extension) to
> map it to a script (or servlet) that knows how to render it.
> This is how sling separates content from code that renders it. You could
> map a Servlet deployed as OSGi service to a specific URL. But I don’t
> consider that good practice.
>
> See Sling documentation for derails on how resource resolution works.
> https://sling.apache.org/documentation/the-sling-engine/url-to-script-
> resolution.html <https://sling.apache.org/documentation/the-sling-
> engine/url-to-script-resolution.html>
> https://sling.apache.org/documentation/the-sling-engine/servlets.html <
> https://sling.apache.org/documentation/the-sling-engine/servlets.html>
>
> I hope this helps.
>
> Henry
>
> > On Aug 9, 2016, at 6:55 AM, Júnior <fj...@gmail.com> wrote:
> >
> > Hi Jason,
> >
> > Thanks for you reply.
> >
> > By "calling directly" I mean to be processed as it was being called in a
> > web container. So the scriptlets and tags would be processed.
> >
> > As I understood it correctly, I would need to have a servlet or component
> > that would be responsible for calling that JSP, right?
> >
> > Thanks
> >
> >
> > 2016-08-09 10:50 GMT-03:00 Jason Bailey <Ja...@sas.com>:
> >
> >> This really depends on what you mean by 'calling directly'
> >>
> >> if you put a jsp file under the /apps directory. You are putting a file
> >> there. You can access that file directly as a file. If you are looking
> at
> >> accessing the functionality that the jsp provides, the servlet, you
> need
> >> to point to something that says
> >>
> >> 1. compile that jsp over there that the meta data is aware of into a
> >> servlet
> >> 2. pass the arguments from the called object into that servlet
> >>
> >> That's the whole basis of the sling design with the separation of logic
> >> and content that represents that logic. If you feel really compelled to
> do
> >> something where you want to put a jsp and then be able to call that as
> >> servlet from the location you put it, in my understanding, that would
> be a
> >> custom implementation where you would need to create your own extension
> or
> >> selector so that when you requested the jsp file it would be handled in
> the
> >> manner that you want.
> >>
> >> -Jason
> >>
> >> ________________________________________
> >> From: Júnior <fj...@gmail.com>
> >> Sent: Tuesday, August 9, 2016 9:10 AM
> >> To: users@sling.apache.org
> >> Subject: Call JSP Directly on Apache Sling
> >>
> >> Hi,
> >>
> >> Is there any way to call a JSP directly on Apache Sling?
> >>
> >> I'd like to call a JSP that is deployed on Apache Sling.
> >>
> >> Any tips are welcome.
> >>
> >> Thanks
> >> --
> >> Francisco Ribeiro
> >> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
> >>
> >
> >
> >
> > --
> > Francisco Ribeiro
> > *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>
>
--
Francisco Ribeiro
*SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
Re: Call JSP Directly on Apache Sling
Posted by Henry Saginor <hs...@gmail.com>.
Hi Junior
Apache Sling is a resource based framework. You create a content node such as a web page (usually as JCR node in a JCR repository) with a property sling:resourceType that is mapped to a location of your scripts and other content properties that maybe specific to your application requirements.The URL you call is a URL to that resource. The framework then uses the resource type and information in the URL (like selectors and extension) to map it to a script (or servlet) that knows how to render it.
This is how sling separates content from code that renders it. You could map a Servlet deployed as OSGi service to a specific URL. But I don’t consider that good practice.
See Sling documentation for derails on how resource resolution works.
https://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html <https://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html>
https://sling.apache.org/documentation/the-sling-engine/servlets.html <https://sling.apache.org/documentation/the-sling-engine/servlets.html>
I hope this helps.
Henry
> On Aug 9, 2016, at 6:55 AM, Júnior <fj...@gmail.com> wrote:
>
> Hi Jason,
>
> Thanks for you reply.
>
> By "calling directly" I mean to be processed as it was being called in a
> web container. So the scriptlets and tags would be processed.
>
> As I understood it correctly, I would need to have a servlet or component
> that would be responsible for calling that JSP, right?
>
> Thanks
>
>
> 2016-08-09 10:50 GMT-03:00 Jason Bailey <Ja...@sas.com>:
>
>> This really depends on what you mean by 'calling directly'
>>
>> if you put a jsp file under the /apps directory. You are putting a file
>> there. You can access that file directly as a file. If you are looking at
>> accessing the functionality that the jsp provides, the servlet, you need
>> to point to something that says
>>
>> 1. compile that jsp over there that the meta data is aware of into a
>> servlet
>> 2. pass the arguments from the called object into that servlet
>>
>> That's the whole basis of the sling design with the separation of logic
>> and content that represents that logic. If you feel really compelled to do
>> something where you want to put a jsp and then be able to call that as
>> servlet from the location you put it, in my understanding, that would be a
>> custom implementation where you would need to create your own extension or
>> selector so that when you requested the jsp file it would be handled in the
>> manner that you want.
>>
>> -Jason
>>
>> ________________________________________
>> From: Júnior <fj...@gmail.com>
>> Sent: Tuesday, August 9, 2016 9:10 AM
>> To: users@sling.apache.org
>> Subject: Call JSP Directly on Apache Sling
>>
>> Hi,
>>
>> Is there any way to call a JSP directly on Apache Sling?
>>
>> I'd like to call a JSP that is deployed on Apache Sling.
>>
>> Any tips are welcome.
>>
>> Thanks
>> --
>> Francisco Ribeiro
>> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>>
>
>
>
> --
> Francisco Ribeiro
> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
Re: Call JSP Directly on Apache Sling
Posted by Júnior <fj...@gmail.com>.
Hi Jason,
Thanks for you reply.
By "calling directly" I mean to be processed as it was being called in a
web container. So the scriptlets and tags would be processed.
As I understood it correctly, I would need to have a servlet or component
that would be responsible for calling that JSP, right?
Thanks
2016-08-09 10:50 GMT-03:00 Jason Bailey <Ja...@sas.com>:
> This really depends on what you mean by 'calling directly'
>
> if you put a jsp file under the /apps directory. You are putting a file
> there. You can access that file directly as a file. If you are looking at
> accessing the functionality that the jsp provides, the servlet, you need
> to point to something that says
>
> 1. compile that jsp over there that the meta data is aware of into a
> servlet
> 2. pass the arguments from the called object into that servlet
>
> That's the whole basis of the sling design with the separation of logic
> and content that represents that logic. If you feel really compelled to do
> something where you want to put a jsp and then be able to call that as
> servlet from the location you put it, in my understanding, that would be a
> custom implementation where you would need to create your own extension or
> selector so that when you requested the jsp file it would be handled in the
> manner that you want.
>
> -Jason
>
> ________________________________________
> From: Júnior <fj...@gmail.com>
> Sent: Tuesday, August 9, 2016 9:10 AM
> To: users@sling.apache.org
> Subject: Call JSP Directly on Apache Sling
>
> Hi,
>
> Is there any way to call a JSP directly on Apache Sling?
>
> I'd like to call a JSP that is deployed on Apache Sling.
>
> Any tips are welcome.
>
> Thanks
> --
> Francisco Ribeiro
> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>
--
Francisco Ribeiro
*SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
Re: Call JSP Directly on Apache Sling
Posted by Jason Bailey <Ja...@sas.com>.
This really depends on what you mean by 'calling directly'
if you put a jsp file under the /apps directory. You are putting a file there. You can access that file directly as a file. If you are looking at accessing the functionality that the jsp provides, the servlet, you need to point to something that says
1. compile that jsp over there that the meta data is aware of into a servlet
2. pass the arguments from the called object into that servlet
That's the whole basis of the sling design with the separation of logic and content that represents that logic. If you feel really compelled to do something where you want to put a jsp and then be able to call that as servlet from the location you put it, in my understanding, that would be a custom implementation where you would need to create your own extension or selector so that when you requested the jsp file it would be handled in the manner that you want.
-Jason
________________________________________
From: Júnior <fj...@gmail.com>
Sent: Tuesday, August 9, 2016 9:10 AM
To: users@sling.apache.org
Subject: Call JSP Directly on Apache Sling
Hi,
Is there any way to call a JSP directly on Apache Sling?
I'd like to call a JSP that is deployed on Apache Sling.
Any tips are welcome.
Thanks
--
Francisco Ribeiro
*SCEA|SCJP|SCWCD|IBM Certified SOA Associate*