webcontextservice.java

来自「一个实用工具类」· Java 代码 · 共 68 行

JAVA
68
字号
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file.  */package org.butor.web.context;import org.butor.fwService.FwService;import org.butor.fwService.IFwServiceImpl;/** *  * @author Aiman SAWAN */public abstract class WebContextService {	protected static FwService fwService = new FwService(WebContextService.class);	public static boolean isImplCompatible(IFwServiceImpl impl) {		return (impl instanceof IWebContextService); 	}	public static String getServiceName() {		return WebContextService.class.getName();	}	public static void registerImpl(IFwServiceImpl impl) {		fwService.registerImpl(impl);	}	public static void unregisterImpl(IFwServiceImpl impl) {		fwService.unregisterImpl(impl);	}	protected static IWebContextService getImpl(String calledMethod) {		return (IWebContextService)fwService.getImpl(calledMethod);	}	/**	 * get the context related to the working thread	 */	public static void releaseContext() {		IWebContextService impl = getImpl("releaseContext()");		if (null != impl) {			impl.releaseContext();		}	}	/**	 * release the context related to the working thread	 * @return IContext.	 */	public static IWebContext getContext() {		IWebContextService impl = getImpl("getContext()");		if (null != impl) {			return impl.getContext();		}		return null;	}	/**	 * set the context related to the working thread	 */	public static void setContext(IWebContext context) {		IWebContextService impl = getImpl("setContext()");		if (null != impl) {			impl.setContext(context);		}	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?