glassfish - Filtering javax.faces.resource in JSF -


my project used jsf 2.1, richfaces 4.1 , glassfish 3.1.2. registered filter in web.xml.
question: how filter resources of jsf , richfaces (example javax.faces.resource/richfaces-queue.js.xhtml), automatically included project?

web.xml

    <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"          xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"          version="3.0">      <!-- configuration of session -->     <session-config>         <session-timeout>15</session-timeout>         <cookie-config>             <http-only>true</http-only>         </cookie-config>     </session-config>      <welcome-file-list>         <welcome-file>index.xhtml</welcome-file>     </welcome-file-list>      <context-param>         <param-name>org.richfaces.skin</param-name>         <param-value>myskin</param-value>     </context-param>      <!-- runtime must interpret each entry  facelet tag library-->     <context-param>         <param-name>facelets.libraries</param-name>         <param-value>/web-inf/tags/taglib.xml</param-value>     </context-param>      <!-- alternate suffix jsf pages -->     <context-param>         <param-name>javax.faces.default_suffix</param-name>         <param-value>.xhtml</param-value>     </context-param>      <!-- xml comments in facelets source page not delivered client -->     <context-param>         <param-name>javax.faces.facelets_skip_comments</param-name>         <param-value>true</param-value>     </context-param>      <!-- project stage jsf (production | development | unittest | systemtes | extension) -->     <context-param>         <param-name>javax.faces.project_stage</param-name>         <param-value>development</param-value>     </context-param>       <filter>         <filter-name>authenticationfilter</filter-name>         <filter-class>ru.axetta.utils.web.jsfauthenticationfilter</filter-class>         <init-param>             <param-name>includes</param-name>             <param-value>/index.xhtml, /login.xhtml</param-value>         </init-param>         <init-param>             <!--                 relational context root, must start "/".                 example excludes: /javax.faces.resource/jquery.position.js.xhtml, /resource/images/logo.png, /rfres/toolbar.ecss.xhtml              -->             <param-name>excludes</param-name>             <param-value>^(/rfres/)(.+)(\u002e[a-za-z]+)(\u002exhtml)$,                 ^(/javax.faces.resource/)(.+)(\u002e[a-za-z]+)(\u002exhtml)$,                 ^(/resources/)([a-za-z]+/)(\w+)(\u002e)([a-za-z]+)$, /services, /cryptopro/applet             </param-value>         </init-param>         <init-param>             <param-name>loginpage</param-name>             <param-value>/login.xhtml</param-value>         </init-param>         <init-param>             <param-name>loginpagereplacement</param-name>             <param-value>/index.xhtml</param-value>         </init-param>     </filter>      <filter-mapping>         <filter-name>authenticationfilter</filter-name>         <url-pattern>/*</url-pattern>     </filter-mapping>      <!-- faces servlet -->     <servlet>         <servlet-name>faces servlet</servlet-name>         <servlet-class>javax.faces.webapp.facesservlet</servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>      <!-- faces servlet mapping -->     <servlet-mapping>         <servlet-name>faces servlet</servlet-name>         <url-pattern>*.xhtml</url-pattern>     </servlet-mapping>      <!-- page errors -->     <error-page>         <error-code>404</error-code>         <location>/include/error/errorpage.xhtml</location>     </error-page>      <error-page>         <error-code>500</error-code>         <location>/include/error/errorpage.xhtml</location>     </error-page>      <error-page>         <error-code>503</error-code>         <location>/include/error/errorpage.xhtml</location>     </error-page>      <error-page>         <exception-type>java.lang.throwable</exception-type>         <location>/include/error/errorpage.xhtml</location>     </error-page>  </web-app> 

jsfauthenticationfilter

public class jsfauthenticationfilter implements filter {      // ... variables      @override       //initialize     public void init(filterconfig filterconfig) throws servletexception {         // ...     }      @override      //filtering uri     public void dofilter(servletrequest request, servletresponse response, filterchain chain)             throws ioexception, servletexception {         httpservletrequest httprequest = (httpservletrequest) request;         httpsession httpsession = httprequest.getsession(true);         httpservletresponse httpresponse = (httpservletresponse) response;         string servletpath = httprequest.getservletpath();          //excluded data filtration (/javax.faces.resource/richfaces-queue.js.xhtml , other)         if (isurlexcluded(servletpath)) {             chain.dofilter(request, response);             return;         }          //processed data filter (/login.xhtml , /index.html)         if (isurlincluded(servletpath)) {             // ...         } else {    //for errors page             httpresponse.senderror(httpservletresponse.sc_not_found, messageformat.format("error message: page:{0} not found", servletpath));//404             chain.dofilter(request, response);             return;//redirect -> errorpage.xhtml         }     }      @override     public void destroy() {         // nothing here     } } 

problem # 1: if browser address bar enter path http:///myapp/javax.faces.resource/richfaces-queue.js.xhtml window print text of include resource

problem # 2: check excluded resource use regexp. if enter valid address, example http:///myapp/javax.faces.resource/richfaces2-queue.js.xhtml window print:

error parsing xml: element not found address: http:///myapp/javax.faces.resource/richfaces2-queue.js.xhtml line 1, character 1:

not redirect page errorpage.xhtml , no information in glassfish log. tell me please, make filtering resource , switching error page?

ps: similar problem (https://forums.oracle.com/forums/thread.jspa?threadid=1717040)


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -