当前位置: 首页>>代码示例>>Java>>正文


Java SiteContext类代码示例

本文整理汇总了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());
        }
    }
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:25,代码来源:PathAction.java

示例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());
        }
    }
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:23,代码来源:ActionWrapper.java

示例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.");
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:24,代码来源:JPWinkModule.java

示例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);
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:14,代码来源:ComponentMap.java

示例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();
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:14,代码来源:PageDefinition.java

示例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();
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:21,代码来源:PageInstance.java

示例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?

}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:34,代码来源:ActionManager.java

示例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());
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:14,代码来源:ScriptAction.java

示例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;
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:17,代码来源:DWRJPublishActionManager.java

示例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;
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:36,代码来源:DWRJPublishActionManager.java

示例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.");
    }
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:11,代码来源:RestPathActionsModule.java

示例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.");
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:37,代码来源:JPRestletModule.java

示例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());
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:14,代码来源:GenericViewRenderer.java

示例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;
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:11,代码来源:VelocityViewRenderer.java

示例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);
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:28,代码来源:JPublishResourceLoader.java


注:本文中的org.jpublish.SiteContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。