1 2 3 Previous Next 39 Replies Latest reply on Oct 5, 2006 5:16 PM by tszpinda Go to original post
      • 15. Re: myfaces ExtensionsPhaseListener
        prenger

        Right now I'm using the 1.1.4 snapshot

        • 16. Re: myfaces ExtensionsPhaseListener
          dajevtic

          Have you followed all the steps under http://myfaces.apache.org/tomahawk/extensionsFilter.html ???
          Note that the filter is a new package!!!

          • 17. Re: myfaces ExtensionsPhaseListener
            prenger

            Yes, I did. Here's a part of my web.xml:


            <filter-name>extensionsFilter</filter-name>
            <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
            <init-param>
            Set the size limit for uploaded files.
            Format: 10 - 10 bytes
            10k - 10 KB
            10m - 10 MB
            1g - 1 GB
            <param-name>uploadMaxFileSize</param-name>
            <param-value>100m</param-value>
            </init-param>
            <init-param>
            Set the threshold size - files
            below this limit are stored in memory, files above
            this limit are stored on disk.

            Format: 10 - 10 bytes
            10k - 10 KB
            10m - 10 MB
            1g - 1 GB
            <param-name>uploadThresholdSize</param-name>
            <param-value>100k</param-value>
            </init-param>
            <init-param>
            <param-name>uploadRepositoryPath</param-name>
            <param-value>/temp</param-value>
            </init-param>

            <filter-mapping>
            <filter-name>MyFacesExtensionsFilter</filter-name>
            <servlet-name>FacesServlet</servlet-name>
            </filter-mapping>
            <filter-mapping>
            <filter-name>MyFacesExtensionsFilter</filter-name>
            <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
            </filter-mapping>

            I'm very sorry, but what do you mean with "filter is a new package" ? My guess is, that I should use org.apache.myfaces.component.html.util.ExtensionsFilter and not
            org.apache.myfaces.webapp.filter.ExtensionsFilter. But I get the exception with both opportunities.

            • 18. Re: myfaces ExtensionsPhaseListener
              dajevtic

              Not quite. In one part you are calling your filter extensionsFilter but you are referring to it as MyExtesionsFilter. They must be the same.

              • 19. Re: myfaces ExtensionsPhaseListener
                dajevtic

                I think the ...html.util... package is the old one. Use the other one.

                • 20. Re: myfaces ExtensionsPhaseListener
                  prenger

                  Ooops, my mistake. Too much despaired copy and paste. But the Problem remains. With the corrected web.xml (like this):


                  <filter-name>extensionsFilter</filter-name>
                  <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
                  <init-param>
                  Set the size limit for uploaded files.
                  Format: 10 - 10 bytes
                  10k - 10 KB
                  10m - 10 MB
                  1g - 1 GB
                  <param-name>uploadMaxFileSize</param-name>
                  <param-value>100m</param-value>
                  </init-param>
                  <init-param>
                  Set the threshold size - files
                  below this limit are stored in memory, files above
                  this limit are stored on disk.

                  Format: 10 - 10 bytes
                  10k - 10 KB
                  10m - 10 MB
                  1g - 1 GB
                  <param-name>uploadThresholdSize</param-name>
                  <param-value>100k</param-value>
                  </init-param>
                  <init-param>
                  <param-name>uploadRepositoryPath</param-name>
                  <param-value>/temp</param-value>
                  </init-param>

                  <filter-mapping>
                  <filter-name>extensionsFilter</filter-name>
                  <url-pattern>*.jsf</url-pattern>
                  </filter-mapping>
                  <filter-mapping>
                  <filter-name>extensionsFilter</filter-name>
                  <url-pattern>/faces/*</url-pattern>
                  </filter-mapping>
                  <filter-mapping>
                  <filter-name>extensionsFilter</filter-name>
                  <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
                  </filter-mapping>

                  I do not get the exception, but my application goes back to
                  /rootdir/# everytime I select a schedule entry.

                  • 21. Re: myfaces ExtensionsPhaseListener
                    prenger

                    By the way, I appreciate your help very much.

                    • 22. Re: myfaces ExtensionsPhaseListener
                      dajevtic

                      n/p
                      I just hope, we get it straightened out.
                      Are you using any kind of listeners (in web.xml or faces-config.xml)?
                      please post your complete faces-config.xml and your web.xml

                      • 23. Re: myfaces ExtensionsPhaseListener
                        prenger

                        My web.xml:

                        <?xml version="1.0" encoding="UTF-8"?>

                        <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
                        <context-param>
                        State saving method: "client" or "server" (= default)
                        See JSF Specification 2.5.2
                        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                        <param-value>client</param-value>
                        </context-param>
                        <context-param>
                        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
                        <param-value>true</param-value>
                        </context-param>
                        <context-param>
                        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
                        <param-value>false</param-value>
                        </context-param>
                        <context-param>
                        <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
                        <param-value>true</param-value>
                        </context-param>
                        <context-param>
                        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
                        <param-value>false</param-value>
                        </context-param>
                        <context-param>
                        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
                        <param-value>true</param-value>
                        </context-param>

                        <filter-name>extensionsFilter</filter-name>
                        <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
                        <init-param>
                        <param-name>uploadMaxFileSize</param-name>
                        <param-value>100m</param-value>
                        </init-param>
                        <init-param>
                        <param-name>uploadThresholdSize</param-name>
                        <param-value>100k</param-value>
                        </init-param>
                        <init-param>
                        <param-name>uploadRepositoryPath</param-name>
                        <param-value>/temp</param-value>
                        </init-param>

                        <filter-mapping>
                        <filter-name>extensionsFilter</filter-name>
                        <url-pattern>*.jsf</url-pattern>
                        </filter-mapping>
                        <filter-mapping>
                        <filter-name>extensionsFilter</filter-name>
                        <url-pattern>/faces/*</url-pattern>
                        </filter-mapping>
                        <filter-mapping>
                        <filter-name>extensionsFilter</filter-name>
                        <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
                        </filter-mapping>

                        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>


                        <servlet-name>Faces Servlet</servlet-name>
                        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                        <load-on-startup>1</load-on-startup>

                        <servlet-mapping>
                        <servlet-name>Faces Servlet</servlet-name>
                        <url-pattern>*.jsf</url-pattern>
                        </servlet-mapping>
                        <welcome-file-list>
                        <welcome-file>login.jsf</welcome-file>
                        </welcome-file-list>
                        </web-app>

                        The faces-config.xml just contains managed beans and navigation rules.

                        • 24. Re: myfaces ExtensionsPhaseListener
                          dajevtic

                          do you get an exception if you remove the listener-class entry?

                          • 25. Re: myfaces ExtensionsPhaseListener
                            dajevtic

                            second, did you package any libs with your war file? (in /WEB-INF/lib)

                            • 26. Re: myfaces ExtensionsPhaseListener
                              dajevtic

                              FYI! This is the web.xml I use with the current svn version of myfaces, which works fine. Have you tried using server state saving?:

                              <?xml version="1.0" encoding="UTF-8"?>
                              <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
                               <description>debug web.xml</description>
                               <context-param>
                               <description>Comma separated list of URIs of (additional) faces config files.
                               (e.g. /WEB-INF/my-config.xml)
                               See JSF 1.0 PRD2, 10.3.2
                               Attention: You do not need to put /WEB-INF/faces-config.xml in here.
                               </description>
                               <param-name>javax.faces.CONFIG_FILES</param-name>
                               <param-value>/WEB-INF/examples-config.xml</param-value>
                               </context-param>
                               <context-param>
                               <description>State saving method: "client" or "server" (= default)
                               See JSF Specification 2.5.3</description>
                               <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                               <param-value>server</param-value>
                               </context-param>
                               <context-param>
                               <description>Only applicable if state saving method is "server" (= default).
                               Defines the amount (default = 20) of the latest views are stored in session.</description>
                               <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
                               <param-value>20</param-value>
                               </context-param>
                               <context-param>
                               <description>Only applicable if state saving method is "server" (= default).
                               If true (default) the state will be serialized to a byte stream before it
                               is written to the session.
                               If false the state will not be serialized to a byte stream.</description>
                               <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
                               <param-value>true</param-value>
                               </context-param>
                               <context-param>
                               <description>Only applicable if state saving method is "server" (= default) and if
                               org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default)
                               If true (default) the serialized state will be compressed before it
                               is written to the session. If false the state will not be compressed.</description>
                               <param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
                               <param-value>true</param-value>
                               </context-param>
                               <context-param>
                               <description>This parameter tells MyFaces if javascript code should be allowed in the
                               rendered HTML output.
                               If javascript is allowed, command_link anchors will have javascript code
                               that submits the corresponding form.
                               If javascript is not allowed, the state saving info and nested parameters
                               will be added as url parameters.
                               Default: "true"</description>
                               <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
                               <param-value>true</param-value>
                               </context-param>
                               <context-param>
                               <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
                               <param-value>false</param-value>
                               </context-param>
                               <context-param>
                               <description>If true, rendered HTML code will be formatted, so that it is "human readable".
                               i.e. additional line separators and whitespace will be written, that do not
                               influence the HTML code.
                               Default: "true"</description>
                               <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
                               <param-value>true</param-value>
                               </context-param>
                               <context-param>
                               <description>If true, a javascript function will be rendered that is able to restore the
                               former vertical scroll on every request. Convenient feature if you have pages
                               with long lists and you do not want the browser page to always jump to the top
                               if you trigger a link or button action that stays on the same page.
                               Default: "false"</description>
                               <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
                               <param-value>true</param-value>
                               </context-param>
                              
                               <context-param>
                               <description>
                               Validate managed beans and navigation rules.
                               </description>
                               <param-name>org.apache.myfaces.validate</param-name>
                               <param-value>true</param-value>
                               </context-param>
                              
                              <!--
                               <context-param>
                               <description>A class implementing the
                               org.apache.myfaces.shared.renderkit.html.util.AddResource
                               interface. It is responsible to
                               place scripts and css on the right position in your HTML document.
                               Default: "org.apache.myfaces.shared.renderkit.html.util.DefaultAddResource"</description>
                               <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
                               <param-value>org.apache.myfaces.component.html.util.StreamingAddResource</param-value>
                               </context-param>
                              -->
                              
                               <filter>
                               <filter-name>extensionsFilter</filter-name>
                               <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
                               <init-param>
                               <description>Set the size limit for uploaded files.
                               Format: 10 - 10 bytes
                               10k - 10 KB
                               10m - 10 MB
                               1g - 1 GB</description>
                               <param-name>uploadMaxFileSize</param-name>
                               <param-value>100m</param-value>
                               </init-param>
                               <init-param>
                               <description>Set the threshold size - files
                               below this limit are stored in memory, files above
                               this limit are stored on disk.
                              
                               Format: 10 - 10 bytes
                               10k - 10 KB
                               10m - 10 MB
                               1g - 1 GB</description>
                               <param-name>uploadThresholdSize</param-name>
                               <param-value>100k</param-value>
                               </init-param>
                               </filter>
                               <filter-mapping>
                               <filter-name>extensionsFilter</filter-name>
                               <url-pattern>*.jsf</url-pattern>
                               </filter-mapping>
                               <filter-mapping>
                               <filter-name>extensionsFilter</filter-name>
                               <url-pattern>/faces/*</url-pattern>
                               </filter-mapping>
                               <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>*.jsf</url-pattern>
                               </servlet-mapping>
                              
                               <welcome-file-list>
                               <welcome-file>index.jsp</welcome-file>
                               <welcome-file>index.html</welcome-file>
                               </welcome-file-list>
                               <error-page>
                               <error-code>500</error-code>
                               <location>/error.jsp</location>
                               </error-page>
                              </web-app>
                              


                              • 27. Re: myfaces ExtensionsPhaseListener
                                prenger

                                I get no exception when I remove the listener entry. And I have no jars in the lib directory. I changed my web.xml to your settings, but that does not solve the problem. Which examples are you using? The ones for version 1.1.1 or newer? To specify the problem, this is, what is rendered for the schedule entry:

                                <a onmouseover="return makeTrue(domTT_activate(this, event, 'caption', 'Test', 'content', '&lt;i&gt;&lt;/i&gt;&lt;br/&gt;Hallo?', 'trail', true));" href="#" onmouseup="fireEntrySelected('_idJsp2', '_idJsp2:schedule1', 'null');" class="entry" style="position: absolute; height: 365px; top: 74px; left: 0.0%; width: 99.5%; padding: 0px; overflow: hidden; border-width: 1.0px; border-style:solid;">Test

                                If I click on the entry, the function "fireEntrySelected" is called, which redirects to "/Appdir/#" and does not stay on the actual page. I also tried to place the schedule in a sepparated form. Doesn't work.
                                Have you tried to select an entry with your solution? Does it work properly?

                                • 28. Re: myfaces ExtensionsPhaseListener
                                  prenger

                                  Sorry, I forgot to disable html in my post. This is (again) waht is rendered for the schedule entry:

                                  <a onmouseover="return makeTrue(domTT_activate(this, event, 'caption', 'Test', 'content', '&lt;i&gt;&lt;/i&gt;&lt;br/&gt;Hallo?', 'trail', true));" href="#" onmouseup="fireEntrySelected('_idJsp2', '_idJsp2:schedule1', 'null');" class="entry" style="position: absolute; height: 365px; top: 74px; left: 0.0%; width: 99.5%; padding: 0px; overflow: hidden; border-width: 1.0px; border-style:solid;">Test

                                  • 29. Re: myfaces ExtensionsPhaseListener
                                    prenger

                                    Sorry, somehow I can't deactivate html, but I hope you get the point.