i am adding the fileupload function in seam example dvd store, now when i click the upload button, my pc will be so busy that it dosn;t have any response from my keybaord , and jboss log file will become bigger more and more. at finally, the log file will be more than 1G size. who can give me a hand?
my components.xml <?xml version="1.0" encoding="UTF-8"?> | <components xmlns="http://jboss.com/products/seam/components" | xmlns:core="http://jboss.com/products/seam/core" | xmlns:bpm="http://jboss.com/products/seam/bpm" | xmlns:persistence="http://jboss.com/products/seam/persistence" | xmlns:security="http://jboss.com/products/seam/security" | xmlns:framework="http://jboss.com/products/seam/framework" | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | xsi:schemaLocation= | "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd | http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd | http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd | http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd | http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.0.xsd | http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd"> | | <core:init debug="true" jndi-pattern="@jndiPattern@"/> | | <!-- 120 second conversation timeout --> | <core:manager conversation-timeout="120000"/> | | <bpm:jbpm> | <bpm:process-definitions> | <value>ordermanagement1.jpdl.xml</value> | </bpm:process-definitions> | <bpm:pageflow-definitions> | <value>checkout.jpdl.xml</value> | <value>newuser.jpdl.xml</value> | </bpm:pageflow-definitions> | </bpm:jbpm> | | <security:identity authenticate-method="#{authenticator.authenticate}"/> | | <persistence:managed-persistence-context name="entityManager" | auto-create="true" | persistence-unit-jndi-name="java:/dvdEntityManagerFactory" /> | | <factory name="order" | value="#{orderHome.instance}" | scope="stateless" | auto-create="true"/> | <framework:entity-home name="orderHome" | entity-class="com.jboss.dvd.seam.Order" | scope="conversation" | auto-create="true"> | <framework:id>#{orderId}</framework:id> | </framework:entity-home> | | | <framework:entity-query name="allCategories" | ejbql="select c from Category c" | order="c.name"> | <!-- waiting for hibernate issue EJB-277 | <framework:hints> | <key>org.hibernate.cacheable</key> | <value>true</value> | </framework:hints> | --> | </framework:entity-query> | | | <factory name="topProducts" | value="#{topQuery.resultList}" /> | <framework:entity-query name="topQuery" | ejbql="select p from Product p" | order="p.inventory.sales desc" | max-results="8" /> | <component class="org.jboss.seam.web.MultipartFilter"> | <property name="createTempFiles">false</property> | <property name="maxRequestSize">100000000</property> | </component> | | </components> | my web.xml <?xml version="1.0" ?> | | <web-app version="2.5" | 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_2_5.xsd"> | | <listener> | <listener-class>org.jboss.seam.servlet.SeamListener</listener-class> | </listener> | | <context-param> | <param-name>facelets.DEVELOPMENT</param-name> | <param-value>true</param-value> | </context-param> | | <context-param> | <param-name>javax.faces.DEFAULT_SUFFIX</param-name> | <param-value>.xhtml</param-value> | </context-param> | | <filter> | <filter-name>Seam Filter</filter-name> | <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class> | </filter> | | <filter-mapping> | <filter-name>Seam Filter</filter-name> | <url-pattern>/*</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>*.seam</url-pattern> | </servlet-mapping> | | <security-constraint> | <display-name>Restrict XHTML Documents</display-name> | <web-resource-collection> | <web-resource-name>XHTML</web-resource-name> | <url-pattern>*.xhtml</url-pattern> | </web-resource-collection> | <auth-constraint> | <role-name>NONE</role-name> | </auth-constraint> | </security-constraint> | | <session-config> | <session-timeout>10</session-timeout> | </session-config> | | </web-app> | File.java | | /* | * JBoss, Home of Professional Open Source | * | * Distributable under LGPL license. | * See terms of license at gnu.org. | */ | package com.jboss.dvd.seam; | | public interface File { | public boolean isManaged() ; | public String getFilename() ; | public void setFilename(String filename); | public String getContentType(); | public void setContentType(String contentType); | public byte[] getFiledata() ; | public void setFiledata(byte[] filedata); | public void update2(); | public void destroy(); | } | my FileAction.java | package com.jboss.dvd.seam; | | import static javax.faces.application.FacesMessage.SEVERITY_WARN; | | import javax.ejb.Remove; | import javax.swing.ImageIcon; | | import org.jboss.seam.annotations.*; | import org.jboss.seam.ScopeType; | | import java.io.Serializable; | import java.util.Map; | | @Name("file") | @Scope(ScopeType.CONVERSATION) | public class FileAction | implements File, | Serializable | { | | public static final int PREVIEW_SIZE_MIN = 240; | | public static final int PREVIEW_SIZE_MAX = 1600; | | public static final int PREVIEW_ZOOM_STEP = 240; | | /* -------------------------- Context Wiring ------------------------------ */ | | /* -------------------------- Internal State ------------------------------ */ | | private String filename; | | private String contentType; | | // TODO: This should really use an InputStream and directly stream into the | // BLOB without consuming server memory | private byte[] filedata; | | private int imagePreviewSize = 240; | | public boolean isManaged() { | return true; | } | | public String getFilename() { | return filename; | } | | public void setFilename(String filename) { | this.filename = filename; | } | | public String getContentType() { | return contentType; | } | | public void setContentType(String contentType) { | this.contentType = contentType; | } | | public byte[] getFiledata() { | return filedata; | } | | public void setFiledata(byte[] filedata) { | this.filedata = filedata; | } | | | public void update2(){ | if(getFiledata()!=null){ | System.out.println(getFiledata().length); | System.out.println(getFilename()); | byte[] filedata=null; | setFiledata(filedata); | } | else | System.out.println("can't find file uploaded"); | } | @Remove | public void destroy() {}; | | } | my fileEdit.xhtml <!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" | xmlns:ui="http://java.sun.com/jsf/facelets" | xmlns:s="http://jboss.com/products/seam/taglib" | xmlns:f="http://java.sun.com/jsf/core" | xmlns:h="http://java.sun.com/jsf/html"> | <body> | <h:outputText value="i am your friend" /> | <h:outputText value="#{file.contentType}" /> | <h:form enctype="multipart/form-data"> | <s:fileUpload id="upload" data="#{file.filedata}" contentType="#{file.contentType}" fileName="#{file.filename}"/> | <h:commandLink id="update" action="#{file.update2}" | rendered="#{file.managed}" | tabindex="6" accesskey="U" styleClass="button"><span class="buttonLabel"><u>U</u>pdate</span></h:commandLink> | | </h:form> | | </body> | </html> | | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126592#4126592 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126592 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user