Fórum

« Voltar para demoiselle-users

Re: [demoiselle-users] Exemplo de Upload de arquivo

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
¿Podrías subir tu proyecto a github?
O crear uno básico reproduciendo tu caso y lo analizamos ahí.


2014-04-27 8:43 GMT-04:00 Carlos <carlosmarian@gmail.com>:

> Olá Ale.
> Implementei o método de upload, alterei o xhtml, configurei o pom e o
> web.xml, mas ao acionar o upload o método não é executado. O post acontece
> mas não passa pelo método definido no "fileUploadListener".
> Será que pode estar faltando mais alguma configuração?
>
> at+
>
>
> Em 23 de abril de 2014 16:47, Ale W. Feltes Quenhan
> <alefeltes@gmail.com>escreveu:
>
> > Hola Carlos, aquí tienes un proyecto que usa un fork del
> demoiselle-2.2.2,
> > que podrías tomar de ejemplo:
> > Utilizamos para este proyecto el Primefaces 3.5.
> > Aquí las dependencias para el pom:
> >
> > https://github.com/alefq/asistente-eventos/blob/master/pom.xml#L81
> >
> > Aquí la línea en el xhtml:
> >
> >
> >
> https://github.com/alefq/asistente-eventos/blob/master/src/main/webapp/evento_edit.xhtml#L100
> >
> > y aquí el código en el ViewController que recibe el archivo:
> >
> >
> >
> https://github.com/alefq/asistente-eventos/blob/master/src/main/java/py/gov/senatics/asistente/view/EventoEditMB.java#L220
> >
> >
> >
> >
> > 2014-04-23 10:57 GMT-04:00 Carlos <carlosmarian@gmail.com>:
> >
> > > Olá Rafael e Jefferson, sim eu esqueci de comentar mas tbm coloquei as
> > > dependencias citadas no pom.xml.
> > > O form esta como multpart e só vou verificar referente a configuração
> > > adicional do web.xml que o Jefferson comentou.
> > > Quero tbm fazer um teste com este TIKA que o Rodolfo falou.
> > >
> > >
> > > pom.xml:
> > > .....
> > > <dependency>
> > > <groupId>commons-fileupload</groupId>
> > > <artifactId>commons-fileupload</artifactId>
> > > <version>1.2.1</version>
> > > </dependency>
> > >
> > > <dependency>
> > > <groupId>commons-io</groupId>
> > > <artifactId>commons-io</artifactId>
> > > <version>1.4</version>
> > > </dependency>
> > > .....
> > >
> > >
> > > at+
> > >
> > >
> > >
> > > Em 23 de abril de 2014 11:50, Rafael Odon <odon.rafael@gmail.com>
> > > escreveu:
> > >
> > > > Precisei usar isso ante-ontem, e sim, precisa mesmo do apache
> > > > commons-file-upload no pom.xml.
> > > >
> > > > Também tem que declarar no no web.xml o
> > > > filtro org.primefaces.webapp.filter.FileUploadFilter
> > > >
> > > > E não se esqueça que o form ao redor do campo de upload tem que ter o
> > > > enctype declarado:
> > > >
> > > > <h:form id="meuForm" enctype="multipart/form-data" >
> > > > ...
> > > > </h:form>
> > > >
> > > >
> > > > 2014-04-23 11:47 GMT-03:00 Jefferson Bicca Charczuk <
> > > > jefferson.rs@gmail.com>
> > > > :
> > > >
> > > > > Opa, Carlos.
> > > > >
> > > > > Já utilizei este componente do Primefaces uma vez e, se não me
> > engano,
> > > > tive
> > > > > de incluir a dependência ao commons-fileupload no pom:
> > > > > <dependency>
> > > > > <groupId>commons-fileupload</groupId>
> > > > > <artifactId>commons-fileupload</artifactId>
> > > > > <version>1.3</version>
> > > > > </dependency>
> > > > >
> > > > > Tenta colocar essa dependência aí, faz um novo teste e nos diga se
> > > > > conseguiu fazer funcionar certinho.
> > > > >
> > > > > Outra configuração que cheguei a fazer também, mas acho que é
> > opcional,
> > > > foi
> > > > > definir lá no web.xml um uploadDirectory. Vou te colar aqui a
> > > > configuração
> > > > > que fiz:
> > > > >
> > > > > <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</param-value>
> > > > > </init-param> </filter> <filter-mapping> <filter-name>PrimeFaces
> > > > FileUpload
> > > > > Filter</filter-name> <servlet-name>Faces Servlet</servlet-name>
> > > > > </filter-mapping>
> > > > >
> > > > > At.
> > > > >
> > > > >
> > > > > 2014-04-23 11:34 GMT-03:00 Rodolfo <rof20004@gmail.com>:
> > > > >
> > > > > > Procure sobre o apache tika.
> > > > > >
> > > > > >
> > > > > > Em 23 de abril de 2014 10:26, Carlos <carlosmarian@gmail.com>
> > > > escreveu:
> > > > > >
> > > > > > > Olá,
> > > > > > > a princípio eu configurei os filters e o MenageBean de acordo
> > > com o
> > > > > > > exemplo do site do primefaces, mas ao executar a ação o upload
> > não
> > > > > > ocorre.
> > > > > > > A necessidade é de efetuar upload de um arquivo e depois
> > > persistir
> > > > > este
> > > > > > > arquivo no banco de dados, em uma coluna específica de uma
> > tabela.
> > > > > > > Minha implementação possui as seguintes caracteristicas:
> > > > > > > public class UploadFileMB extends AbstractPageBean
> > > > > > > ....
> > > > > > > public void doUpload(FileUploadEvent fileUploadEvent) {
> > > > > > > System.out.println("TESTEEE");
> > > > > > > UploadedFile uploadedFile =
> > > > fileUploadEvent.getFile();
> > > > > > > String fileNameUploaded =
> > > uploadedFile.getFileName();
> > > > > > > long fileSizeUploaded = uploadedFile.getSize();
> > //
> > > 3
> > > > > > > String infoAboutFile = "<br/> Arquivo recebido:
> > > <b>"
> > > > > > > +fileNameUploaded
> > > > > > > + "</b><br/>" + "Tamanho do
> > > Arquivo:
> > > > > > > <b>" +fileSizeUploaded
> > > > > > > + "</b>";
> > > > > > > FacesContext facesContext =
> > > > > > FacesContext.getCurrentInstance
> > > > > > > ();
> > > > > > > facesContext.addMessage(null , new
> > > > > > > FacesMessage("Sucesso",infoAboutFile
> > > > > > > ));
> > > > > > > } .... } xhtml: <ui:composition xmlns="
> > > > > > > http://www.w3.org/1999/xhtml"
> > > > > > > xmlns:f="http://java.sun.com/jsf/core"
> > > > > > > xmlns:p="http://primefaces.org/ui"
> > > > > > > xmlns:h="http://java.sun.com/jsf/html"
> > > > > > > xmlns:ui="http://java.sun.com/jsf/facelets"
> > > > > > > template="/template/main.xhtml">
> > > > > > >
> > > > > > > <ui:define name="body">
> > > > > > > <h:form enctype="multipart/form-data">
> > > > > > > <p:fileUpload
> > > > > > > fileUploadListener=
> > > > > > > "#{uploadFileMB.doUpload}"
> > > > > > > mode="advanced"
> > > > dragDropSupport="true"
> > > > > > > validatorMessage="Erro no Upload"
> > > > > > > sizeLimit="100000" allowTypes=
> > > > > > > "/(\.|\/)(xml|zip|7zip|rar|7z)$/"
> > > > > > > label="Procurar..." />
> > > > > > > <br/> ..... </h:form>
> > > > > > > </ui:define>
> > > > > > > </ui:composition> web.xml: <!-- Upload -->
> > > > > > > <filter>
> > > > > > > <filter-name>PrimeFaces FileUpload
> > > > Filter</filter-name>
> > > > > > >
> > > > > > <filter-class>org.primefaces.webapp.filter.FileUploadFilter
> > > > > > > </filter-class>
> > > > > > > </filter>
> > > > > > >
> > > > > > > <filter-mapping>
> > > > > > > <filter-name>PrimeFaces FileUpload
> > > > Filter</filter-name>
> > > > > > > <servlet-name>Faces Servlet</servlet-name>
> > > > > > > <dispatcher>FORWARD</dispatcher>
> > > > > > > </filter-mapping> At+
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Em 23 de abril de 2014 11:11, Emerson Sachio Saito <
> > > > > > > emerson.saito@serpro.gov.br> escreveu:
> > > > > > >
> > > > > > > > Olá Carlos,
> > > > > > > >
> > > > > > > > Nos exemplos com o Demoiselle 2, ainda não usamos este
> > > componente.
> > > > > > > > Acho que já deve ter visto os exemplos do Primefaces:
> > > > > > > > - http://www.primefaces.org/showcase/ui/fileUploadSingle.jsf
> > > > > > > > -
> http://www.primefaces.org/showcase/ui/fileUploadMultiple.jsf
> > > > > > > >
> > > > > > > > Qual está sendo sua dificuldade?
> > > > > > > > Vou ver se faço um teste e vamos trocando idéias.
> > > > > > > >
> > > > > > > > T+.
> > > > > > > > --
> > > > > > > > Emerson Sachio Saito
> > > > > > > > DS/CETEC/CTCTA
> > > > > > > > http://www.serpro.gov.br
> > > > > > > > http://www.frameworkdemoiselle.gov.br
> > > > > > > > (41) 3593-8791
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Em 22/04/2014 20:39:43, Carlos escreveu:
> > > > > > > > > Olá.
> > > > > > > > Alguém tem um exemplo de upload de arquivo, usando
> > primefaces?
> > > > > > > > Procurei no github dentro dos exemplos mas não encontrei.
> > > > > > > >
> > > > > > > > Valeu.
> > > > > > > >
> > > > > > > > --
> > > > > > > > ______________
> > > > > > > > ->Carlos Henrique Marian
> > > > > > > > :0) :0\ :0| :0/ :0(
> > > > > > > > |/--\|/--\|/--\|
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > > > > Start Your Social Network Today - Download eXo Platform
> > > > > > > > Build your Enterprise Intranet with eXo Platform Software
> > > > > > > > Java Based Open Source Intranet - Social, Extensible, Cloud
> > Ready
> > > > > > > > Get Started Now And Turn Your Intranet Into A Collaboration
> > > > Platform
> > > > > > > > > http://p.sf.net/sfu/ExoPlatform>
> > > > > > > > _______________________________________________
> > > > > > > >
> > > > > > > > Portal: > http://www.frameworkdemoiselle.gov.br>
> > > > > > > > Foruns: > http://forum.frameworkdemoiselle.gov.br>
> > > > > > > > Tracker: > http://tracker.frameworkdemoiselle.gov.br>
> > > > > > > > _______________________________________________
> > > > > > > >
> > > > > > > > Para editar sua assinatura:
> > > > > > > > >
> > https://lists.sourceforge.net/lists/listinfo/demoiselle-users>
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > -
> > > > > > > >
> > > > > > > >
> > > > > > > > "Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS
> > > > (SERPRO),
> > > > > > > > empresa pública federal regida pelo disposto na Lei Federal
> nº
> > > > > 5.615, é
> > > > > > > > enviada exclusivamente a seu destinatário e pode conter
> > > informações
> > > > > > > > confidenciais, protegidas por sigilo profissional. Sua
> > utilização
> > > > > > > > desautorizada é ilegal e sujeita o infrator às penas da lei.
> Se
> > > > você
> > > > > a
> > > > > > > > recebeu indevidamente, queira, por gentileza, reenviá-la ao
> > > > emitente,
> > > > > > > > esclarecendo o equívoco."
> > > > > > > >
> > > > > > > > "This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS
> > > > (SERPRO)
> > > > > > --
> > > > > > > a
> > > > > > > > government company established under Brazilian law (5.615/70)
> > --
> > > is
> > > > > > > > directed exclusively to its addressee and may contain
> > > confidential
> > > > > > data,
> > > > > > > > protected under professional secrecy rules. Its unauthorized
> > use
> > > is
> > > > > > > illegal
> > > > > > > > and may subject the transgressor to the law's penalties. If
> > > you're
> > > > > not
> > > > > > > the
> > > > > > > > addressee, please send it back, elucidating the failure."
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > > > > Start Your Social Network Today - Download eXo Platform
> > > > > > > > Build your Enterprise Intranet with eXo Platform Software
> > > > > > > > Java Based Open Source Intranet - Social, Extensible, Cloud
> > Ready
> > > > > > > > Get Started Now And Turn Your Intranet Into A Collaboration
> > > > Platform
> > > > > > > > http://p.sf.net/sfu/ExoPlatform
> > > > > > > > _______________________________________________
> > > > > > > >
> > > > > > > > Portal: http://www.frameworkdemoiselle.gov.br
> > > > > > > > Foruns: http://forum.frameworkdemoiselle.gov.br
> > > > > > > > Tracker: http://tracker.frameworkdemoiselle.gov.br
> > > > > > > > _______________________________________________
> > > > > > > >
> > > > > > > > Para editar sua assinatura:
> > > > > > > >
> https://lists.sourceforge.net/lists/listinfo/demoiselle-users
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > ______________
> > > > > > > ->Carlos Henrique Marian
> > > > > > > :0) :0\ :0| :0/ :0(
> > > > > > > |/--\|/--\|/--\|
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > > > Start Your Social Network Today - Download eXo Platform
> > > > > > > Build your Enterprise Intranet with eXo Platform Software
> > > > > > > Java Based Open Source Intranet - Social, Extensible, Cloud
> Ready
> > > > > > > Get Started Now And Turn Your Intranet Into A Collaboration
> > > Platform
> > > > > > > http://p.sf.net/sfu/ExoPlatform
> > > > > > > _______________________________________________
> > > > > > >
> > > > > > > Portal: http://www.frameworkdemoiselle.gov.br
> > > > > > > Foruns: http://forum.frameworkdemoiselle.gov.br
> > > > > > > Tracker: http://tracker.frameworkdemoiselle.gov.br
> > > > > > > _______________________________________________
> > > > > > >
> > > > > > > Para editar sua assinatura:
> > > > > > > https://lists.sourceforge.net/lists/listinfo/demoiselle-users
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > > Start Your Social Network Today - Download eXo Platform
> > > > > > Build your Enterprise Intranet with eXo Platform Software
> > > > > > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> > > > > > Get Started Now And Turn Your Intranet Into A Collaboration
> > Platform
> > > > > > http://p.sf.net/sfu/ExoPlatform
> > > > > > _______________________________________________
> > > > > >
> > > > > > Portal: http://www.frameworkdemoiselle.gov.br
> > > > > > Foruns: http://forum.frameworkdemoiselle.gov.br
> > > > > > Tracker: http://tracker.frameworkdemoiselle.gov.br
> > > > > > _______________________________________________
> > > > > >
> > > > > > Para editar sua assinatura:
> > > > > > https://lists.sourceforge.net/lists/listinfo/demoiselle-users
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jefferson Bicca Charczuk
> > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > Start Your Social Network Today - Download eXo Platform
> > > > > Build your Enterprise Intranet with eXo Platform Software
> > > > > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> > > > > Get Started Now And Turn Your Intranet Into A Collaboration
> Platform
> > > > > http://p.sf.net/sfu/ExoPlatform
> > > > > _______________________________________________
> > > > >
> > > > > Portal: http://www.frameworkdemoiselle.gov.br
> > > > > Foruns: http://forum.frameworkdemoiselle.gov.br
> > > > > Tracker: http://tracker.frameworkdemoiselle.gov.br
> > > > > _______________________________________________
> > > > >
> > > > > Para editar sua assinatura:
> > > > > https://lists.sourceforge.net/lists/listinfo/demoiselle-users
> > > > >
> > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > Start Your Social Network Today - Download eXo Platform
> > > > Build your Enterprise Intranet with eXo Platform Software
> > > > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> > > > Get Started Now And Turn Your Intranet Into A Collaboration Platform
> > > > http://p.sf.net/sfu/ExoPlatform
> > > > _______________________________________________
> > > >
> > > > Portal: http://www.frameworkdemoiselle.gov.br
> > > > Foruns: http://forum.frameworkdemoiselle.gov.br
> > > > Tracker: http://tracker.frameworkdemoiselle.gov.br
> > > > _______________________________________________
> > > >
> > > > Para editar sua assinatura:
> > > > https://lists.sourceforge.net/lists/listinfo/demoiselle-users
> > > >
> > >
> > >
> > >
> > > --
> > > ______________
> > > ->Carlos Henrique Marian
> > > :0) :0\ :0| :0/ :0(
> > > |/--\|/--\|/--\|
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > Start Your Social Network Today - Download eXo Platform
> > > Build your Enterprise Intranet with eXo Platform Software
> > > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> > > Get Started Now And Turn Your Intranet Into A Collaboration Platform
> > > http://p.sf.net/sfu/ExoPlatform
> > > _______________________________________________
> > >
> > > Portal: http://www.frameworkdemoiselle.gov.br
> > > Foruns: http://forum.frameworkdemoiselle.gov.br
> > > Tracker: http://tracker.frameworkdemoiselle.gov.br
> > > _______________________________________________
> > >
> > > Para editar sua assinatura:
> > > https://lists.sourceforge.net/lists/listinfo/demoiselle-users
> > >
> >
> >
> >
> > --
> > Ale
> >
> >
> ------------------------------------------------------------------------------
> > Start Your Social Network Today - Download eXo Platform
> > Build your Enterprise Intranet with eXo Platform Software
> > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> > Get Started Now And Turn Your Intranet Into A Collaboration Platform
> > http://p.sf.net/sfu/ExoPlatform
> > _______________________________________________
> >
> > Portal: http://www.frameworkdemoiselle.gov.br
> > Foruns: http://forum.frameworkdemoiselle.gov.br
> > Tracker: http://tracker.frameworkdemoiselle.gov.br
> > _______________________________________________
> >
> > Para editar sua assinatura:
> > https://lists.sourceforge.net/lists/listinfo/demoiselle-users
> >
>
>
>
> --
> ______________
> ->Carlos Henrique Marian
> :0) :0\ :0| :0/ :0(
> |/--\|/--\|/--\|
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> _______________________________________________
>
> Portal: http://www.frameworkdemoiselle.gov.br
> Foruns: http://forum.frameworkdemoiselle.gov.br
> Tracker: http://tracker.frameworkdemoiselle.gov.br
> _______________________________________________
>
> Para editar sua assinatura:
> https://lists.sourceforge.net/lists/listinfo/demoiselle-users
>



--
Ale
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________

Portal: http://www.frameworkdemoiselle.gov.br
Foruns: http://forum.frameworkdemoiselle.gov.br
Tracker: http://tracker.frameworkdemoiselle.gov.br
_______________________________________________

Para editar sua assinatura:
https://lists.sourceforge.net/lists/listinfo/demoiselle-users