Moving ActionFilter turned out to be much harder
than I thought. If
nobody cries out, I'll move the other two today.
Thanks,
Alex
On 08/25/2010 11:58 PM, Sergiu Dumitriu wrote:
On 08/24/2010 01:17 AM, Alex Busenius wrote:
> Hi devs,
>
>
> I propose to move servlet filters out of the old core to
> xwiki-container-servlet.
>
>
> There are 3 filters,
>
> com.xpn.xwiki.web.SetCharacterEncodingFilter
> com.xpn.xwiki.web.SavedRequestRestorerFilter
> com.xpn.xwiki.web.ActionFilter
>
> They are almost self-contained (except for ActionFilter, see a note
> later) and are easy to move. Moreover, SavedRequestRestorerFilter offers
> functionality to save the request, that might also be useful in other
> places (like csrf-token). There is (currently) no need for portlet
> filters, so moving filters into a separate module doesn't seem to be
> worth it.
>
> Since the filters are not used directly, I'd move them into
> org.xwiki.container.servlet.filters.internal and public methods used
> elsewhere into org.xwiki.container.servlet.filters.
>
> Note that xwiki-core would become dependent on xwiki-container-servlet
> (it currently depends on container-api), but it shouldn't be a problem.
+1 for moving SCEF and SRRF, but not AF.
> In more detail,
>
> * SetCharacterEncodingFilter would be moved as is to filters.internal.
>
> * SavedRequestRestorerFilter would be split into the actual filter and
> SavedRequestManager that would contain the static methods
> String getOriginalUrl(HttpServletRequest)
> String saveRequest(HttpServletRequest)
> String getRequestIdentifier()
> SavedRequestManager could also be a component, but it would make it
> more complicated to use from the filter.
>
> * ActionFilter should be moved to filters.internal too, but it uses
> XWiki.stripSegmentFromPath(String, String) to parse the URL and
> replace the action part by the stored value.
>
>
> There are 2 other copies of the URL parsing code that uses
> stripSegmentFromPath(...), in XWiki.getDocumentReference(...) and
> XWiki.getXWiki(...), I can think of 3 alternatives:
> 1. Leave ActionFilter in the core
> 2. Move URL parsing code into xwiki-url, i.e. add/implement missing
> methods to create XWikiURL from string representation and extract
> host, action, document reference and parameters from it.
> 3. Move stripSegmentFromPath(...) to xwiki-container-servlet too
>
>
> I'm +1 for 2, since it's the cleanest option.
+1 for 1, for the moment.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org