Primefaces and Spring Security: Ajax listener not triggered -


i'm working primefaces 5.2 , spring-security 4.0.1 , use netbeans ide (so glassfish 4.1) , try make dashboard , dynamically add wiget.

in order deploy on server, i've added security spring security. moment, it's someting basic, using authentication , default filter.

so, when launch (the project), i'm correctly redirected default login page (i've configured spring use 8181 port, glassfish https default port), , log in normally.

but, on, when drag widget library zone , drop on dashboard (which datagrid inside outputpanel inside fieldset) zone, nothing happens. there's same animation usual (it disappeared , didn't go library zone), there's no widget on dashboard, if refresh page.

if comment filter , filter-mapping sections on web.xml, of course, there's no redirection login page , https protocol, widget drop works normally.

it might problem between ajax , spring (the function inside p:ajax not called). have idea fix that?

here's different code sections (it might enough, if missing, tell me it)

web.xml file

    <?xml version="1.0" encoding="utf-8"?>     <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">     <context-param>         <param-name>javax.faces.project_stage</param-name>         <param-value>development</param-value>     </context-param>     <context-param>         <param-name>primefaces.theme</param-name>         <param-value>#{themeswitcherbean.theme}</param-value>      </context-param>      <servlet>         <servlet-name>faces servlet</servlet-name>         <servlet-class>javax.faces.webapp.facesservlet</servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>      <servlet-mapping>         <servlet-name>faces servlet</servlet-name>         <url-pattern>/faces/*</url-pattern>     </servlet-mapping>     <servlet-mapping>         <servlet-name>faces servlet</servlet-name>         <url-pattern>*.jsf</url-pattern>     </servlet-mapping>     <servlet-mapping>         <servlet-name>faces servlet</servlet-name>         <url-pattern>*.faces</url-pattern>     </servlet-mapping>     <servlet-mapping>         <servlet-name>faces servlet</servlet-name>         <url-pattern>*.xhtml</url-pattern>     </servlet-mapping>     <session-config>         <session-timeout>             30         </session-timeout>     </session-config>      <welcome-file-list>         <welcome-file>dashboard.xhtml</welcome-file>     </welcome-file-list>      <listener>         <listener-class>org.springframework.web.context.contextloaderlistener         </listener-class>     </listener>      <!-- loads spring security config file -->     <context-param>         <param-name>contextconfiglocation</param-name>         <param-value>             /web-inf/applicationcontext-security.xml         </param-value>     </context-param>      <!-- spring security (disable drop????) -->     <filter>         <filter-name>springsecurityfilterchain</filter-name>         <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class>     </filter>     <filter-mapping>         <filter-name>springsecurityfilterchain</filter-name>         <url-pattern>/*</url-pattern>     </filter-mapping> </web-app> 

applicationcontext-security.xml

    <?xml version="1.0" encoding="utf-8"?>      <!-- - sample namespace-based configuration - -->      <beans:beans xmlns="http://www.springframework.org/schema/security"              xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"              xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd                         http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd">      <http auto-config="true" use-expressions="true">         <intercept-url pattern="/**" access="authenticated" requires-channel="https"/>         <intercept-url pattern="/resources/css" access="permitall"/>         <!-- page level spring security : enable primefaces -->         <intercept-url pattern="/javax.faces.resource/**" access="permitall"/>          <!-- default configuration: https port glassfish 8181 , not 8443 tomcat (http:8080, administration:4848-->         <port-mappings>             <port-mapping http="8080" https="8181"/>         </port-mappings>          <form-login />         <logout />         <remember-me />         <!-- uncomment enable x509 client authentication support <x509 /> -->         <!-- uncomment limit number of sessions user can have -->         <session-management>             <concurrency-control max-sessions="100"                                              error-if-maximum-exceeded="true" />         </session-management>      </http>      <authentication-manager>         <authentication-provider>             <password-encoder hash="md5" />             <user-service>                 <!-- users -->             </user-service>         </authentication-provider>     </authentication-manager>  </beans:beans> 

droppable tag inside xhtml page

<p:droppable id ="d1" for="selectedwidgets" tolerance="touch" activestyleclass="ui-state-highlight" datasource=":#{p:component('groupwidgets')}">               <p:ajax listener="#{widgetstablebean.ondrop}" update="droparea"/>   </p:droppable>  

(selectedwidgets fieldset of dashboard , droparea outputpanel)

function call p:ajax

 public void ondrop(dragdropevent ddevent) {         widget widget = ((widget) ddevent.getdata());         this.selectedwidget = widget;         droppedwidgets.add(this.selectedwidget);         /*test*/         system.out.println("drop: ");         (int = 0; < droppedwidgets.size(); i++) {             system.out.println(droppedwidgets.get(i).getid());         }     } 

i hope i've made myself clear , in advance answers

after having tried modifications in code , implemented function change dashboard language, csrf error thrown (invalid csrf token 'null' found on request parameter '_csrf' or header 'x-csrf-token'.

i added in .xhtml form: <input type="hidden" name="${_csrf.parametername}" value="${_csrf.token}"/>

and works. everyone.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -