[jboss-user] [JBoss Seam] - Re: Seam PDF iText generation ERROR

2007-03-01 Thread michaelveit
Sorry, I meant "phase-listener", not "interceptor". ;)

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024252#4024252

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024252
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Seam interceptor ERROR

2007-03-01 Thread michaelveit
Hello,

I got the same problem using a user defined interceptor.
Without ICEfaces, it's running fine, but with ICEfaces I get:

2007-03-01 14:02:06,140 ERROR 
[com.icesoft.faces.facelets.D2DFaceletViewHandler] Problem in renderResponse: 
/moses/image.xhtml Not Found in ExternalContext as a Resource
  | java.io.FileNotFoundException: /moses/image.xhtml Not Found in 
ExternalContext as a Resource
  | at 
com.sun.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:114)
  | at 
com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:86)
  | at 
com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:259)
  | at 
com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:149)
  | at 
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
  | at 
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.renderCycle(BlockingServlet.java:457)
  | at 
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.receiveUpdates(BlockingServlet.java:444)
  | at 
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.executeRequest(BlockingServlet.java:324)
  | at 
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:186)
  | at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | ...
  | 

The configuration in web.xml looks like this:

  | 
  | 
de.classname.webfrontend.ImagePhaseListener
  | 
  | 
org.jboss.seam.jsf.SeamPhaseListener
  | 
  | 

The phase listener is reading a thumbnail from the database for web output:
package de.classpath.webfrontend;
  | 
  | import java.io.IOException;
  | 
  | import javax.ejb.Stateless;
  | import javax.faces.context.FacesContext;
  | import javax.faces.event.PhaseEvent;
  | import javax.faces.event.PhaseId;
  | import javax.faces.event.PhaseListener;
  | import javax.naming.Context;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | import javax.servlet.http.HttpServletRequest;
  | import javax.servlet.http.HttpServletResponse;
  | import de.classpath.RefObjectBeanLocal;
  | 
  | @Stateless
  | public class ImagePhaseListener implements PhaseListener {
  | 
  | private static final long serialVersionUID = 6849469082858433451L;
  | // Praefix used for URL: /moses/image.seam
  | public final static String IMAGE_VIEW_ID = "image";
  | 
  | // Beans
  | RefObjectBeanLocal refObjectBean = null;
  | 
  | public void afterPhase(PhaseEvent event) {
  | FacesContext context = event.getFacesContext();
  | String viewId = context.getViewRoot().getViewId();
  | if (viewId.indexOf(IMAGE_VIEW_ID) != -1) {
  | handleImageRequest(context);
  | }
  | }
  | 
  | public void beforePhase(PhaseEvent event) {
  | //Do nothing here...
  | }
  | 
  | public PhaseId getPhaseId() {
  | return PhaseId.RESTORE_VIEW;
  | }
  | 
  | private void handleImageRequest(FacesContext context) {
  | byte [] imagedata = null;
  | Integer refDataId = null;
  | Integer thumbnailtypeId = null;
  | String param;
  | 
  | HttpServletRequest request = (HttpServletRequest) 
context.getExternalContext().getRequest();
  | HttpServletResponse response = (HttpServletResponse) 
context.getExternalContext().getResponse();
  | 
  | 
  | // Read thumbnail from database via bean,
  | // because EntityManager is not supported in output 
beans!!!
  | if (refObjectBean == null) {
  | try {
  | Context namingContext = new InitialContext();
  | refObjectBean = (RefObjectBeanLocal) 
namingContext.lookup("myproject/RefObjectBean/local");
  | } catch (NamingException exception) {
  | throw new RuntimeException(exception);
  | }
  | }
  | if (refObjectBean == null) throw new 
RuntimeException("refObjectBean ist null!");
  | 
  | // Parse request parameters
  | param = request.getParameter("refDataId");
  | if (param != null) {
  | refDataId = Integer.parseInt(param);
  | }
  | param = request.getParameter("thumbnailtypeId");
  | if (param != null) {
  | thumbnailtypeId = Integer.parseInt(param);
  | }
  | 
  | // Get image
  |