You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Robert Munteanu <rm...@adobe.com.INVALID> on 2017/06/09 10:33:23 UTC
[sling-mock] Path Info for path-bound servlets?
Hi,
I'm working on a path-bound servlet for testing purposes and want to
write a test using the Sling mocks. I am using the request path info as
a control to check what action is requested.
The servlet is bound to "/system/sling/testing/email", and I want to
use
"/system/sling/testing/email/config" as an action for requesting the
configuration and "/system/sling/testing/email/messages" for getting a
list of messages.
In my code I am asking for the HttpServletRequest.getPathInfo(), which
returns everything after the bind path.
In the test the pathInfo implementation [1] returns the whole request
path. I can short-circuit the logic, but my questions are:
1) is this intended or a bug?
2) is there another way of getting the path info for path-bound
servlets?
Thanks,
Robert
[1]: org.apache.sling.servlethelpers.getPathInfo
Re: [sling-mock] Path Info for path-bound servlets?
Posted by Robert Munteanu <ro...@apache.org>.
Thanks for the confirmation.
Filed https://issues.apache.org/jira/browse/SLING-6947
Robert
On Fri, 2017-06-09 at 13:18 +0200, Carsten Ziegeler wrote:
> Not sure how you test, but it sounds like a bug in the test
> code/library.
>
> Regards
> Carsten
>
> Robert Munteanu wrote
> > Hi,
> >
> > I'm working on a path-bound servlet for testing purposes and want
> > to
> > write a test using the Sling mocks. I am using the request path
> > info as
> > a control to check what action is requested.
> >
> > The servlet is bound to "/system/sling/testing/email", and I want
> > to
> > use
> >
> > "/system/sling/testing/email/config" as an action for requesting
> > the
> > configuration and "/system/sling/testing/email/messages" for
> > getting a
> > list of messages.
> >
> > In my code I am asking for the HttpServletRequest.getPathInfo(),
> > which
> > returns everything after the bind path.
> >
> > In the test the pathInfo implementation [1] returns the whole
> > request
> > path. I can short-circuit the logic, but my questions are:
> >
> > 1) is this intended or a bug?
> > 2) is there another way of getting the path info for path-bound
> > servlets?
> >
> > Thanks,
> >
> > Robert
> >
> >
> > [1]: org.apache.sling.servlethelpers.getPathInfo
> >
>
>
>
>
Re: [sling-mock] Path Info for path-bound servlets?
Posted by Carsten Ziegeler <cz...@apache.org>.
Not sure how you test, but it sounds like a bug in the test code/library.
Regards
Carsten
Robert Munteanu wrote
> Hi,
>
> I'm working on a path-bound servlet for testing purposes and want to
> write a test using the Sling mocks. I am using the request path info as
> a control to check what action is requested.
>
> The servlet is bound to "/system/sling/testing/email", and I want to
> use
>
> "/system/sling/testing/email/config" as an action for requesting the
> configuration and "/system/sling/testing/email/messages" for getting a
> list of messages.
>
> In my code I am asking for the HttpServletRequest.getPathInfo(), which
> returns everything after the bind path.
>
> In the test the pathInfo implementation [1] returns the whole request
> path. I can short-circuit the logic, but my questions are:
>
> 1) is this intended or a bug?
> 2) is there another way of getting the path info for path-bound
> servlets?
>
> Thanks,
>
> Robert
>
>
> [1]: org.apache.sling.servlethelpers.getPathInfo
>
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org