RE: Customizing Basic DialogContextManager

2007-07-25 Thread mario.buonopane
I'm sorry Rahul but I don't understand your response (sure is for my bad
English).
Can you explain:
 If it must be so (for whatever reason that I am no longer
trying to identify :-), then it must not claim to be any variant of
the basic impl anyway.

Thanks 
Mario 

-Original Message-
From: Rahul Akolkar [mailto:[EMAIL PROTECTED] 
Sent: 24 luglio 2007 21.12
To: user@shale.apache.org
Subject: Re: Customizing Basic DialogContextManager

On 7/24/07, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 The reason is that I have, in special cases, to change the name of the
 dialog name to start and I can't change the code of my web
application.
snip/

I'd say make sure you have the right name before you hit the basic
dialog manager impl (but you already seem to indicate thats not
possible).


 For example:
 public ... create(javax.faces.context.FacesContext context,
String name)
  {
 if(usaPresident.equalsIgnoreCase(BUSH)) name =
NoWarsPlease;

   super.create(context,name);
 }

 (I don't understand the antipattern.
 and I don't understand why
 org.apache.shale.dialog.basic.BasicDialogManager is final)

snap/

Its along these lines:

 * Shale has one dialog API and many potential dialog implementations
 * Each implementation defines certain contracts (these must adhere to
the contracts in the API, and may additionally define impl-specific
contracts and features as well)
 * If subclassing is allowed, it may be possible that the subclass
(knowingly or unknowingly) ceases to honor some of the contracts for
that impl
 * As an aside, the mechanics of getting subclassing to work as
expected are cumbersome (since that wasn't a design consideration)

Lets look at your example above:

The dialog manager contract indicates that the create() method will
instantiate a dialog context for the given dialog name. By returning a
dialog context for another dialog name, that contract is no longer
fulfilled. If it must be so (for whatever reason that I am no longer
trying to identify :-), then it must not claim to be any variant of
the basic impl anyway.

-Rahul


 Thanks
 Mario
 -Original Message-
 From: Rahul Akolkar [mailto:[EMAIL PROTECTED]
 Sent: 23 luglio 2007 21.19
 To: user@shale.apache.org
 Subject: Re: Customizing Basic DialogContextManager

 On 7/20/07, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
  Hi Rahul,
  What I need is to extend the create method of
  org.apache.shale.dialog.basic.BasicDialogManager
 
  for example doing:
 
  public ... create(javax.faces.context.FacesContext context,
String name)
  {
  Super.create(context,name);
System.out.println(Hello Rahul);
  }
 
 snip/

 I'm saying this is more an anti-pattern (i.e. avoid, if possible :-)

 Can you use the DialogContextManagerListener [1] for this purpose? If
 not, I'll go back to my questions two replies ago -- what is the
 reason? Is the reason related to SHALE-454 [2] ?

 -Rahul

 [1]

http://shale.apache.org/shale-dialog/apidocs/org/apache/shale/dialog/Dia
 logContextManagerListener.html

 [2] http://issues.apache.org/struts/browse/SHALE-454



 
  Thanks
  Mario
 


This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information.  If you have received it in 
error, please notify the sender immediately and delete the original.  Any other 
use of the email by you is prohibited.


Re: Any sucess with shale nightly 20070717 and RI JSF 1.2?

2007-07-25 Thread Gary VanMatre
Sorry about the empty post. Let's try again.

There appears to be an unresolved bug from 02/Oct/06 reported against
this problem along with a workaround at:
https://issues.apache.org/struts/browse/SHALE-302
http://forum.java.sun.com/thread.jspa?threadID=770686messageID=4408064

-= Gregg =-


Gregg, thanks for providing more information.  The issues that Shale has with 
regards to the proposed changes:
 
* Shale doesn’t yet have a code branch specifically focusing on JSF 1.2.  We 
have talked about doing this but have not made it a priority.
 
* Shale tries to be RI neutral.  The solution on the forum uses classes in the 
implementation of the Sun RI.  This solution wouldn’t work with myfaces.

Gary---BeginMessage---
Sorry about the empty post. Let's try again.

There appears to be an unresolved bug from 02/Oct/06 reported against
this problem along with a workaround at:
https://issues.apache.org/struts/browse/SHALE-302
http://forum.java.sun.com/thread.jspa?threadID=770686messageID=4408064

-= Gregg =-

Gregg Leichtman wrote:
 I have assembled a small sample project using:
 RI of JSF 1.2 v1.2_04_p2
 Shale nightly 20070717
 tiles-core-2.0-r468346-SNAPSHOT.jar from the Shale nightly distribution
 JSTL 1.1.2
 Tomcat 6.0.13
 Updated the faces-config.xml to use:
   faces-config xmlns=http://java.sun.com/xml/ns/javaee;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation=http://java.sun.com/xml/ns/javaee
 http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd;
   version=1.2
 Updated the web.xml to use:
   web-app version=2.5
 xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd;

 I have the same sample project working successfully using:
 myfaces 1.1.4
 Shale nightly 20070409
 tiles-core-2.0-r468346-SNAPSHOT.jar from the Shale nightly distribution
 JSTL 1.1.2
 Tomcat 6.0.13
 faces-config.xml:
   !DOCTYPE faces-config PUBLIC
   -//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN
   http://java.sun.com/dtd/web-facesconfig_1_1.dtd;
 web.xml:
   web-app version=2.4
 xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

 When I attempt to display the home page of the new project, I get a
 blank page. I have checked the tomcat logs and there are no complaints.
 The web page source from the page that is displayed consists only of:

 html lang=en

 /html

 Using Live HTTP Headers inside FireFox yielded nothing of interest as
 far as I can tell.

 Have I mixed incompatible components?

 If not does anyone have a suggestion short of debugging the JSF RI or
 tiles source on how I can track down what is happening?

  -= Gregg =-



   



signature.asc
Description: OpenPGP digital signature
---End Message---


Re: Any sucess with shale nightly 20070717 and RI JSF 1.2?

2007-07-25 Thread Gregg Leichtman
You are absolutely correct that the forum solution is Sun RI specific,
but I am (impatiently I admit) simply looking for a solution to develop
with JSF 1.2 now along with Shale and Tiles. MyFaces 1.2.0 currently has
EL problems (one of the MyFaces developers stated that these problems
should be fixed real soon in a patch release) that forced me over to
the Sun RI. I then ran into the problem mentioned below.

To get around these two difficulties, I have successfully updated the
code found in the forum link mentioned previously to display tiles using
the latest Sun JSF RI v1.2_04p2 code and at least the Tiles jar that
ships with Shale as of this date---tiles-core-2.0-r468346-SNAPSHOT. I
have not yet tried the latest Tiles 2.0.4 version with my modifications.

For those who wish to _experiment_ with JSF 1.2 here is the
TilesViewHandler class as I modified it. Clearly, the code is far from
production usable and I make no claims to it or its usability for any
purpose, but it does potentially provide a bridge, for me at least, to
use JSF 1.2 in my development effort while I wait for the production
version from the experts. :-)

-= Gregg =-

-- TilesViewHandler.java
package org.apache.shale.tiles;

import com.sun.faces.RIConstants;
import com.sun.faces.config.WebConfiguration;
import com.sun.faces.config.WebConfiguration.WebContextInitParameter;
import com.sun.faces.io.FastStringWriter;
import com.sun.faces.util.DebugUtil;
import com.sun.faces.util.MessageUtils;
import com.sun.faces.util.Util;
import com.sun.faces.application.InterweavingResponse;
//import com.sun.faces.application.ApplicationAssociate;
import com.sun.faces.application.ViewHandlerResponseWrapper;

import javax.faces.FacesException;
import javax.faces.FactoryFinder;
import javax.faces.application.StateManager;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
import javax.faces.render.ResponseStateManager;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.jstl.core.Config;


import java.io.IOException;
import java.io.Writer;

import java.text.MessageFormat;

import java.util.Iterator;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;


//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;

import org.apache.tiles.ComponentContext;
import org.apache.tiles.ComponentDefinition;
import org.apache.tiles.DefinitionsFactoryException;
import org.apache.tiles.NoSuchDefinitionException;
import org.apache.tiles.TilesRequestContext;
import org.apache.tiles.TilesUtil;
import org.apache.tiles.context.BasicTilesContextFactory;

public class TilesViewHandler extends ViewHandler {

// - Constructor


/**
* pStores the reference to the default view handler for later use./p
*
* @param defaultViewHandler The default view handler
*/
public TilesViewHandler(ViewHandler defaultViewHandler) {
this.defaultViewHandler = defaultViewHandler;
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,Created ViewHandler instance );
}
}

//  Static Variables


/**
* pcodeMessageFormat/code used to perform parameter substitution./p
*/
private MessageFormat format = new MessageFormat();


/**
* pLog instance for this class./p
*/
// private static final Log log = LogFactory.getLog(
// TilesViewHandler.class.getName());
/**
* pMessage resources for this class./p
*/
private static ResourceBundle bundle =
ResourceBundle.getBundle(org.apache.shale.tiles.Bundle,
Locale.getDefault(),
TilesViewHandler.class.getClassLoader());

/**
* pThe default JSF view handler./p
*/
private ViewHandler defaultViewHandler = null;


// - ViewHandler Methods

// Log instance for this class
private static final Logger logger = Util.getLogger(Util.FACES_LOGGER
+ Util.APPLICATION_LOGGER);

private static final String AFTER_VIEW_CONTENT = RIConstants.FACES_PREFIX+
AFTER_VIEW_CONTENT;

// private ApplicationAssociate associate;

/**
* pStore the value of codeDEFAULT_SUFFIX_PARAM_NAME/code
* or, if that isn't defined, the value of codeDEFAULT_SUFFIX/code
*/
private String contextDefaultSuffix;
private int bufSize = -1;

public String calculateRenderKitId(FacesContext context) {

if (context == null) {
String message = MessageUtils.getExceptionMessageString
(MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, context);
throw new NullPointerException(message);
}

MapString,String requestParamMap = context.getExternalContext()