FileUpload not working, Event not fired

<<

dominik.dorn

Posts: 13

Joined: Mon Sep 28, 2009 10:28 am

Post Sat Dec 05, 2009 8:00 pm

FileUpload not working, Event not fired

Hi,

I'm trying to implement a FileUpload, just like in the showcase.

I'm using PrimeFaces 2.0.0-RC on a Glassfish v3 latest-snapshot

After figuring out some problems I already posted in the issue tracker, I'm still having problems,
meaning that the eventListener in the backing bean is not called.

My Code:


  Code:
       <h:form prependId="false">

            <p:growl id="messages" />

            <div>
                <h2>1. Lade Dein Dokument hoch</h2>
                #{fileUploadController.test} <!-- this works, the property is always retrieved -->


                    <pre>
                    <h:outputLabel for="documentToUpload">Dokument</h:outputLabel>
                    <p:fileUpload id="documentToUpload" fileUploadListener="#{fileUploadController.fileUploadListener}"

                                  update="messages"
                                  sizeLimit="1073741824"

                                  allowTypes="*.doc;*.docx;*.odt;*.pdf" description="Dokumente"/>

                        <h:commandButton/>
                    </pre>

....
</h:form>


my web.xml

  Code:
    <filter>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <filter-class>
            org.primefaces.webapp.filter.FileUploadFilter
        </filter-class>
        <init-param>
            <param-name>thresholdSize</param-name>
            <param-value>51200</param-value>
        </init-param>
        <init-param>
            <param-name>uploadDirectory</param-name>
            <param-value>/tmp/fileUpload</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>


and my bean:

  Code:
@RequestScoped
@ManagedBean(name = "fileUploadController")
public class FileUploadController {
    private static Logger logger = Logger.getLogger("fileUploadController");


    public FileUploadController() {
        System.out.println("CREATING FileUploadController");
    }

    private String test = "FOOBAR";

    public String getTest() {
        System.out.println("retrieving test");
        logger.log(Level.WARNING, "RETRIEVING TEST");
        return test;
    }

    public void setTest(String test) {
        this.test = test;
    }

