mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
51
source/java/org/alfresco/web/bean/ajax/BaseAjaxBean.java
Normal file
51
source/java/org/alfresco/web/bean/ajax/BaseAjaxBean.java
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user