You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by alessio <al...@gmail.com> on 2013/08/28 15:40:40 UTC

Directory Listings

Hi,

I am using Wicket 1.5.3 in a WebSphere context and encountered an
interesting behaviour which I dont fully understand.

My application uses a /* mapping to WicketServlet and the application
generally works fine. However I wonder what happens to static content
(images, ....) which is requested through the same path mapping?
Due to the mapping I'd take it all requests go through Wicket and
depending on whether the content physically exists on the disk it
delivers it or processes the specified application class. Is this
correct? The question arose from an interesting phenomenon with
directories, respectively their listings ....

I have a production instance running WebSphere and local development
instance using Tomcat. Requests to static content always return the
respective file. However the behaviour is different for directories.
In the case of the production server (WebSphere) it returns the
directory listing, in case of the development instance I get a Tomcat
error.

My initial assumption was, Wicket passes such requests back to the
default handler and the listing comes from the respective server, but
this does not seem to be the case as the directory listing layout I
get (only a plain list with entry name) is entirely different from
WebSphere's (fancier with entry dates, more formatting, ....).

I also tried to simply map the servlet to / only (without the
wildcard) but immediately get a StringIndexOutOfBoundsException in
WebXmlFile.getFilterPath()

Does anyone have a clue what is going on here and whether Wicket
actually returns directory listings at all?

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Directory Listings

Posted by alessio <al...@gmail.com>.
On Thu, Aug 29, 2013 at 10:59 AM, Sven Meier <sv...@meiers.net> wrote:
>
> Sorry, that is what I meant. "Read the source Luke!" ;).

I dont believe I understand your hint :)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Directory Listings

Posted by Sven Meier <sv...@meiers.net>.
> using getResourceAsStream()

Sorry, that is what I meant. "Read the source Luke!" ;).


Sven

On 08/29/2013 10:56 AM, alessio wrote:
> I believe I found the problem.
>
> It appears Wicket does not really pass non-Wicket requests back to a
> default handler, but handles them by itself in fallback() by using
> getResourceAsStream() and in this case, for directories, WebSphere
> returns a listing regardless of its own directoryBrowsingEnabled
> setting.
>
> On Wed, Aug 28, 2013 at 7:23 PM, Sven Meier <sv...@meiers.net> wrote:
>> Wicket expects the path to end in a wildcard.
>>
>> Note that using WicketFilter instead of WicketServlet is recommended.
>>
>> Sven
>>
>>
>> On 08/28/2013 05:07 PM, alessio wrote:
>>> Thanks, so basically the /* mapping should not interfere with
>>> non-Wicket requests?
>>>
>>> In other words, static content as well as potential directory listings
>>> (respectively related error messages if disabled) will always be
>>> passed on and served by the underlying application server (be it
>>> WebSphere or Tomcat or .....), correct?
>>>
>>>
>>> Would you know why the StringIndexOutOfBoundsException occurs when I
>>> map the servlet to / without the wildcard/asterisk?
>>>
>>> I tried upgrading from 1.5.3 to 1.5.10 but still get the same exception
>>>
>>> java.lang.StringIndexOutOfBoundsException
>>> java.lang.String.substring(String.java:1238)
>>> org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:249)
>>> org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:88)
>>>
>>> org.apache.wicket.util.file.WebXmlFile.getUniqueFilterPath(WebXmlFile.java:67)
>>>
>>> org.apache.wicket.protocol.http.WicketFilter.getFilterPathFromWebXml(WicketFilter.java:452)
>>> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:360)
>>> org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:271)
>>> javax.servlet.GenericServlet.init(GenericServlet.java:160)
>>>
>>>
>>>
>>>
>>>
>>> On Wed, Aug 28, 2013 at 3:53 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>> Wicket passes such requests back to the default handler
>>>>
>>>> Yes, see WicketServlet#fallback()
>>>>
>>>>
>>>>> whether Wicket actually returns directory listings at all?
>>>>
>>>> No, it doesn't.
>>>>
>>>> Regards
>>>> Sven
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Directory Listings

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Thu, Aug 29, 2013 at 11:56 AM, alessio <al...@gmail.com> wrote:

> I believe I found the problem.
>
> It appears Wicket does not really pass non-Wicket requests back to a
> default handler, but handles them by itself in fallback() by using
>

This is how a Servlet works.
If there is a mapping that matches the request url then the web container
will use this servlet. If there is no such then the default servlet/handler
is used.

With Filter you can have several on the same mapping and they *may* use the
filter chain to let the next one to try to handle a request.


> getResourceAsStream() and in this case, for directories, WebSphere
> returns a listing regardless of its own directoryBrowsingEnabled
> setting.
>

So, try to use WicketFilter instead of WicketServlet if possible. I know
there are issues with WebSphere and Filters, but I think there is some
system setting that allows their usage.


>
> On Wed, Aug 28, 2013 at 7:23 PM, Sven Meier <sv...@meiers.net> wrote:
> > Wicket expects the path to end in a wildcard.
> >
> > Note that using WicketFilter instead of WicketServlet is recommended.
> >
> > Sven
> >
> >
> > On 08/28/2013 05:07 PM, alessio wrote:
> >>
> >> Thanks, so basically the /* mapping should not interfere with
> >> non-Wicket requests?
> >>
> >> In other words, static content as well as potential directory listings
> >> (respectively related error messages if disabled) will always be
> >> passed on and served by the underlying application server (be it
> >> WebSphere or Tomcat or .....), correct?
> >>
> >>
> >> Would you know why the StringIndexOutOfBoundsException occurs when I
> >> map the servlet to / without the wildcard/asterisk?
> >>
> >> I tried upgrading from 1.5.3 to 1.5.10 but still get the same exception
> >>
> >> java.lang.StringIndexOutOfBoundsException
> >> java.lang.String.substring(String.java:1238)
> >>
> org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:249)
> >> org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:88)
> >>
> >>
> org.apache.wicket.util.file.WebXmlFile.getUniqueFilterPath(WebXmlFile.java:67)
> >>
> >>
> org.apache.wicket.protocol.http.WicketFilter.getFilterPathFromWebXml(WicketFilter.java:452)
> >> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:360)
> >>
> org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:271)
> >> javax.servlet.GenericServlet.init(GenericServlet.java:160)
> >>
> >>
> >>
> >>
> >>
> >> On Wed, Aug 28, 2013 at 3:53 PM, Sven Meier <sv...@meiers.net> wrote:
> >>>>
> >>>> Wicket passes such requests back to the default handler
> >>>
> >>>
> >>> Yes, see WicketServlet#fallback()
> >>>
> >>>
> >>>> whether Wicket actually returns directory listings at all?
> >>>
> >>>
> >>> No, it doesn't.
> >>>
> >>> Regards
> >>> Sven
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Directory Listings

Posted by alessio <al...@gmail.com>.
I believe I found the problem.

It appears Wicket does not really pass non-Wicket requests back to a
default handler, but handles them by itself in fallback() by using
getResourceAsStream() and in this case, for directories, WebSphere
returns a listing regardless of its own directoryBrowsingEnabled
setting.

On Wed, Aug 28, 2013 at 7:23 PM, Sven Meier <sv...@meiers.net> wrote:
> Wicket expects the path to end in a wildcard.
>
> Note that using WicketFilter instead of WicketServlet is recommended.
>
> Sven
>
>
> On 08/28/2013 05:07 PM, alessio wrote:
>>
>> Thanks, so basically the /* mapping should not interfere with
>> non-Wicket requests?
>>
>> In other words, static content as well as potential directory listings
>> (respectively related error messages if disabled) will always be
>> passed on and served by the underlying application server (be it
>> WebSphere or Tomcat or .....), correct?
>>
>>
>> Would you know why the StringIndexOutOfBoundsException occurs when I
>> map the servlet to / without the wildcard/asterisk?
>>
>> I tried upgrading from 1.5.3 to 1.5.10 but still get the same exception
>>
>> java.lang.StringIndexOutOfBoundsException
>> java.lang.String.substring(String.java:1238)
>> org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:249)
>> org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:88)
>>
>> org.apache.wicket.util.file.WebXmlFile.getUniqueFilterPath(WebXmlFile.java:67)
>>
>> org.apache.wicket.protocol.http.WicketFilter.getFilterPathFromWebXml(WicketFilter.java:452)
>> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:360)
>> org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:271)
>> javax.servlet.GenericServlet.init(GenericServlet.java:160)
>>
>>
>>
>>
>>
>> On Wed, Aug 28, 2013 at 3:53 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>
>>>> Wicket passes such requests back to the default handler
>>>
>>>
>>> Yes, see WicketServlet#fallback()
>>>
>>>
>>>> whether Wicket actually returns directory listings at all?
>>>
>>>
>>> No, it doesn't.
>>>
>>> Regards
>>> Sven
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Directory Listings

Posted by Sven Meier <sv...@meiers.net>.
Wicket expects the path to end in a wildcard.

Note that using WicketFilter instead of WicketServlet is recommended.

Sven

On 08/28/2013 05:07 PM, alessio wrote:
> Thanks, so basically the /* mapping should not interfere with
> non-Wicket requests?
>
> In other words, static content as well as potential directory listings
> (respectively related error messages if disabled) will always be
> passed on and served by the underlying application server (be it
> WebSphere or Tomcat or .....), correct?
>
>
> Would you know why the StringIndexOutOfBoundsException occurs when I
> map the servlet to / without the wildcard/asterisk?
>
> I tried upgrading from 1.5.3 to 1.5.10 but still get the same exception
>
> java.lang.StringIndexOutOfBoundsException
> java.lang.String.substring(String.java:1238)
> org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:249)
> org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:88)
> org.apache.wicket.util.file.WebXmlFile.getUniqueFilterPath(WebXmlFile.java:67)
> org.apache.wicket.protocol.http.WicketFilter.getFilterPathFromWebXml(WicketFilter.java:452)
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:360)
> org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:271)
> javax.servlet.GenericServlet.init(GenericServlet.java:160)
>
>
>
>
>
> On Wed, Aug 28, 2013 at 3:53 PM, Sven Meier <sv...@meiers.net> wrote:
>>> Wicket passes such requests back to the default handler
>>
>> Yes, see WicketServlet#fallback()
>>
>>
>>> whether Wicket actually returns directory listings at all?
>>
>> No, it doesn't.
>>
>> Regards
>> Sven
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Directory Listings

Posted by alessio <al...@gmail.com>.
Thanks, so basically the /* mapping should not interfere with
non-Wicket requests?

In other words, static content as well as potential directory listings
(respectively related error messages if disabled) will always be
passed on and served by the underlying application server (be it
WebSphere or Tomcat or .....), correct?


Would you know why the StringIndexOutOfBoundsException occurs when I
map the servlet to / without the wildcard/asterisk?

I tried upgrading from 1.5.3 to 1.5.10 but still get the same exception

java.lang.StringIndexOutOfBoundsException
java.lang.String.substring(String.java:1238)
org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:249)
org.apache.wicket.util.file.WebXmlFile.getFilterPath(WebXmlFile.java:88)
org.apache.wicket.util.file.WebXmlFile.getUniqueFilterPath(WebXmlFile.java:67)
org.apache.wicket.protocol.http.WicketFilter.getFilterPathFromWebXml(WicketFilter.java:452)
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:360)
org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:271)
javax.servlet.GenericServlet.init(GenericServlet.java:160)





On Wed, Aug 28, 2013 at 3:53 PM, Sven Meier <sv...@meiers.net> wrote:
>> Wicket passes such requests back to the default handler
>
>
> Yes, see WicketServlet#fallback()
>
>
>> whether Wicket actually returns directory listings at all?
>
>
> No, it doesn't.
>
> Regards
> Sven
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Directory Listings

Posted by Sven Meier <sv...@meiers.net>.
> Wicket passes such requests back to the default handler

Yes, see WicketServlet#fallback()

> whether Wicket actually returns directory listings at all?

No, it doesn't.

Regards
Sven


On 08/28/2013 03:40 PM, alessio wrote:
> Hi,
>
> I am using Wicket 1.5.3 in a WebSphere context and encountered an
> interesting behaviour which I dont fully understand.
>
> My application uses a /* mapping to WicketServlet and the application
> generally works fine. However I wonder what happens to static content
> (images, ....) which is requested through the same path mapping?
> Due to the mapping I'd take it all requests go through Wicket and
> depending on whether the content physically exists on the disk it
> delivers it or processes the specified application class. Is this
> correct? The question arose from an interesting phenomenon with
> directories, respectively their listings ....
>
> I have a production instance running WebSphere and local development
> instance using Tomcat. Requests to static content always return the
> respective file. However the behaviour is different for directories.
> In the case of the production server (WebSphere) it returns the
> directory listing, in case of the development instance I get a Tomcat
> error.
>
> My initial assumption was, Wicket passes such requests back to the
> default handler and the listing comes from the respective server, but
> this does not seem to be the case as the directory listing layout I
> get (only a plain list with entry name) is entirely different from
> WebSphere's (fancier with entry dates, more formatting, ....).
>
> I also tried to simply map the servlet to / only (without the
> wildcard) but immediately get a StringIndexOutOfBoundsException in
> WebXmlFile.getFilterPath()
>
> Does anyone have a clue what is going on here and whether Wicket
> actually returns directory listings at all?
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org