    public void fileUploadListener(org.primefaces.event.FileUploadEvent event) {
        logger.log(Level.WARNING, "Uploaded: {}", event.getFile().getFileName());


        FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
        FacesContext.getCurrentInstance().addMessage(null, msg);


        try {



//            File result = File.createTempFile("upl_", ".skriptum_doc", new File("/tmp/skriptum_upload/"));
            System.out.println("event.getFile().getSize() = " + event.getFile().getSize());
            System.out.println("event.getFile().getFileName() = " + event.getFile().getFileName());
            System.out.println("event.getFile().getContentType() = " + event.getFile().getContentType());

//            File result = File.createTempFile("upl_", ".skriptum_doc", new File("/uploaded_files/"));

            File result = new File("uploaded_file_" + new Date().getTime() );
            System.out.println("result.getName() = " + result.getName());

            FileOutputStream out = new FileOutputStream(result);

            int BUFFER_SIZE = 8192;
            byte[] buffer = new byte[BUFFER_SIZE];

            int a;
            InputStream is = event.getFile().getInputstream();
            while (true) {
                a = is.read(buffer);
                if (a < 0)
                    break;
                out.write(buffer, 0, a);
                out.flush();
            }

            out.close();
            is.close();
            System.out.println("file written");

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


however, the method fileUploadListener is never called and after looking into the codebase of primeFaces current trunk, I'm not even sure where this event gets created..


My IDE (IntelliJ Idea) also tells me that there is a type mismatch:
  Code:

Method 'void fileUPloadListener(FileUploadEvent)' does not match 'void fileUploadListener(org.primefaces.event.fileupload.FileUploadEvent)'

Detail
"This inspection checks if method calls in EL match method-signature constraints in TLD files. "



However, I'm not sure why this is happening.

Please help.

Kind regards,
Dominik
<<

yigit.darcin

User avatar

Autobot

Posts: 163

Joined: Sun Jan 04, 2009 5:02 pm

Location: Turkey

Post Sun Dec 06, 2009 10:27 am

Re: FileUpload not working, Event not fired

Hi,

can you check these two things:

1. You said the error is Method 'void fileUPloadListener(FileUploadEvent)' does not match 'void fileUploadListener(org.primefaces.event.fileupload.FileUploadEvent)'

one of them is UPload other is Upload, the P is upper case in the first place, please make sure the case sensitivity.

2. Please make sure your state saving is server in your web.xml file:

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<<

dominik.dorn

Posts: 13

Joined: Mon Sep 28, 2009 10:28 am

Post Sun Dec 06, 2009 8:46 pm

Re: FileUpload not working, Event not fired

Hello,

1. was just a typo here in the forum.

2. I changed it, but it does still does not work.

I sniffed the network traffic using wireshark when submitting/uploading the file and the file is transfered to the server, the temporary file is created but the resulting page ( the one only visible by sniffing the network traffic) throws a javax.faces.application.ViewExpiredException

----

ok, I actually narrowed down the problem even more...

my faces servlet is mapped like this
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

now, JSF 2.0 allows faces to be called either as /upload or as /upload.xhtml

When I open the page as /upload.xhtml, try to upload a sample file (0.5kb) i get a ViewExpiredException like this
  Code:
POST /skriptum/upload.xhtml;jsessionid=56e7c11d28a245b1de5b4ecee5bd HTTP/1.1

Host: localhost:8080

Accept: */*

User-Agent: Shockwave Flash
Connection: Keep-Alive
Cache-Control: no-cache

Content-Length: 1171

Expect: 100-continue

Content-Type: multipart/form-data; boundary=----------------------------8fafa1477dfa



HTTP/1.1 100 Continue



------------------------------8fafa1477dfa

Content-Disposition: form-data; name="Filename"



blabla.pdf

------------------------------8fafa1477dfa

Content-Disposition: form-data; name="primefacesAjaxRequest"



true

------------------------------8fafa1477dfa

Content-Disposition: form-data; name="javax.faces.ViewState"



-6524465661669890995:6420893136122431694

------------------------------8fafa1477dfa

Content-Disposition: form-data; name="j_idt15"



j_idt15

------------------------------8fafa1477dfa

Content-Disposition: form-data; name="update"



messages

------------------------------8fafa1477dfa

Content-Disposition: form-data; name="fileext"



*.doc;*.docx;*.odt;*.pdf

------------------------------8fafa1477dfa

Content-Disposition: form-data; name="folder"



/skriptum/

------------------------------8fafa1477dfa

Content-Disposition: form-data; name="documentToUpload"; filename="blabla.pdf"

Content-Type: application/octet-stream



asdkfasdf
asd
f
asd
f
asd
f
asdfasdf



EOF!!!



------------------------------8fafa1477dfa

Content-Disposition: form-data; name="Upload"



Submit Query

------------------------------8fafa1477dfa--

HTTP/1.1 500 Internal Server Error

Content-Type: text/html;charset=UTF-8

Transfer-Encoding: chunked

Date: Sun, 06 Dec 2009 20:34:53 GMT

Connection: close



2000

<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License").  You
may not use this file except in compliance with the License. You can obtain
a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
language governing permissions and limitations under the License.

When distributing the software, include this License Header Notice in each
file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
Sun designates this particular file as subject to the "Classpath" exception
as provided by Sun in the GPL Version 2 section of the License file that
accompanied this code.  If applicable, add the following below the License
Header, with the fields enclosed by brackets [] replaced by your own
identifying information: "Portions Copyrighted [year]
[name of copyright owner]"

Contributor(s):

If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license."  If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above.  However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.

This file incorporates work covered by the following copyright and
permission notice:

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Error - viewId:/upload.xhtml - View /upload.xhtml could not be restored.</title>
<style type="text/css">
body, div, span, td, th, caption { font-family: 'Trebuchet MS', Verdana, Arial, Sans-Serif; font-size: small; }
ul, li, pre { padding: 0; margin: 0; }
h1 { color: #900; }
h2, h2 span { font-size: large; color: #339; }
h2 a { text-decoration: none; color: #339; }
.grayBox { padding: 8px; margin: 10px 0; border: 1px solid #CCC; background-color: #f9f9f9;  }
#error { color: #900; font-weight: bold; font-size: medium; }
#trace, #tree, #vars { display: none; }
code { font-size: medium; }
#tree dl { color: #006; }
#tree dd { margin-top: 2px; margin-bottom: 2px; }
#tree dt { border: 1px solid #DDD; padding: 4px; border-left: 2px solid #666; font-family: "Courier New", Courier, mono; font-size: small; }
.uicText { color: #999;  }
table { border: 1px solid #CCC; border-collapse: collapse; border-spacing: 0px; width: 100%; text-align: left; }
td { border: 1px solid #CCC; }
thead tr th { padding: 2px; color: #030; background-color: #F9F9F9; }
tbody tr td { padding: 10px 6px; }
table caption { text-align: left; padding: 10px 0; font-size: large; }
</style>
<style type="text/css" media="print">
#trace, #tree, #vars { display: block; }
</style>
<script language="javascript" type="text/javascript">
function faceletstoggle(id) {
    var style = document.getElementById(id).style;
    if ("block" == style.display) {
        style.display = "none";
        document.getElementById(id+"Off").style.display = "inline";
        document.getElementById(id+"On").style.display = "none";
    } else {
        style.display = "block";
        document.getElementById(id+"Off").style.display = "none";
        document.getElementById(id+"On").style.display = "inline";
    }
}
</script>
</head>
<body>
<div id="javax.faces.error.xhtml">
<h1>An Error Occurred:</h1>
<div id="error" class="grayBox" style="border: 1px solid #900;">viewId:/upload.xhtml - View /upload.xhtml could not be restored.</div>
<h2><a href="#" onclick="faceletstoggle('trace'); return false;"><span id="traceOff">+</span><span id="traceOn" style="display: none;">-</span> Stack Trace</a></h2>
<div id="trace" class="grayBox"><pre><code>javax.faces.application.ViewExpiredException: viewId:/upload.xhtml - View /upload.xhtml could not be restored.
.at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:212)
.at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
.at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
.at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
.at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
.at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
.at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
.at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
.at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:77)
.at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
.at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
.at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:74)
.at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
.at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
.at com.dominikdorn.sk.service.UserRoleFilter.doFilter(UserRoleFilter.java:46)
.at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
.at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
.at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
.at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
.at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
.at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
.at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
.at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
.at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
.at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
.at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
.at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
.at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
.at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
.at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
.at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
.at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
.at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
.at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
.at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
.at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
.at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
.at com.sun.grizzly.util.AbstractThread

2000

Pool$Worker.doWork(AbstractThreadPool.java:330)
.at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
.at java.lang.Thread.run(Thread.java:619)
</code></pre></div>
....


When I try to upload it from just /upload it works with the small example file and renders the view in the background, as seen in the following snipped
  Code:
POST /skriptum/upload;jsessionid=56e7c11d28a245b1de5b4ecee5bd HTTP/1.1

Host: localhost:8080

Accept: */*

User-Agent: Shockwave Flash
Connection: Keep-Alive
Cache-Control: no-cache

Content-Length: 1170

Expect: 100-continue

Content-Type: multipart/form-data; boundary=----------------------------d01cf8041573



HTTP/1.1 100 Continue



------------------------------d01cf8041573

Content-Disposition: form-data; name="Filename"



blabla.pdf

------------------------------d01cf8041573

Content-Disposition: form-data; name="primefacesAjaxRequest"



true

------------------------------d01cf8041573

Content-Disposition: form-data; name="javax.faces.ViewState"



1253717635934289772:-810517928959273638

------------------------------d01cf8041573

Content-Disposition: form-data; name="j_idt15"



j_idt15

------------------------------d01cf8041573

Content-Disposition: form-data; name="update"



messages

------------------------------d01cf8041573

Content-Disposition: form-data; name="fileext"



*.doc;*.docx;*.odt;*.pdf

------------------------------d01cf8041573

Content-Disposition: form-data; name="folder"



/skriptum/

------------------------------d01cf8041573

Content-Disposition: form-data; name="documentToUpload"; filename="blabla.pdf"

Content-Type: application/octet-stream



asdkfasdf
asd
f
asd
f
asd
f
asdfasdf



EOF!!!



------------------------------d01cf8041573

Content-Disposition: form-data; name="Upload"



Submit Query

------------------------------d01cf8041573--

HTTP/1.1 200 OK

X-Powered-By: Servlet/3.0

Server: GlassFish v3

Set-Cookie: JSESSIONID=5b72e6342ab68e807583a814ae28; Path=/skriptum

X-Powered-By: JSF/2.0

X-Powered-By: JSF/2.0

Content-Type: text/html;charset=UTF-8

Transfer-Encoding: chunked

Date: Sun, 06 Dec 2009 20:38:41 GMT



2000

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
        <title> &lt;ui:define name=&quot;title&quot;&gt; &lt;/ui:define&gt;
        </title>
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/primefaces/core/core.js"></script>
<link rel="stylesheet" type="text/css" href="/skriptum/primefaces_resource/2.0.0.RC/jquery/plugins/gritter/assets/gritter.css" />
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/jquery/jquery.js"></script>
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/jquery/plugins/gritter/jquery.gritter.js"></script>
<link rel="stylesheet" type="text/css" href="/skriptum/primefaces_resource/2.0.0.RC/jquery/plugins/uploadify/uploadify.css" />
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/yui/cookie/cookie-min.js"></script>
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/jquery/plugins/uploadify/swfobject.js"></script>
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/jquery/plugins/uploadify/jquery.uploadify.v2.1.0.min.js"></script>
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/primefaces/ajax/ajax.js"></script>
<script type="text/javascript" src="/skriptum/primefaces_resource/2.0.0.RC/primefaces/uploader/uploader.js"></script>

<link type="text/css" rel="stylesheet" href="/skriptum/javax.faces.resource/layout.css.xhtml?ln=skripts" /><link type="text/css" rel="stylesheet" href="/skriptum/javax.faces.resource/layout_m.css.xhtml?ln=skripts" /></head><body>
   
    <div id="main" class="container">
    <div id="content" class="middlecolumns">
        <!--<h1><ui:insert name="title" /></h1>-->
        <h1>Dokument hochladen</h1>

        <style type="text/css">
            form div p label {
                display: block;
                width: 200px;
                float: left;
            }

            form div p input {
                width: 200px;
            }

            form div {
                display: block;
                background: rgb(201, 219, 255);
                margin: 5px; /*width: 800px;*/
            }

        </style>
<form id="j_idt15" name="j_idt15" method="post" action="/skriptum/upload;jsessionid=5b72e6342ab68e807583a814ae28" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt15" value="j_idt15" />
<script type="text/javascript">PrimeFaces.onContentReady('messages', function() {
});
</script><span id="messages"></span>

            <div>
                <h2>1. Lade Dein Dokument hoch</h2>
                FOOBAR


                    <pre><label for="documentToUpload">
Dokument</label><script type="text/javascript">PrimeFaces.onContentReady('documentToUpload', function () {
documentToUpload_widget = new PrimeFaces.widget.Uploader('documentToUpload', {
uploader:'/skriptum/primefaces_resource/2.0.0.RC/jquery/plugins/uploadify/uploadify.swf',script:'/skriptum/upload;jsessionid=5b72e6342ab68e807583a814ae28',cancelImg:'/skriptum/primefaces_resource/2.0.0.RC/jquery/plugins/uploadify/cancel.png',formId:'j_idt15',fileDataName:'documentToUpload',multi:false,auto:false,update:'messages',fileExt:'*.doc;*.docx;*.odt;*.pdf',fileDesc:'Dokumente',sizeLimit:1073741824});
});
</script><input type="file" id="documentToUpload" name="documentToUpload" /><a href="javascript:documentToUpload_widget.upload();">Upload</a> | <a href="javascript:documentToUpload_widget.clear();">Clear</a><input type="submit" name="j_idt19" value="" />
                    </pre>

                <p><label for="title">
Titel des Dokuments</label><input id="title" type="text" name="title" />
                </p>
            </div>

            <div>
                <h2>2. Art des Dokumentes festlegen</h2>

                    <p>
                    </p>

                    <p>
                    </p>

                    <p>
                    </p>

                    <p>
                    </p><table id="type">
.<tr>
<td>
<input type="radio" name="type" id="type:0" value="0" /><label for="type:0"> Zusammenfassung</label></td>
<td>
<input type="radio" name="type" id="type:1" value="1" /><label for="type:1"> Klausur</label></td>
<td>
<input type="radio" name="type" id="type:2" value="2" /><label for="type:2"> Hausuebung</label></td>
<td>
<input type="radio" name="type" id="type:3" value="3" /><label for="type:3"> Mitschrift</label></td>
.</tr>
</table>


            </div>


            <div>
                <h2>3. Dokument zuordnen</h2>

                <select>
                    <option value="#">Uni</option>
                    <option value="tuwien">TU Wien</option>
                    <option value="wuwien">WU Wien</option>
                    <option value="uniwien">UNI Wien</option>
                    <option value="meduniwien">MedUni Wien</option>
                </select>
                <br />
                <select>
                    <option value="#">Studienrichtung</option>
                    <option>....</option>
                    <option>....</option>
                    <option>....</option>
                </select>
                <br />

                <select>
                    <option value="#">Kurs</option>
                    <option>....</option>
                    <option>....</option>
                    <option>....</option>
                    <option>....</option>
                </select>
                <br />
                <select>
                    <option value="#">Professor</option>
                    <option>....</option>
                    <option>....</option>
                    <option>....</option>
                    <option>....</option>
                </select>
                <br /><input type="submit" name="j_idt31" value="DO SOMETHING!" />
            </div><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-4522075482166600990:-9047861676398256697" autocomplete="off" />
</form>
    </div>
    <div id="header">
        <h2>Skripts - Meine Lernunterlagen</h2>
        <!--<ul>-->
        <!--<li><a href="#">Top Nav Link</a></li>-->
        <!--<li><a href="#">Top Nav Link</a></li>-->
        <!--<li><a href="#">Top Nav Link</a></li>-->
        <!--<li><a href="#">Top Nav Link</a></li>-->
        <!--<li><a href="#">Top Nav Link</a></li>-->
        <!--<li><a href="#">Top Nav Link</a></li>-->
        <!--</ul>-->

        <div id="topInfo">
<form id="j_idt35" name="j_idt35" method="post" action="/skriptum/upload;jsessionid=5b72e6342ab68e807583a814ae28" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt35" value="j_idt35" />

                    Hallo Gast |
                    <a href="/skriptum/register;jsessionid=5b72e6342ab68e807583a814ae28" id="j_idt35:j_idt38">registrieren</a> |
                    <a href="/skriptum/login;jsessionid=5b72e6342ab68e807583a814ae28" id="j_idt35:j_idt41">einloggen</a> |
                    0 Artikel im <a href="/skriptum/basket;jsessionid=5b72e6342ab68e807583a814ae28" id="j_idt35:j_idt44">Warenkorb</a><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-4522075482166600990:-9047861676398256697" autocomplete="off" />
</form>
        </div>
    </div>
    <div id="header2">
        <ul>
            <li><a href="/skriptum">Home</a></li>
            <li><a href="/skriptum/mycourses;jsessionid=5b72e6342ab68e807583a814ae28" id="j_idt57">Meine Kurse</a>
            </li>
            <li><a href="/skriptum/upload;jsessionid=5b72e6342ab68e807583a814ae28" id="j_idt60">Upload</a></li>
            <li><a href="/skriptum/firstSteps;jsessionid=5b72e6342ab68e807583a814ae28" id="j_idt63">Erste Schritte</a></li>
        </ul>
...

so there gets no exception thrown, but also no event is triggered on the server side.

If I try to upload a bigger file ( > 7MB ) from the /upload, no error gets thrown but also nothing is rendered, no event is fired and nothing is returned from the POST done by the flash-thing:

  Code:
POST /skriptum/upload;jsessionid=56e7c11d28a245b1de5b4ecee5bd HTTP/1.1

Host: localhost:8080

Accept: */*

User-Agent: Shockwave Flash
Connection: Keep-Alive
Cache-Control: no-cache

Content-Length: 7196943

Expect: 100-continue

Content-Type: multipart/form-data; boundary=----------------------------507599e9d180



HTTP/1.1 100 Continue



------------------------------507599e9d180

Content-Disposition: form-data; name="Filename"



Lou Paget - Der Perfekte Liebhaber.pdf

------------------------------507599e9d180

Content-Disposition: form-data; name="j_idt15"



j_idt15

------------------------------507599e9d180

Content-Disposition: form-data; name="folder"



/skriptum/

------------------------------507599e9d180

Content-Disposition: form-data; name="primefacesAjaxRequest"



true

------------------------------507599e9d180

Content-Disposition: form-data; name="update"



messages

------------------------------507599e9d180

Content-Disposition: form-data; name="fileext"



*.doc;*.docx;*.odt;*.pdf

------------------------------507599e9d180

Content-Disposition: form-data; name="javax.faces.ViewState"



-6912964522790549731:-6598567267547027095

------------------------------507599e9d180

Content-Disposition: form-data; name="documentToUpload"; filename="Lou Paget - Der Perfekte Liebhaber.pdf"

Content-Type: application/octet-stream



%PDF-1.4
%....

986 0 obj
<<
/Linearized 1
/O 989
/H [ 900 2031 ]
/L 7195763
.... LOTS OF DATA .....
0007174248 00000 n

0007174479 00000 n

trailer
<<
/Size 986
/ID[<44ad8f635d3a92c80375d16634b88e5f><aa3d6473baa8794ec7b1384bf40e4d56>]
>>
startxref
173
%%EOF


------------------------------507599e9d180

Content-Disposition: form-data; name="Upload"



Submit Query

------------------------------507599e9d180--

HERE IT STOPS, NOTHING IS RETURNED FROM THE SERVER


I'm not sure whats going wrong here.. any help appreciated!
<<

dominik.dorn

Posts: 13

Joined: Mon Sep 28, 2009 10:28 am

Post Sun Dec 06, 2009 9:23 pm

Re: FileUpload not working, Event not fired

I've created a Issue in the Issue-Tracker for this:
http://code.google.com/p/primefaces/iss ... ail?id=361

and uploaded a sample showing the problem.

Thanks,
Dominik
<<

optimus.prime

User avatar

Prime

Posts: 6912

Joined: Sun Jan 04, 2009 10:21 pm

Post Tue Dec 08, 2009 12:59 pm

Re: FileUpload not working, Event not fired

Hi Dominik, I'll try look into this today and update this post.

I remember fixing an issue recently regarding event package in tlds. Maybe it's related to it, anyway I'll keep you posted.
<<

optimus.prime

User avatar

Prime

Posts: 6912

Joined: Sun Jan 04, 2009 10:21 pm

Post Tue Dec 08, 2009 11:14 pm

Re: FileUpload not working, Event not fired

Ok, I've tried with Mojarra 2.0.1 on Tomcat 6 with PrimeFaces 2.0.0-SNAPSHOT and it worked. I need to setup my environment for glassfish in the mean time can you try with tomcat 6 to see if problem is with glassfish?
<<

dominik.dorn

Posts: 13

Joined: Mon Sep 28, 2009 10:28 am

Post Thu Dec 10, 2009 4:22 pm

Re: FileUpload not working, Event not fired

Hi cagatay!

I will try tomcat this weekend.

Setting up glassfish is quite easy.

Just download the final release from
http://download.java.net/glassfish/v3/release/

e.g.
wget http://download.java.net/glassfish/v3/r ... v3-web.zip
unzip glassfish-v3-web.zip
cd glassfishv3/bin
./asadmin
start-domain --verbose=true

then wait a few seconds, navigate your browser to http://localhost:4848/
wait a few secs, then add the application in the left panel by clicking on "Application" -> "Deploy"

you'll find the upload script at /contextpath/upload.xhtml
simple press the "launch" link, when you deployed the app.

greetings,
dominik


P.s.: I also posted this issue on the glassfish users mailinglist, because maybe its a problem with their tomcat impl.
<<

optimus.prime

User avatar

Prime

Posts: 6912

Joined: Sun Jan 04, 2009 10:21 pm

Post Fri Dec 11, 2009 12:35 pm

Re: FileUpload not working, Event not fired

Ok thanks for the tips, I'll try with new netbeans 6.8 and glassfish v3, yes I'm lazy :)
<<

makoto1337

Autobot

Posts: 60

Joined: Thu Dec 10, 2009 8:17 am

Post Tue Dec 15, 2009 12:28 am

Re: FileUpload not working, Event not fired

I also am using the latest glassfish and mojarra releases, but the fileUpload component does not work at all. In other words, I am having the same problem as the original poster. Has anyone found a solution for this yet?
<<

optimus.prime

User avatar

Prime

Posts: 6912

Joined: Sun Jan 04, 2009 10:21 pm

Post Wed Dec 16, 2009 12:00 am

Re: FileUpload not working, Event not fired

Are there any other filters defined in your app?
Next

Return to PrimeFaces Users

Who is online

Users browsing this forum: Google [Bot] and 6 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for blacklist.org.
Localized by Maël Soucaze © 2010 phpBB.fr