本文整理汇总了Java中org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext方法的典型用法代码示例。如果您正苦于以下问题:Java FacesContextUtils.getRequiredWebApplicationContext方法的具体用法?Java FacesContextUtils.getRequiredWebApplicationContext怎么用?Java FacesContextUtils.getRequiredWebApplicationContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.jsf.FacesContextUtils
的用法示例。
在下文中一共展示了FacesContextUtils.getRequiredWebApplicationContext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
NavigationBean nav =
(NavigationBean)FacesHelper.getManagedBean(facesContext, NavigationBean.BEAN_NAME);
// determine whether the workflow services are active
boolean workflowPresent = false;
WebApplicationContext springContext = FacesContextUtils.getRequiredWebApplicationContext(facesContext);
BPMEngineRegistry bpmReg = (BPMEngineRegistry)springContext.getBean(BPM_ENGINE_BEAN_NAME);
if (bpmReg != null)
{
String[] components = bpmReg.getWorkflowComponents();
workflowPresent = (components != null && components.length > 0);
}
return (workflowPresent && nav.getIsGuest() == false &&
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false);
}
示例2: logOut
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
/**
* Invalidate Alfresco ticket and Web/Portlet session and clear the Security context for this thread.
* @param context
*/
public static void logOut(FacesContext context)
{
String ticket = null;
if (Application.inPortalServer())
{
ticket = AlfrescoFacesPortlet.onLogOut(context.getExternalContext().getRequest());
}
else
{
SessionUser user = getCurrentUser(context);
if (user != null)
{
ticket = user.getTicket();
}
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
HttpSession session = request.getSession(false);
if (session != null)
{
session.invalidate();
}
}
// Explicitly invalidate the Alfresco ticket. This no longer happens on session expiry to allow for ticket
// 'sharing'
WebApplicationContext wc = FacesContextUtils.getRequiredWebApplicationContext(context);
AuthenticationService unprotAuthService = (AuthenticationService) wc.getBean(BEAN_UNPROTECTED_AUTH_SERVICE);
if (ticket != null)
{
unprotAuthService.invalidateTicket(ticket);
}
unprotAuthService.clearCurrentSecurityContext();
}
示例3: getDebugData
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
/**
* @see org.alfresco.web.ui.common.component.debug.BaseDebugComponent#getDebugData()
*/
@SuppressWarnings("unchecked")
public Map getDebugData()
{
// note: sort properties
Map properties = new TreeMap();
FacesContext fc = FacesContext.getCurrentInstance();
ServiceRegistry services = Repository.getServiceRegistry(fc);
DescriptorService descriptorService = services.getDescriptorService();
Descriptor installedRepoDescriptor = descriptorService.getInstalledRepositoryDescriptor();
properties.put("Installed Version", installedRepoDescriptor.getVersion());
properties.put("Installed Schema", installedRepoDescriptor.getSchema());
Descriptor systemDescriptor = descriptorService.getServerDescriptor();
properties.put("Server Version", systemDescriptor.getVersion());
properties.put("Server Schema", systemDescriptor.getSchema());
WebApplicationContext cx = FacesContextUtils.getRequiredWebApplicationContext(fc);
PatchService patchService = (PatchService)cx.getBean("PatchService");
List<AppliedPatch> patches = patchService.getPatches(null, null);
for (AppliedPatch patch : patches)
{
StringBuilder data = new StringBuilder(256);
data.append(patch.getAppliedOnDate())
.append(" - ")
.append(patch.getDescription())
.append(" - ")
.append(patch.getSucceeded() == true ?
Application.getMessage(fc, "repository_patch_succeeded") :
Application.getMessage(fc, "repository_patch_failed"));
properties.put(patch.getId(), data);
}
return properties;
}
示例4: getAsObject
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (!Strings.isNullOrEmpty(value)) {
WebApplicationContext applicationContext = FacesContextUtils.getRequiredWebApplicationContext(context);
DisciplinaRepository disciplinaRepository = applicationContext.getBean(DisciplinaRepository.class);
return disciplinaRepository.findOne(Long.valueOf(value)).get();
}
return null;
}
示例5: getWebApplicationContext
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
/**
* Retrieve the WebApplicationContext reference to expose.
* <p>The default implementation delegates to FacesContextUtils,
* returning {@code null} if no WebApplicationContext found.
* @param elContext the current JSF ELContext
* @return the Spring web application context
* @see org.springframework.web.jsf.FacesContextUtils#getWebApplicationContext
*/
protected WebApplicationContext getWebApplicationContext(ELContext elContext) {
FacesContext facesContext = FacesContext.getCurrentInstance();
return FacesContextUtils.getRequiredWebApplicationContext(facesContext);
}
示例6: getWebApplicationContext
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
/**
* Retrieve the web application context to delegate bean name resolution to.
* <p>The default implementation delegates to FacesContextUtils.
* @param elContext the current JSF ELContext
* @return the Spring web application context (never {@code null})
* @see org.springframework.web.jsf.FacesContextUtils#getRequiredWebApplicationContext
*/
protected WebApplicationContext getWebApplicationContext(ELContext elContext) {
FacesContext facesContext = FacesContext.getCurrentInstance();
return FacesContextUtils.getRequiredWebApplicationContext(facesContext);
}
示例7: resolveWebDAVPath
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
/**
* Resolves the given path elements to a NodeRef in the current repository
*
* @param context Faces context
* @param args The elements of the path to lookup
*/
public static NodeRef resolveWebDAVPath(FacesContext context, String[] args)
{
WebApplicationContext wc = FacesContextUtils.getRequiredWebApplicationContext(context);
return resolveWebDAVPath(wc, args, true);
}