First cut of the AJAX framework

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3327 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-07-14 19:08:42 +00:00
parent 521be49ef9
commit 9f0066637a
9 changed files with 6111 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
package org.alfresco.web.bean.ajax;
import java.io.IOException;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
/**
* Base class for all Ajax managed beans.
*
* It is not necessary to extend this bean but it provides
* helper methods.
*
* @author gavinc
*/
public abstract class BaseAjaxBean
{
private ResponseWriter writer;
/**
* Writes the given string to the response writer for this bean
*
* @param str The string to send back to the client
*/
public void write(String str)
{
try
{
getWriter().write(str);
}
catch (IOException ioe)
{
// not much we can do here, ignore
}
}
/**
* Returns the ResponseWriter for this bean
*
* @return The JSF ResponseWriter
*/
public ResponseWriter getWriter()
{
if (this.writer == null)
{
this.writer = FacesContext.getCurrentInstance().getResponseWriter();
}
return this.writer;
}
}