Re: and i18n

2007-01-21 Thread Craig McClanahan

On 1/21/07, JS Portal Support <[EMAIL PROTECTED]> wrote:


Hi,

My backing beans set some info messages though calling the
.info("message").
The messages I set however are ResourceBundle id's. In my JSP's I then
want
to collect the id and present the message. I have:



Which now nicely displays my i18n id's.



Aren't they pretty?  :-)

How can I alter it so that my proper

localized messages are shown?

All my i18n is setup and things like:

Work as they should.



The simplest approach is to use the tried and true techniques of Java
internationalization, along these lines:

   public class MyBackingBean extends AbstractViewController {

   private static ResourceBundle bundle =
 ResourceBundle.getBundle("com.mycompany.mypackage.MyBundle");
   ...
   public String myAction() {
   ...
   info(bundle.getString("my.message.key"));
   ...
   }

   }

If the resource bundle name listed here is the same as the one you used in
your  tag, then you are easily able to leverage exactly the
same localized messages as you are using for the JSP page itself.

If you also need to do parameter replacement in the localized messages, you
should take a look at the org.apache.shale.util.Messages utility class in
the shale-core module.

Craig


Regards,

Joost Schouten






and i18n

2007-01-21 Thread JS Portal Support
Hi,

My backing beans set some info messages though calling the .info("message").
The messages I set however are ResourceBundle id's. In my JSP's I then want
to collect the id and present the message. I have:



Which now nicely displays my i18n id's. How can I alter it so that my proper
localized messages are shown?

All my i18n is setup and things like:

Work as they should.

Regards,
Joost Schouten
 




Re: Shale ExceptionHandling

2007-01-21 Thread Duong BaTien
On Sun, 2007-01-21 at 14:20 -0800, Craig McClanahan wrote:

Thanks. I got it.

> On 1/21/07, Duong BaTien <[EMAIL PROTECTED]> wrote:
> >
> > Hello Craig:
> > Thank for a quick response. I downloaded the 1.1.0-SNAPSHOT but cannot
> > find a binary for trunk/shale-apps/*.
> 
> 
> Each individual application is packaged and uploaded separately.  The test
> apps are in [1].
> 
> 
> Do you think it will be available
> > soon? What is the difference between shale-apps and shale-application
> > directories?
> 
> 
> The "shale-application" module is the Application Controller[2].  The
> "shale-apps" module is the parent pom for all of the example and test
> applications, containing shared stuff so it does not have to be repeated in
> the pom for each individual application.
> 
> Craig
> 
> [1] http://people.apache.org/builds/shale/nightly/tests/
> [2] http://shale.apache.org/shale-application/index.html
> 
> 
> On Sat, 2007-01-20 at 17:43 -0800, Craig McClanahan wrote:
> > > On 1/20/07, Duong BaTien < [EMAIL PROTECTED]> wrote:
> > > >
> > > > Hello Craig:
> > > >
> > > > I am trying to look at shale-apps/shale-test-view to see an example of
> > > > ViewController exception handling. I download from svn and try to
> > build
> > > > it from mvn but get the following exception:
> > > >
> > > > The plugin 'org.codehaus.mojo:cobertura-maven-plugin' does not exist
> > or
> > > > no valid version could be found
> > > >
> > > > I then try to get the latest nightly build, but they all disappeared.
> > > > Where are they located now?
> > >
> > >
> > > There has been a glitch on the server that creates the nightly builds,
> > which
> > > I just fixed.  We should see tonight's (and following) builds appear in
> > the
> > > usual place[1].
> > >
> > > Craig
> > >
> > > [1] http://people.apache.org/builds/shale/nightly/
> > >
> > >
> > > Thanks
> > > > BaTien
> > > >
> > > >
> > > > On Fri, 2007-01-19 at 14:47 -0800, Craig McClanahan wrote:
> > > > > On 1/19/07, Reynolds, James < [EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > I have a question about the org.apache.shale.view.ExceptionHandler
> > > > > > interface.  Comments in the Shale Wiki indicate that Shale "...can
> >
> > > > > > optionally do a RequestDispatcher.forward() call to the context
> > > > relative
> > > > > > path of an error display page..."  How do I invoke the option to
> > > > forward
> > > > > > to my error page?
> > > > > >
> > > > > > I've created my ExceptionHandler class (code below) and configured
> > it
> > > > > > successfully.  I also configured this parameter in my web.xml:
> > > > > >
> > > > > > 
> > > > > >
> > > > > > org.apache.shale.view.EXCEPTION_DISPATCH_PATH
> > 
> > > > > >/exceptionViewer.jsf
> > > > > > 
> > > > > >
> > > > > > ExceptionHandler code:
> > > > > >
> > > > > > public class WebEnabledExceptionHandler implements
> > ExceptionHandler {
> > > > > >
> > > > > > public WebEnabledExceptionHandler(){
> > > > > > }
> > > > > >
> > > > > > public void handleException(Exception exception) {
> > > > > > System.out.println("Shale ExceptionHandler: " +
> > > > > > exception.getMessage());
> > > > > > // How do I forward to the error page?
> > > > > > }
> > > > > > }
> > > > > >
> > > > > > Thanks!
> > > > >
> > > > >
> > > > > It's magic :-).
> > > > >
> > > > > Actually, the act of declaring the forward path (as you are doing
> > here)
> > > > > enables the forwarding automatically.  The code that actually does
> > this
> > > > is
> > > > > the afterPhaseExceptionCheck() method in ViewPhaseListener, which is
> > > > called
> > > > > at the end of each phase.  IF any exceptions have been queued up,
> > AND
> > > > the
> > > > > web.xml declares a forwarding path, THEN it will do the
> > forwarding.  You
> > > > do
> > > > > not need to provide a custom ExceptionHandler to accomplish this.
> > > > >
> > > > > Craig
> > > > >
> > > > >
> > > > > E-Mail messages may contain viruses, worms, or other malicious code.
> > By
> > > > > > reading the message and opening any attachments, the recipient
> > accepts
> > > > full
> > > > > > responsibility for taking protective action against such code.
> > Sender
> > > > is not
> > > > > > liable for any loss or damage arising from this message.
> > > > > >
> > > > > > The information in this e-mail is confidential and may be legally
> > > > > > privileged. It is intended solely for the addressee(s). Access to
> > this
> > > > > > e-mail by anyone else is unauthorized.
> > > > > >
> > > > > >
> > > >
> > > >
> >
> >



list/detail navigation - newbie question

2007-01-21 Thread Adrian Gonzalez
Hello,

Here's a really basic question (I'm just a JSF newbie) : list/detail navigation.

It's a pure JSF problem I know, but I think I can perhaps use prerender 
callback to better support a list/detail scenario.

I would like to know if there's a good pattern for list / detail navigation 
without impacting performance (memory, storage
or bandwidth), and with good error handling (dont load data with getters - pb 
if page flush - but with callback method)?

I just wanted to use basic logic : I'll use hidden inputs in master page to 
store my record primary keys, so when
I click on the link, I'll be able to load record details with this pk.

All the following 3 solutions seem to me to be awfull ones (performance 
reasons).
Isn't there another one (a good one) ? Did I miss something ?

And another question : can we use prerender callbacks for this scenario ?

1. Solution 1 just use plain getters
Pb : my business logic is called twice -> show stopper.
My problem with this solution is that if I use dataTable and nested commandLink 
to navigate to detail view, i.e.






and my backing bean list if coded as :
public class UserList extends BasePage implements Serializable {
public List getUsers() {
List users = userManager.getUsers(null);
return users;
}
}

My business logic (userManager) will get called twice (once on RENDER_RESPONSE 
phase, and another
one during postback on APPLY_REQUEST_VALUES phase). 
So I'll got some performance probems.

2. Use t:saveState ou t:dataTable with preserveModel=true
I'll just have to code :
public class UserList extends BasePage implements Serializable {
private List mUsers = null;
public List getUsers() {
if (mUsers == null) {
mUsers = userManager.getUsers(null);
} else {
return mUsers;
}
}
Pros : 
business logic doesn't get called twice.
Cons : 
jsf context used to serialize table date (if state=client, HTML size ++, if 
state=server then web session clutter).
coding : never forget the condition on getters.

3. Just store my users table on session scope 
Pros : business logic doesn't get called twice.
I can use prerender to create list data.
Cons : web session clutter.

4. using flashScope
Just read sthing about trinidad flashScope, but doesn"t appear to be a good 
solution, since flashScope will store all
my list data on client or session.

Thank your very much for your help








___ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com


Re : [Shale view 1.0.4]

2007-01-21 Thread Adrian Gonzalez
Thank you very much.

So, I suppose I don't need to open an issue anymore ?

- Message d'origine 
De : Matthias Wessendorf <[EMAIL PROTECTED]>
À : user@shale.apache.org
Envoyé le : Dimanche, 21 Janvier 2007, 23h40mn 24s
Objet : Re: [Shale view 1.0.4]

fixed already in current trunk

(see svn commit: r497775)

or

http://svn.apache.org/viewvc/shale/framework/trunk/shale-view/src/main/java/org/apache/shale/view/faces/ViewPhaseListener.java?view=diff&r1=497774&r2=497775&pathrev=497775


thx,
Matt

On 1/21/07, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> On 1/21/07, Adrian Gonzalez <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hello,
> >
> > I think there's a little bug on shale view 1.0.4.
> >
> > Shale View : Bug on render response phase when removing view from request
> > map.
> >
> > Error in org.apache.shale.view.faces.ViewPhaseListener, method
> > afterRenderResponse, lien 233 :
> > iterator obtained from map, code calling map.remove, and afterward using
> > iterator which generated ConcurrentModificationException.
> >
> > Just change this order :
> > - remove FacesConstants.VIEWS_INITIALIZED from map.
> > - obtain iterator.
> > - use iterator.
> >
> > I've just changed this piece of code in order to have :
> > private void afterRenderResponse(PhaseEvent event) {
> > /*AFTER CHANGE*/
> > // Initialize local values we will need
> > Map map = event.getFacesContext
> > ().getExternalContext().getRequestMap();
> > List list = new ArrayList();
> >
> > // Remove our list of initialized views explicitly
> > map.remove(FacesConstants.VIEWS_INITIALIZED);
> >
> > Iterator entries = map.entrySet().iterator();
> >
> > instead of :
> > /*BEFORE CHANGE
> > // Initialize local values we will need
> > Map map = event.getFacesContext
> > ().getExternalContext().getRequestMap();
> > List list = new ArrayList();
> > Iterator entries = map.entrySet().iterator();
> >
> > // Remove our list of initialized views explicitly
> > map.remove(FacesConstants.VIEWS_INITIALIZED);
> >
> > And it's ok (or it seems).
>
>
> Adrian,
>
> Thanks very much for the thorough analysis ... it looks like you are on
> target (although it likely depends on your VM's implementation of the
> iterator methods so the problem may or may not manifest itself everywhere).
>
> Could you do me a favor and file a bug in our issue tracking system[1] for
> this?  That way, the eventual fix will automatically be included in the
> release notes for the next version.
>
> Craig
>
> [1] https://issues.apache.org/struts/browse/SHALE
>
>
>
> Here's the stack trace I had :
> > [21/01/07 20:38:36:453 CET] 0043 helperI   BEFORE
> > RENDER_RESPONSE(6)
> > [21/01/07 20:38:38:765 CET] 0043 HtmlTableRend E
> > org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBaseencodeInnerHtml
> >  Row is not available. Rowindex = 3
> > [21/01/07 20:38:38:921 CET] 0043 HtmlResponseW W
> > org.apache.myfaces.shared_impl.renderkit.html.HtmlResponseWriterImplendElement
> >  HTML nesting warning on closing tbody: element tr rendered by
> > component : {Component-Path : [Class:
> > org.ajax4jsf.framework.ajax.AjaxViewRootRIOneOne,ViewId:
> > /userList.jsp][Class: javax.faces.component.html.HtmlForm,Id:
> > editUser][Class: org.apache.myfaces.component.html.ext.HtmlDataTable,Id:
> > userList]} not explicitly closed
> > [21/01/07 20:38:40:250 CET] 0043 PhaseListener E
> > org.apache.myfaces.lifecycle.PhaseListenerManagerinformPhaseListenersAfter 
> > Exception in PhaseListener RENDER_RESPONSE(6)
> > afterPhase
> >  java.util.ConcurrentModificationException
> > at java.util.HashMap$HashIterator.nextEntry(HashMap.java:942)
> > at java.util.HashMap$KeyIterator.next(HashMap.java:978)
> > at com.ibm.ws.webcontainer.srt.SRTServletRequest$1.nextElement(
> > SRTServletRequest.java:177)
> > at
> > org.apache.myfaces.context.servlet.AbstractAttributeMap$KeyIterator.next(
> > AbstractAttributeMap.java:210)
> > at
> > org.apache.myfaces.context.servlet.AbstractAttributeMap$EntryIterator.next
> > (AbstractAttributeMap.java:306)
> > at org.apache.shale.view.faces.ViewPhaseListener.afterRenderResponse(
> > ViewPhaseListener.java:233)
> > at org.apache.shale.view.faces.ViewPhaseListener.afterPhase(
> > ViewPhaseListener.java:106)
> > at
> > org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter
> > (PhaseListenerManager.java:89)
> > at org.apache.myfaces.lifecycle.LifecycleImpl.render(
> > LifecycleImpl.java:391)
> > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
> > at org.apache.myfaces.webapp.MyFacesServlet.service(
> > MyFacesServlet.java:74)
> > at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> > ServletWrapper.java:1282)
> > at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> > ServletWrapper.java:1239)
> >   

Re: [Shale view 1.0.4]

2007-01-21 Thread Matthias Wessendorf

fixed already in current trunk

(see svn commit: r497775)

or

http://svn.apache.org/viewvc/shale/framework/trunk/shale-view/src/main/java/org/apache/shale/view/faces/ViewPhaseListener.java?view=diff&r1=497774&r2=497775&pathrev=497775


thx,
Matt

On 1/21/07, Craig McClanahan <[EMAIL PROTECTED]> wrote:

On 1/21/07, Adrian Gonzalez <[EMAIL PROTECTED]> wrote:
>
>
> Hello,
>
> I think there's a little bug on shale view 1.0.4.
>
> Shale View : Bug on render response phase when removing view from request
> map.
>
> Error in org.apache.shale.view.faces.ViewPhaseListener, method
> afterRenderResponse, lien 233 :
> iterator obtained from map, code calling map.remove, and afterward using
> iterator which generated ConcurrentModificationException.
>
> Just change this order :
> - remove FacesConstants.VIEWS_INITIALIZED from map.
> - obtain iterator.
> - use iterator.
>
> I've just changed this piece of code in order to have :
> private void afterRenderResponse(PhaseEvent event) {
> /*AFTER CHANGE*/
> // Initialize local values we will need
> Map map = event.getFacesContext
> ().getExternalContext().getRequestMap();
> List list = new ArrayList();
>
> // Remove our list of initialized views explicitly
> map.remove(FacesConstants.VIEWS_INITIALIZED);
>
> Iterator entries = map.entrySet().iterator();
>
> instead of :
> /*BEFORE CHANGE
> // Initialize local values we will need
> Map map = event.getFacesContext
> ().getExternalContext().getRequestMap();
> List list = new ArrayList();
> Iterator entries = map.entrySet().iterator();
>
> // Remove our list of initialized views explicitly
> map.remove(FacesConstants.VIEWS_INITIALIZED);
>
> And it's ok (or it seems).


Adrian,

Thanks very much for the thorough analysis ... it looks like you are on
target (although it likely depends on your VM's implementation of the
iterator methods so the problem may or may not manifest itself everywhere).

Could you do me a favor and file a bug in our issue tracking system[1] for
this?  That way, the eventual fix will automatically be included in the
release notes for the next version.

Craig

[1] https://issues.apache.org/struts/browse/SHALE



Here's the stack trace I had :
> [21/01/07 20:38:36:453 CET] 0043 helperI   BEFORE
> RENDER_RESPONSE(6)
> [21/01/07 20:38:38:765 CET] 0043 HtmlTableRend E
> 
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBaseencodeInnerHtml
 Row is not available. Rowindex = 3
> [21/01/07 20:38:38:921 CET] 0043 HtmlResponseW W
> 
org.apache.myfaces.shared_impl.renderkit.html.HtmlResponseWriterImplendElement 
HTML nesting warning on closing tbody: element tr rendered by
> component : {Component-Path : [Class:
> org.ajax4jsf.framework.ajax.AjaxViewRootRIOneOne,ViewId:
> /userList.jsp][Class: javax.faces.component.html.HtmlForm,Id:
> editUser][Class: org.apache.myfaces.component.html.ext.HtmlDataTable,Id:
> userList]} not explicitly closed
> [21/01/07 20:38:40:250 CET] 0043 PhaseListener E
> org.apache.myfaces.lifecycle.PhaseListenerManagerinformPhaseListenersAfter 
Exception in PhaseListener RENDER_RESPONSE(6)
> afterPhase
>  java.util.ConcurrentModificationException
> at java.util.HashMap$HashIterator.nextEntry(HashMap.java:942)
> at java.util.HashMap$KeyIterator.next(HashMap.java:978)
> at com.ibm.ws.webcontainer.srt.SRTServletRequest$1.nextElement(
> SRTServletRequest.java:177)
> at
> org.apache.myfaces.context.servlet.AbstractAttributeMap$KeyIterator.next(
> AbstractAttributeMap.java:210)
> at
> org.apache.myfaces.context.servlet.AbstractAttributeMap$EntryIterator.next
> (AbstractAttributeMap.java:306)
> at org.apache.shale.view.faces.ViewPhaseListener.afterRenderResponse(
> ViewPhaseListener.java:233)
> at org.apache.shale.view.faces.ViewPhaseListener.afterPhase(
> ViewPhaseListener.java:106)
> at
> org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter
> (PhaseListenerManager.java:89)
> at org.apache.myfaces.lifecycle.LifecycleImpl.render(
> LifecycleImpl.java:391)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
> at org.apache.myfaces.webapp.MyFacesServlet.service(
> MyFacesServlet.java:74)
> at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> ServletWrapper.java:1282)
> at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> ServletWrapper.java:1239)
> at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(
> WebAppFilterChain.java:136)
> at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(
> ExtensionsFilter.java:144)
> at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(
> FilterInstanceWrapper.java:142)
> at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(
> WebAppFilterChain.java:121)
> at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(
>

Re: Shale ExceptionHandling

2007-01-21 Thread Craig McClanahan

On 1/21/07, Duong BaTien <[EMAIL PROTECTED]> wrote:


Hello Craig:
Thank for a quick response. I downloaded the 1.1.0-SNAPSHOT but cannot
find a binary for trunk/shale-apps/*.



Each individual application is packaged and uploaded separately.  The test
apps are in [1].


Do you think it will be available

soon? What is the difference between shale-apps and shale-application
directories?



The "shale-application" module is the Application Controller[2].  The
"shale-apps" module is the parent pom for all of the example and test
applications, containing shared stuff so it does not have to be repeated in
the pom for each individual application.

Craig

[1] http://people.apache.org/builds/shale/nightly/tests/
[2] http://shale.apache.org/shale-application/index.html


On Sat, 2007-01-20 at 17:43 -0800, Craig McClanahan wrote:

> On 1/20/07, Duong BaTien < [EMAIL PROTECTED]> wrote:
> >
> > Hello Craig:
> >
> > I am trying to look at shale-apps/shale-test-view to see an example of
> > ViewController exception handling. I download from svn and try to
build
> > it from mvn but get the following exception:
> >
> > The plugin 'org.codehaus.mojo:cobertura-maven-plugin' does not exist
or
> > no valid version could be found
> >
> > I then try to get the latest nightly build, but they all disappeared.
> > Where are they located now?
>
>
> There has been a glitch on the server that creates the nightly builds,
which
> I just fixed.  We should see tonight's (and following) builds appear in
the
> usual place[1].
>
> Craig
>
> [1] http://people.apache.org/builds/shale/nightly/
>
>
> Thanks
> > BaTien
> >
> >
> > On Fri, 2007-01-19 at 14:47 -0800, Craig McClanahan wrote:
> > > On 1/19/07, Reynolds, James < [EMAIL PROTECTED]> wrote:
> > > >
> > > > I have a question about the org.apache.shale.view.ExceptionHandler
> > > > interface.  Comments in the Shale Wiki indicate that Shale "...can

> > > > optionally do a RequestDispatcher.forward() call to the context
> > relative
> > > > path of an error display page..."  How do I invoke the option to
> > forward
> > > > to my error page?
> > > >
> > > > I've created my ExceptionHandler class (code below) and configured
it
> > > > successfully.  I also configured this parameter in my web.xml:
> > > >
> > > > 
> > > >
> > > > org.apache.shale.view.EXCEPTION_DISPATCH_PATH

> > > >/exceptionViewer.jsf
> > > > 
> > > >
> > > > ExceptionHandler code:
> > > >
> > > > public class WebEnabledExceptionHandler implements
ExceptionHandler {
> > > >
> > > > public WebEnabledExceptionHandler(){
> > > > }
> > > >
> > > > public void handleException(Exception exception) {
> > > > System.out.println("Shale ExceptionHandler: " +
> > > > exception.getMessage());
> > > > // How do I forward to the error page?
> > > > }
> > > > }
> > > >
> > > > Thanks!
> > >
> > >
> > > It's magic :-).
> > >
> > > Actually, the act of declaring the forward path (as you are doing
here)
> > > enables the forwarding automatically.  The code that actually does
this
> > is
> > > the afterPhaseExceptionCheck() method in ViewPhaseListener, which is
> > called
> > > at the end of each phase.  IF any exceptions have been queued up,
AND
> > the
> > > web.xml declares a forwarding path, THEN it will do the
forwarding.  You
> > do
> > > not need to provide a custom ExceptionHandler to accomplish this.
> > >
> > > Craig
> > >
> > >
> > > E-Mail messages may contain viruses, worms, or other malicious code.
By
> > > > reading the message and opening any attachments, the recipient
accepts
> > full
> > > > responsibility for taking protective action against such code.
Sender
> > is not
> > > > liable for any loss or damage arising from this message.
> > > >
> > > > The information in this e-mail is confidential and may be legally
> > > > privileged. It is intended solely for the addressee(s). Access to
this
> > > > e-mail by anyone else is unauthorized.
> > > >
> > > >
> >
> >




Re: [Shale view 1.0.4]

2007-01-21 Thread Craig McClanahan

On 1/21/07, Adrian Gonzalez <[EMAIL PROTECTED]> wrote:



Hello,

I think there's a little bug on shale view 1.0.4.

Shale View : Bug on render response phase when removing view from request
map.

Error in org.apache.shale.view.faces.ViewPhaseListener, method
afterRenderResponse, lien 233 :
iterator obtained from map, code calling map.remove, and afterward using
iterator which generated ConcurrentModificationException.

Just change this order :
- remove FacesConstants.VIEWS_INITIALIZED from map.
- obtain iterator.
- use iterator.

I've just changed this piece of code in order to have :
private void afterRenderResponse(PhaseEvent event) {
/*AFTER CHANGE*/
// Initialize local values we will need
Map map = event.getFacesContext
().getExternalContext().getRequestMap();
List list = new ArrayList();

// Remove our list of initialized views explicitly
map.remove(FacesConstants.VIEWS_INITIALIZED);

Iterator entries = map.entrySet().iterator();

instead of :
/*BEFORE CHANGE
// Initialize local values we will need
Map map = event.getFacesContext
().getExternalContext().getRequestMap();
List list = new ArrayList();
Iterator entries = map.entrySet().iterator();

// Remove our list of initialized views explicitly
map.remove(FacesConstants.VIEWS_INITIALIZED);

And it's ok (or it seems).



Adrian,

Thanks very much for the thorough analysis ... it looks like you are on
target (although it likely depends on your VM's implementation of the
iterator methods so the problem may or may not manifest itself everywhere).

Could you do me a favor and file a bug in our issue tracking system[1] for
this?  That way, the eventual fix will automatically be included in the
release notes for the next version.

Craig

[1] https://issues.apache.org/struts/browse/SHALE



Here's the stack trace I had :

[21/01/07 20:38:36:453 CET] 0043 helperI   BEFORE
RENDER_RESPONSE(6)
[21/01/07 20:38:38:765 CET] 0043 HtmlTableRend E
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBaseencodeInnerHtml
 Row is not available. Rowindex = 3
[21/01/07 20:38:38:921 CET] 0043 HtmlResponseW W
org.apache.myfaces.shared_impl.renderkit.html.HtmlResponseWriterImplendElement 
HTML nesting warning on closing tbody: element tr rendered by
component : {Component-Path : [Class:
org.ajax4jsf.framework.ajax.AjaxViewRootRIOneOne,ViewId:
/userList.jsp][Class: javax.faces.component.html.HtmlForm,Id:
editUser][Class: org.apache.myfaces.component.html.ext.HtmlDataTable,Id:
userList]} not explicitly closed
[21/01/07 20:38:40:250 CET] 0043 PhaseListener E
org.apache.myfaces.lifecycle.PhaseListenerManagerinformPhaseListenersAfter 
Exception in PhaseListener RENDER_RESPONSE(6)
afterPhase
 java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:942)
at java.util.HashMap$KeyIterator.next(HashMap.java:978)
at com.ibm.ws.webcontainer.srt.SRTServletRequest$1.nextElement(
SRTServletRequest.java:177)
at
org.apache.myfaces.context.servlet.AbstractAttributeMap$KeyIterator.next(
AbstractAttributeMap.java:210)
at
org.apache.myfaces.context.servlet.AbstractAttributeMap$EntryIterator.next
(AbstractAttributeMap.java:306)
at org.apache.shale.view.faces.ViewPhaseListener.afterRenderResponse(
ViewPhaseListener.java:233)
at org.apache.shale.view.faces.ViewPhaseListener.afterPhase(
ViewPhaseListener.java:106)
at
org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter
(PhaseListenerManager.java:89)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(
LifecycleImpl.java:391)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
at org.apache.myfaces.webapp.MyFacesServlet.service(
MyFacesServlet.java:74)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
ServletWrapper.java:1239)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(
WebAppFilterChain.java:136)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(
ExtensionsFilter.java:144)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(
FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(
WebAppFilterChain.java:121)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(
BaseXMLFilter.java:67)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(
BaseFilter.java:223)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(
FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(
WebAppFilterChain.java:121)
at org.firsttest.webapp.filter.MessageFilter.doFilter(
MessageFilter.java:45)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(
FilterInstanceWrapper.j

[Shale view 1.0.4]

2007-01-21 Thread Adrian Gonzalez

Hello, 

I think there's a little bug on shale view 1.0.4.

Shale View : Bug on render response phase when removing view from request map.

Error in org.apache.shale.view.faces.ViewPhaseListener, method 
afterRenderResponse, lien 233 :
iterator obtained from map, code calling map.remove, and afterward using 
iterator which generated ConcurrentModificationException.

Just change this order :
- remove FacesConstants.VIEWS_INITIALIZED from map.
- obtain iterator.
- use iterator.

I've just changed this piece of code in order to have :
private void afterRenderResponse(PhaseEvent event) {
/*AFTER CHANGE*/
// Initialize local values we will need
Map map = event.getFacesContext().getExternalContext().getRequestMap();
List list = new ArrayList();

// Remove our list of initialized views explicitly
map.remove(FacesConstants.VIEWS_INITIALIZED);

Iterator entries = map.entrySet().iterator();

instead of :
/*BEFORE CHANGE
// Initialize local values we will need
Map map = event.getFacesContext().getExternalContext().getRequestMap();
List list = new ArrayList();
Iterator entries = map.entrySet().iterator();

// Remove our list of initialized views explicitly
map.remove(FacesConstants.VIEWS_INITIALIZED);

And it's ok (or it seems).

Here's the stack trace I had :
[21/01/07 20:38:36:453 CET] 0043 helperI   BEFORE RENDER_RESPONSE(6)
[21/01/07 20:38:38:765 CET] 0043 HtmlTableRend E 
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase 
encodeInnerHtml Row is not available. Rowindex = 3
[21/01/07 20:38:38:921 CET] 0043 HtmlResponseW W 
org.apache.myfaces.shared_impl.renderkit.html.HtmlResponseWriterImpl endElement 
HTML nesting warning on closing tbody: element tr rendered by component : 
{Component-Path : [Class: 
org.ajax4jsf.framework.ajax.AjaxViewRootRIOneOne,ViewId: /userList.jsp][Class: 
javax.faces.component.html.HtmlForm,Id: editUser][Class: 
org.apache.myfaces.component.html.ext.HtmlDataTable,Id: userList]} not 
explicitly closed
[21/01/07 20:38:40:250 CET] 0043 PhaseListener E 
org.apache.myfaces.lifecycle.PhaseListenerManager informPhaseListenersAfter 
Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
 java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:942)
at java.util.HashMap$KeyIterator.next(HashMap.java:978)
at 
com.ibm.ws.webcontainer.srt.SRTServletRequest$1.nextElement(SRTServletRequest.java:177)
at 
org.apache.myfaces.context.servlet.AbstractAttributeMap$KeyIterator.next(AbstractAttributeMap.java:210)
at 
org.apache.myfaces.context.servlet.AbstractAttributeMap$EntryIterator.next(AbstractAttributeMap.java:306)
at 
org.apache.shale.view.faces.ViewPhaseListener.afterRenderResponse(ViewPhaseListener.java:233)
at 
org.apache.shale.view.faces.ViewPhaseListener.afterPhase(ViewPhaseListener.java:106)
at 
org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
at org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:74)
at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at 
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136)
at 
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
at 
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at 
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at 
org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:67)
at 
org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:223)
at 
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at 
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at org.firsttest.webapp.filter.MessageFilter.doFilter(MessageFilter.java:45)
at 
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at 
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at 
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:375)
at 
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at 
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at 
net.sf.ehcache.constructs.web.filter.GzipFilter.doFilter(GzipFilter.java:75)
at net.sf.ehcache.constructs.web.filter.F

Re: Shale ExceptionHandling

2007-01-21 Thread Duong BaTien
Hello Craig:
Thank for a quick response. I downloaded the 1.1.0-SNAPSHOT but cannot
find a binary for trunk/shale-apps/*. Do you think it will be available
soon? What is the difference between shale-apps and shale-application
directories?


On Sat, 2007-01-20 at 17:43 -0800, Craig McClanahan wrote:
> On 1/20/07, Duong BaTien <[EMAIL PROTECTED]> wrote:
> >
> > Hello Craig:
> >
> > I am trying to look at shale-apps/shale-test-view to see an example of
> > ViewController exception handling. I download from svn and try to build
> > it from mvn but get the following exception:
> >
> > The plugin 'org.codehaus.mojo:cobertura-maven-plugin' does not exist or
> > no valid version could be found
> >
> > I then try to get the latest nightly build, but they all disappeared.
> > Where are they located now?
> 
> 
> There has been a glitch on the server that creates the nightly builds, which
> I just fixed.  We should see tonight's (and following) builds appear in the
> usual place[1].
> 
> Craig
> 
> [1] http://people.apache.org/builds/shale/nightly/
> 
> 
> Thanks
> > BaTien
> >
> >
> > On Fri, 2007-01-19 at 14:47 -0800, Craig McClanahan wrote:
> > > On 1/19/07, Reynolds, James <[EMAIL PROTECTED]> wrote:
> > > >
> > > > I have a question about the org.apache.shale.view.ExceptionHandler
> > > > interface.  Comments in the Shale Wiki indicate that Shale "...can
> > > > optionally do a RequestDispatcher.forward() call to the context
> > relative
> > > > path of an error display page..."  How do I invoke the option to
> > forward
> > > > to my error page?
> > > >
> > > > I've created my ExceptionHandler class (code below) and configured it
> > > > successfully.  I also configured this parameter in my web.xml:
> > > >
> > > > 
> > > >
> > > > org.apache.shale.view.EXCEPTION_DISPATCH_PATH
> > > >/exceptionViewer.jsf
> > > > 
> > > >
> > > > ExceptionHandler code:
> > > >
> > > > public class WebEnabledExceptionHandler implements ExceptionHandler {
> > > >
> > > > public WebEnabledExceptionHandler(){
> > > > }
> > > >
> > > > public void handleException(Exception exception) {
> > > > System.out.println("Shale ExceptionHandler: " +
> > > > exception.getMessage());
> > > > // How do I forward to the error page?
> > > > }
> > > > }
> > > >
> > > > Thanks!
> > >
> > >
> > > It's magic :-).
> > >
> > > Actually, the act of declaring the forward path (as you are doing here)
> > > enables the forwarding automatically.  The code that actually does this
> > is
> > > the afterPhaseExceptionCheck() method in ViewPhaseListener, which is
> > called
> > > at the end of each phase.  IF any exceptions have been queued up, AND
> > the
> > > web.xml declares a forwarding path, THEN it will do the forwarding.  You
> > do
> > > not need to provide a custom ExceptionHandler to accomplish this.
> > >
> > > Craig
> > >
> > >
> > > E-Mail messages may contain viruses, worms, or other malicious code. By
> > > > reading the message and opening any attachments, the recipient accepts
> > full
> > > > responsibility for taking protective action against such code. Sender
> > is not
> > > > liable for any loss or damage arising from this message.
> > > >
> > > > The information in this e-mail is confidential and may be legally
> > > > privileged. It is intended solely for the addressee(s). Access to this
> > > > e-mail by anyone else is unauthorized.
> > > >
> > > >
> >
> >