Re: How do I combine Path params with Query params?

Splash Forums PrettyFaces Users How do I combine Path params with Query params? Re: How do I combine Path params with Query params?

#20511

EugeneV
Participant

Found my problem: my idea to move report-related *.xhtml files to their own subdirectory with the same name as the pattern that I was matching in pretty-config wasn’t so bright after all.

As I wrote, I wanted to have a single url-pattern in web.xml filter-mapping that could detect both “pretty” and regular URLs and then open a Hibernate session only for such requests, so that both /report/reportTag or /report/report-whatever.jsf?reportTag=anything would work.

What I didn’t think of was that requesting /report/report-whatever.jsf also matches my pattern in pretty-config (<pattern value=”report/#{reportBean.reportTag}” />) and sets reportTag to ‘report-whatever.jsf’. And then with an invalid reportTag, page action would result in an NullPointerException, as I already determined.

However, when I renamed my subdirectory with *.xhtml files from “report” to “reports”, so that “non-Pretty” requests would no longer match that pretty-config pattern, the issue was solved. Of course, I also had to add a second url-pattern to my Hibernate filter. Now it looks like:

<filter>
<filter-name>Hibernate Filter</filter-name>
<filter-class>com.nb.crest.servlet.HibernateSessionRequestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Hibernate Filter</filter-name>
<url-pattern>/report/*</url-pattern>
<url-pattern>/reports/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>