Custom Search

[Top] [All Lists]

Re: Clean URLs - URLRewrite (forward) NPE

Subject: Re: Clean URLs - URLRewrite (forward) NPE
Date: Wed, 20 Jun 2007 09:09:03 -0700 (PDT)
Awesome, thanks Ben - that did the trick. Not sure how i overlooked that one
either. The Filter now seems to be working as expected.
For future reference for anyone one else encountering the same/similar
problem who finds themselves stumbling across this thread, i ammended the
StripesFilter mapping to read as follows, adding the 'dispatcher' element
highlighted in bold;
<!-- start -->
<!-- end -->
Many thanks,
Ben Gunter wrote:
> I don't know how I missed it last time, but in both cases (yours and the 
> one you referenced) it looks like DispatcherServlet.service(...) is 
> being invoked without StripesFilter.doFilter(...) ever having been 
> called. Make sure in your web.xml that StripesFilter is set to execute 
> on REQUEST and FORWARD. Or you might be able to get away with making 
> StripesFilter execute before UrlRewriteFilter instead of after on REQUEST.
> -Ben
> sja wrote:
>> Hi,
>> I'm trying to get Paul Tuckey's URL Rewrite Filter to work with Stripes
>> (v1.4.2) without limited success. I have a 'rule' configured in my
>> urlrewrite.xml file that should! forward requests any requests matching
>> the
>> url pattern specified in the 'from' element to that of the 'to' element.
>> However this, the default behaviour of the simplest rule you can specify
>> results in a NPE error being returned by the Stripes DispatcherServlet.
>> The problem was subject of another thread on this forum a little while
>> back
>> (
>> ), but the thread has since gone quiet without resolution as far as i can
>> tell.
>> <snip>
>> java.lang.NullPointerException
>> net.sourceforge.stripes.controller.DispatcherServlet.doOneTimeConfiguration(
>> net.sourceforge.stripes.controller.DispatcherServlet.doPost(
>> net.sourceforge.stripes.controller.DispatcherServlet.doGet(
>>      javax.servlet.http.HttpServlet.service(
>>      javax.servlet.http.HttpServlet.service(
>> org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(
>> org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(
>>      org.tuckey.web.filters.urlrewrite.RuleChain.doRules(
>> org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(
>> org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(
>> </snip>
>> Hopefully, the simplest example to illustrate my point.
>> - this rule does not! :(-
>> <rule>
>>   <from>/page/([A-Za-z]+)/([0-9]+)</from>
>>   <to>%{context-path}/Page.action?event=$1&id=$2</to>
>> </rule>
>> - this rule works :) -
>> <rule>
>>   <from>/page/([A-Za-z]+)/([0-9]+)</from>
>>   <to type="redirect">%{context-path}/Page.action?event=$1&id=$2</to>
>> </rule>
>> If I explicitly declare a 'type' attribute with the value 'redirect' on
>> the
>> 'to' element of the first rule above (see second rule) everything works
>> as
>> it should and the user is redirected to the URL specified in the 'to'
>> element. But i don't want the user being physically redirected as this
>> defeats one of the purposes of using the URL Rewrite Filter, to hide
>> complex/ugly URLs from the user by presenting/letting them use
>> clean/friendly URL's that map onto/get turned into complex/ugly URLs in
>> the
>> background in a way that's invisible to the user. So what i get is this;
>> # http://localhost:9090/contextname/page/view/23 
>>  - redirects (shown to user in browser addressbar) to -
>> # http://localhost:9090/contextname/app/Page.action?id=23  
>>  - (view = default handler hence not specified, but could also = edit,
>> update, new...., e.g.
>> http://localhost:9090/contextname/app/Page.action?edit=&id=23) 
>> What I actually want and expect to happen using the default URL Rewrite
>> Filter behaviour (= forward) is that the first 'clean' URL forwards
>> sliently
>> in the background to the second URL, such that the second URL is masked
>> to
>> the user/browser by the first so that it's never seen.
>> I'm familiar with the Stripes Clean URL extension
>> ( and have used it succesfully in
>> the
>> past, however it requires the addition of another dispatcher url mapping
>> in
>> apps web.xml, so urls like  #
>> http://localhost:9090/contextname/page/view/23 
>> - become -  # http://localhost:9090/contextname/app/page/view/23 . I
>> could
>> get around this minor  problem if URL Rewrite Filter / Stripes played
>> nicely
>> together, but then i wouldn't need to use the extension at all if that
>> were
>> the case and could do all i needed by configuring URL Rewrite Filter
>> rules,
>> fwding to and masking default unclean Stripes URL's. There are also other
>> benefits of using the more full feature URL Rewrite Filter instead of/in
>> addition to the Stripes Clean URL extension.
>> Any help would be very much appreciated.
>> Many thanks,
>> Simon
> -------------------------------------------------------------------------
> This email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> _______________________________________________
> Stripes-users mailing list
> [email protected]
View this message in context:
Sent from the stripes-users mailing list archive at
This email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy