mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3327 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
52 lines
1.0 KiB
Java
52 lines
1.0 KiB
Java
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;
|
|
}
|
|
}
|