Thank you very much for your response,
On your advice I wrote an PahseListener but it doesn't work. I don't know if
it is a config failure or not.
The problem is I think that in my web.xml the Extension-filter is set to
false.

<context-param>
        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
        <param-value>false</param-value>
    </context-param> 
thats because I use the tomahawk-bridge in my portlet and for these the
Extension-filter must be shutdown.
is these the reason???

in my faces-config.xml I did the following to run the phaseListener:
<lifecycle>
        
<phase-listener>main.org.jboss.portlet.milestone.portlet.phaselistener.ImagePhaseListener</phase-listener>
        </lifecycle>

thanks,

Omid


omidh wrote:
> 
> Hi all,
> I would like to show images in my portlet, which are saved in a Mysql db,
> so I wrote a servlet
> which helps to download files from the db. Now I use these servlet to
> receive also the Images but 
> it does not work... does anyone know a solution?
> 
> here the way I use it:
> 
> <h:graphicImage value="/FileServlet/?file_id=#{datatype.fileID}"/>
> generated code: < i m g src="/MileStoneBeta/FileServlet/?file_id=1">
> 
> and here the servlet (nothing special):
> 
> protected void doGet(HttpServletRequest request,
>                       HttpServletResponse response) throws ServletException, 
> IOException {
> 
>               FacesContext fctx = getFacesContext(request, response);
>               
>               ValueBinding bind = 
> FacesContext.getCurrentInstance().getApplication()
>                               .createValueBinding("#{facadeService}");
>               if (bind == null)
>                       logger.fatal("ValueBinding is null");
> 
>               FacadeService bean = (FacadeService) bind.getValue(fctx);
>               
>               
>               Integer fileId = 
> Integer.parseInt(request.getParameter("file_id"));
>               
>               UFile file =
> (UFile)bean.getMileStoneService().getEntryManager().loadById(UFile.class,
> fileId);
>               logger.debug("file="+file);
>               if(file != null){
>                       response.setContentType(file.getContentType());
>                       response.setContentLength(file.getContent().length);
>                       response.setHeader("Content-Disposition", "attachement; 
> filename=\"" + 
>                                       file.getFileName() + "\"");
>                       if(logger.isDebugEnabled())
>                               logger.debug("sending file ...");
>                       response.getOutputStream().write(file.getContent());
>                       response.flushBuffer();
>               }
>               
>       }
> 
> or is there a simple way to do it? ;)
> 
> thanks in advance,
> Omid
> 

-- 
View this message in context: 
http://www.nabble.com/h%3AgraphicImage-and-Servlets-tf3757832.html#a10635281
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to