本文整理汇总了Java中org.jpublish.SiteContext类的典型用法代码示例。如果您正苦于以下问题:Java SiteContext类的具体用法?Java SiteContext怎么用?Java SiteContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SiteContext类属于org.jpublish包,在下文中一共展示了SiteContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* Execute the action using the given context.
*
* @param context The current context
* @param configuration The configuration
* @throws Exception Any error
*/
public void execute(JPublishContext context, Configuration configuration) throws Exception {
boolean scriptOrPathActionWrapper = action.getClass().getName()
.indexOf(ActionManager.SCRIPT_ACTION) >= 0 || action.getClass().getName()
.indexOf(ActionManager.PATH_ACTION) >= 0;
try {
if (SiteContext.getProfiling() && !scriptOrPathActionWrapper) {
UtilTimerStack.push(action.getClass().getName());
}
action.execute(context, configuration);
} finally {
if (SiteContext.getProfiling() && !scriptOrPathActionWrapper) {
UtilTimerStack.pop(action.getClass().getName());
}
}
}
示例2: execute
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* Execute the action using the given context.
*
* @param context The current JPublish context
* @throws Exception Any Exception
*/
public void execute(JPublishContext context) throws Exception {
boolean scriptOrPathActionWrapper = action.getClass().getName()
.indexOf(ActionManager.SCRIPT_ACTION) >= 0 || action.getClass().getName()
.indexOf(ActionManager.PATH_ACTION) >=0;
try {
if (SiteContext.getProfiling() && !scriptOrPathActionWrapper) {
UtilTimerStack.push(action.getClass().getName());
}
action.execute(context, configuration);
} finally {
if (SiteContext.getProfiling() && !scriptOrPathActionWrapper) {
UtilTimerStack.pop(action.getClass().getName());
}
}
}
示例3: init
import org.jpublish.SiteContext; //导入依赖的package包/类
public void init(SiteContext site, Configuration configuration) throws Exception {
this.site = site;
this.configuration = configuration;
requestProcessorAttribute = configuration.getChildValue("requestProcessorAttribute");
path = configuration.getChildValue("path", "/wink/*");
RequestProcessor requestProcessor = getRequestProcessor();
if (requestProcessor == null) {
// create the request processor
requestProcessor = createRequestProcessor();
if (requestProcessor == null) {
throw new IllegalStateException("Request processor could not be created.");
}
storeRequestProcessorOnServletContext(requestProcessor);
}
site.getActionManager().getPathActions().add(
new ActionWrapper(
new PathAction(path, new JPWinkAction(this)), configuration) );
log.info(String.format("**** %s is mapped on: %s", NAME, path));
log.info(this.toString() + " is ready.");
}
示例4: get
import org.jpublish.SiteContext; //导入依赖的package包/类
/** Get the specified component.
@param id The component ID
@throws Exception
*/
public ComponentWrapper get(String id) throws Exception{
SiteContext siteContext = (SiteContext)context.get(
JPublishContext.JPUBLISH_SITE);
JPublishComponent component =
siteContext.getComponentManager().getComponent(id);
return new ComponentWrapper(component, context);
}
示例5: PageDefinition
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* Construct a new PageDefinition for the given path.
*
* @param siteContext The SiteContext
* @param path The definition path
*/
public PageDefinition(SiteContext siteContext, String path) {
this.siteContext = siteContext;
this.path = path;
pageCache = new HashMap();
}
示例6: PageInstance
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* Construct a new Page for the given path. The name of the page is
* the last part of the path (i.e. the file component) without the
* dot ending. The page type is the dot-ending.
*
* @param siteContext The SiteContext
* @param path The request path
* @param pageName The name of the page
* @param pageType The page type
*/
public PageInstance(SiteContext siteContext, String path, String pageName, String pageType) {
this.siteContext = siteContext;
this.path = path;
this.pageName = pageName;
this.pageType = pageType;
this.pageActions = new ArrayList();
this.templateName = siteContext.getDefaultTemplate();
this.properties = new HashMap();
}
示例7: ActionManager
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* Construct a new ActionManager with the given SiteContext.
*
* @param siteContext The SiteContext
*/
public ActionManager(SiteContext siteContext) {
this.siteContext = siteContext;
this.definedActions = new HashMap();
this.startupActions = new ArrayList();
this.shutdownActions = new ArrayList();
this.globalActions = new ArrayList();
this.pathActions = new ArrayList();
this.preEvaluationActions = new ArrayList();
this.postEvaluationActions = new ArrayList();
this.classPathElements = new ArrayList();
this.startupContext = new JPublishContext(null);
// add the DateUtilities to the context
this.startupContext.put(JPublishContext.JPUBLISH_DATE_UTILITIES, DateUtilities.getInstance());
// add the NumberUtilities to the context
this.startupContext.put(JPublishContext.JPUBLISH_NUMBER_UTILITIES, NumberUtilities.getInstance());
// add the messages log to the context
this.startupContext.put(JPublishContext.JPUBLISH_SYSLOG, SiteContext.syslog);
// expose the SiteContext
this.startupContext.put(JPublishContext.JPUBLISH_SITE, siteContext);
//todo: What else do we need in the startupContext?
}
示例8: ScriptAction
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* Construct a new ScriptAction for the given script.
*
* @param siteContext The SiteContext
* @param script The file representing the script
*/
public ScriptAction(SiteContext siteContext, File script) {
this.siteContext = siteContext;
this.script = script;
if (log.isDebugEnabled())
log.debug("Creating new ScriptAction for " + script.getName());
}
示例9: DWRJPublishActionManager
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* @param site the JPublish siteContext object
* @param actionName a String containing a valid actionName. The Action is expected to
* be registered with the JPublish framework
* @throws InstantiationException if the site or the actionName are null or contains invalid values
*/
public DWRJPublishActionManager(SiteContext site, String actionName) throws InstantiationException {
if (site == null)
throw new InstantiationException("The JPublish siteContext cannot be null!");
if (actionName == null || actionName.trim().length() == 0)
throw new InstantiationException("The Action name cannot be null or empty!");
this.site = site;
this.actionName = actionName;
}
示例10: newContextForAction
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* create a new mini-JPublish context
*
* @param dwrContext the WebContext created by the DWR
* @return a new JPublish context
*/
private JPublishContext newContextForAction(WebContext dwrContext) {
JPublishContext context = new JPublishContext(this);
context.disableCheckReservedNames(this);
context.put(JPublishContext.JPUBLISH_REQUEST, dwrContext.getHttpServletRequest());
context.put(JPublishContext.JPUBLISH_RESPONSE, dwrContext.getHttpServletResponse());
context.put(JPublishContext.JPUBLISH_SESSION, dwrContext.getSession());
context.put(JPublishCreator.APPLICATION, site.getServletContext());
// add the character encoding map to the context
context.put(JPublishContext.JPUBLISH_CHARACTER_ENCODING_MAP, site.getCharacterEncodingManager().getDefaultMap());
// add the URLUtilities to the context
URLUtilities urlUtilities = new URLUtilities(dwrContext.getHttpServletRequest(),
dwrContext.getHttpServletResponse());
context.put(JPublishContext.JPUBLISH_URL_UTILITIES, urlUtilities);
// add the DateUtilities to the context
context.put(JPublishContext.JPUBLISH_DATE_UTILITIES, DateUtilities.getInstance());
// add the NumberUtilities to the context
context.put(JPublishContext.JPUBLISH_NUMBER_UTILITIES, NumberUtilities.getInstance());
// add the messages log to the context
context.put(JPublishContext.JPUBLISH_SYSLOG, SiteContext.syslog);
// expose the SiteContext
context.put(JPublishContext.JPUBLISH_SITE, site);
return context;
}
示例11: init
import org.jpublish.SiteContext; //导入依赖的package包/类
public void init(SiteContext site, Configuration configuration) throws Exception {
this.site = site;
infoDetails.add("*** Module: RestLikePathActions (RPA) initializing ...");
if (configuration != null) {
load(configuration);
} else {
log.warn(" No configuration specified; module disabled.");
}
}
示例12: init
import org.jpublish.SiteContext; //导入依赖的package包/类
public void init(SiteContext site, Configuration configuration) throws Exception {
log.info(NAME + " starting for: " + site.getServletContext().getServletContextName());
this.site = site;
String restletConfigPath = configuration.getChildValue("restlet-config", "WEB-INF/jprestlet-config.xml");
//legacy parameter
if (configuration.getChildValue("url") != null) {
restJPublishURLS.add(
configuration.getChildValue("url", JPUBLISH_DEFAULT_REST_URL));
}
if (configuration.getChild("urls") != null) {
List restURLSConfig = configuration.getChild("urls").getChildren();
for (int i = 0; restURLSConfig != null && i < restURLSConfig.size(); i++) {
Configuration urlConfig = (Configuration) restURLSConfig.get(i);
restJPublishURLS.add(urlConfig.getValue(JPUBLISH_DEFAULT_REST_URL));
}
}
log.info("Initializing the " + this.toString() + " framework from: " + restletConfigPath);
this.converter = new ServletConverter(site.getServletContext());
initJPRestlet(restletConfigPath);
log.info("Mapping JPRestlet for all calls on: ");
//map JPRestletModule as a pth-action
for (String url : restJPublishURLS) {
site.getActionManager().getPathActions().add(
new ActionWrapper(
new PathAction(url, new JPRestletAction(this)), configuration)
);
log.info(" " + url);
}
log.info(this.toString() + " is ready.");
}
示例13: setSiteContext
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* @see org.jpublish.view.ViewRenderer#setSiteContext(org.jpublish.SiteContext)
*/
public void setSiteContext(SiteContext siteContext) {
this.siteContext = siteContext;
this.renderers = new HashMap();
try {
loadCustom();
} catch (Exception e) {
Debug.logError(e, "Problems loading custom settings", module);
throw new RuntimeException(e.toString());
}
}
示例14: setSiteContext
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* Set the SiteContext.
*
* @param siteContext The SiteContext
*/
public void setSiteContext(SiteContext siteContext) {
log.debug("setSiteContext()");
this.siteContext = siteContext;
}
示例15: commonInit
import org.jpublish.SiteContext; //导入依赖的package包/类
/**
* Common init method for ResourceLoaders.
*
* @param rs The RuntimeServices
* @param configuration The configuration
*/
public void commonInit(RuntimeServices rs, ExtendedProperties configuration) {
if (log.isDebugEnabled())
log.debug("commonInit()");
super.commonInit(rs, configuration);
Object siteContext = rs.getProperty("jpublish.resource.loader.siteContext");
if (log.isDebugEnabled())
log.debug("SiteContext from rs: " + siteContext);
if (siteContext == null) {
siteContext = configuration.get("jpublish.resource.loader.siteContext");
if (log.isDebugEnabled())
log.debug("SiteContext from configuration: " + siteContext);
}
setSiteContext((SiteContext) siteContext);
}