Richfaces error page redirection with gatein, jboss 5.1.0 ga portlet bridge jars and my mistakes -


i know there lot of similar questions out there same/similar topics not apply of solutions problem.

i want redirect user custom error page whenever exception caught while rendering portlet page. why exception thrown while rendering page ? because in background throw give user useful information, designed way , not going changed anytime soon, intention keep way.

i belive better if give examples: simple portlet provide use name , press ">>" button information user, in previous implementation working fine see second picture..

enter image description here

second picture:

as can see layout correct""(this how looked) error page has replaced portlet content own content , error message why not information user. far good.

enter image description here

now lets @ problem case: have upgraded jboss 4.2.3 ga 5.1.0 ga , gatein comes play ground. there old jars used create view of portlets, upgraded newer ones. such as:

(org.richfaces.framework) richfaces-api 3.3.3-final,  (org.richfaces.framework) richfaces-impl 3.3.3-final, (org.richfaces.framework) richfaces-ui 3.3.3-final, (com.sun.faces) jsf-api 2.2.14, (com.sun.faces) jsf-impl 2.2.14, (javax-servlet) servlet-api 2.5, (javax-servlet) jstl 1.2  gatein version: 3.4 

and gatein uses jsr168 compatible jars + have jsf 1.2 version (tags used in version).

problem case: can see the portlet want user information broken , merged domain detailed portlet. looks soup.

the code generates mess belongs us. working correctly once, somehow destroying whole layout.

enter image description here

let me show code rendering views:

    public void renderview(facescontext context, uiviewroot viewtorender) throws java.io.ioexception, javax.faces.facesexception{     try {         super.renderview(context, viewtorender);     }catch(facesexception e){                   application application = context.getapplication();         viewhandler viewhandler = application.getviewhandler();         portletrequest request = (portletrequest)context.getexternalcontext().getrequest();         portletconfig config = (portletconfig)request.getattribute(portletconstants.portlet_config);         string errorview = config.getinitparameter(portletconstants.portlet_faces_error_view);          if(errorview == null || errorview.matches("")){             errorview = provportletviewhandler.default_faces_error_view;                                }          throwable cause = e.getcause();         facesmessage fm= findprovisioningexception(cause);         if(fm == null)         {                          request.setattribute("errormessage", "unknown error occured");         }         else         {             request.setattribute("errormessage", fm.getsummary());         }           viewtorender = viewhandler.createview(context,errorview);                  context.setviewroot(viewtorender);                      viewhandler.renderview(context, viewtorender);          portletsession objses = (portletsession)context.getexternalcontext().getsession(false);         objses.invalidate();     } } 

in piece of code, can see there super.renderview(context, viewtorender);

it goes way services , makes service call. service calls returns exception user has not information in db. , exception converted facesexception on road (we doing it).

the problem not exception nor converting facesexception.

the problem occurs in part

 viewtorender = viewhandler.createview(context,errorview);           context.setviewroot(viewtorender);               viewhandler.renderview(context, viewtorender); 

as far debugged. belive somehow old view partially rendered due exception cannot replaced error view.

but if working previously. have not changed part of code.

is information enough throw idea problem ? guys need more details ? think doing wrong here?

thanks & regards

after looking deep, seen when request comes, response created , filled @ point. has html content inside. when trying redirect new jsp file, appends new html elements response. html elements inside response become obscure gate-in. in order avoid problem, resetting response enough. can done resetting response buffer, can seen on code;

     viewtorender = viewhandler.createview(context, errorview);      context.setviewroot(viewtorender);      **((javax.portlet.renderresponse) context.getexternalcontext().getresponse()).resetbuffer();**      viewhandler.renderview(context, viewtorender); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -