[jboss-user] [JBoss Seam] - Re: Seam doesn't play with ICEFaces

fhh do-not-reply at jboss.com
Mon Jan 15 08:56:43 EST 2007


Hello!

I'm afraid I have deleted my latest version of icefaces. As I have already written I stopped using it. I do have a patch for the request parameter issue described in the link. I think it is somewhat cleaner:


  | diff -uNr icefaces.orig/core/src/com/icesoft/faces/context/BridgeExternalContext.java icefaces.patched/core/src/com/icesoft/faces/context/BridgeExternalContext.java
  | --- icefaces.orig/core/src/com/icesoft/faces/context/BridgeExternalContext.java	2006-11-23 14:30:42.000000000 +0100
  | +++ icefaces.patched/core/src/com/icesoft/faces/context/BridgeExternalContext.java	2006-12-31 01:29:31.265625000 +0100
  | @@ -433,9 +433,12 @@
  |       * in the List is returned.
  |       */
  |  
  | +
  |      /**
  |       * populate the underlying hashtable
  |       */
  | +
  | +    // FIXME: Remove this method. Not needed anymore.
  |      public synchronized void populateRequestParameters(Map requestParameters) {
  |          Map valuesMap = getRequestParameterValuesMap();
  |          if (valuesMap == null) {
  | @@ -447,15 +450,59 @@
  |          filterRequestParameterMap();
  |      }
  |  
  | +    public synchronized void populateRequestParameters() {
  | +
  | +		// Only do this if it has not been done before
  | +        if (requestParameterValuesMap == null) {
  | +
  | +            requestParameterValuesMap = new RequestParameterValuesMap();
  | +
  | +			if (null != servletRequest) {
  | +				Enumeration names = servletRequest.getParameterNames();
  | +				while (names.hasMoreElements()) {
  | +					String name = (String) names.nextElement();
  | +					requestParameterValuesMap.put(name, servletRequest.getParameter(name));
  | +				}
  | +			} else if (null != portletRequest) {
  | +				Enumeration names = portletRequest.getParameterNames();
  | +				while (names.hasMoreElements()) {
  | +					String name = (String) names.nextElement();
  | +					requestParameterValuesMap.put(name, portletRequest.getAttribute(name));
  | +				}
  | +			}
  | +
  | +			requestParameterMap = new Hashtable();
  | +
  | +			Iterator parameterNames = requestParameterValuesMap.keySet().iterator();
  | +			Object nextParameterName = null, nextParameterValue = null;
  | +			while (parameterNames.hasNext()) {
  | +
  | +			            nextParameterName = parameterNames.next();
  | +			            nextParameterValue = requestParameterValuesMap.get(nextParameterName);
  | +			            nextParameterValue = ((String[]) nextParameterValue)[0];
  | +			            requestParameterMap.put(nextParameterName, nextParameterValue);
  | +			        }
  | +
  | +
  | +
  | +	    }
  | +
  | +    }
  | +
  |      private Map requestParameterMap;
  |  
  |      public Map getRequestParameterMap() {
  | -        if (requestParameterMap != null) {
  | -            return requestParameterMap;
  | +
  | +        if (requestParameterMap == null) {
  | +
  | +            populateRequestParameters();
  | +
  |          }
  | -        return requestParameterMap = new Hashtable();
  | +
  | +        return requestParameterMap;
  |      }
  |  
  | +    // FIXME: Remove this method. Not needed anymore.
  |      private void filterRequestParameterMap() {
  |          if (requestParameterMap == null) {
  |              requestParameterMap = new Hashtable();
  | @@ -479,10 +526,16 @@
  |      /**
  |       * returns null if you didn't first call populateRequestParameters.
  |       * No it doesn't. Can't do that. Returns an empty map if populate hasn't
  | -     * been called. 
  | +     * been called.
  |       */
  |      public Map getRequestParameterValuesMap() {
  | -       
  | +
  | +        if (requestParameterValuesMap == null) {
  | +
  | +            populateRequestParameters();
  | +
  | +		}
  | +
  |          return requestParameterValuesMap;
  |      }
  |  
  | @@ -996,9 +1049,12 @@
  |  
  |  }
  |  
  | +
  | +// FIXME: Does this inherit from AbstractMap or does it use a delegate? Plz not both!!!
  | +// FIXME: According to spec this should be immutable.
  |  class RequestParameterValuesMap extends AbstractMap {
  |  
  | -    private Hashtable map = new Hashtable();
  | +    private Map map = new Hashtable();
  |  
  |      public Object get(Object key) {
  |          if (key == null) {
  | 

I just checked in the original sources: The request parameters bug I fixed was somewhere else.  The reason it crashed was exactly the same. Ithink in your case it is:

  | 
  |           facesContext.getExternalContext().getRequestParameterMap()
  |                     .put("viewNumber", String.valueOf(viewNumber));
  | 
  | 

Not sure what this is suppsoed to mean but according to specs you   must not put additional values to the RequestParamterMap. If you have fixed this you will find another piece of code where icefaces puts some attribute in to the map to notify another component internally that this is a seam request.

The conclusion I drew from this mess is not to use Icefaces (yet!). I hope this helps you a little.

Regards

Felix

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4001787



More information about the jboss-user mailing list