本文整理汇总了Java中org.apache.struts.tiles.ComponentDefinition类的典型用法代码示例。如果您正苦于以下问题:Java ComponentDefinition类的具体用法?Java ComponentDefinition怎么用?Java ComponentDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentDefinition类属于org.apache.struts.tiles包,在下文中一共展示了ComponentDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processAsDefinitionOrURL
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Try to process name as a definition, or as an URL if not found.
* @param name Name to process.
* @return appropriate TagHandler
* @throws JspException InstantiationException Can't create requested controller
*/
public TagHandler processAsDefinitionOrURL(String name)
throws JspException {
try {
ComponentDefinition definition =
TilesUtil.getDefinition(
name,
pageContext.getRequest(),
pageContext.getServletContext());
if (definition != null) {
return processDefinition(definition);
}
} catch (DefinitionsFactoryException ex) {
// silently failed, because we can choose to not define a factory.
}
// no definition found, try as url
return processUrl(name);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:InsertTag.java
示例2: processTypedAttribute
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Process typed attribute according to its type.
* @param value Typed attribute to process.
* @return appropriate TagHandler.
* @throws JspException - Throws by underlying nested call to processDefinitionName()
*/
public TagHandler processTypedAttribute(AttributeDefinition value)
throws JspException {
if (value instanceof DirectStringAttribute) {
return new DirectStringHandler((String) value.getValue());
} else if (value instanceof DefinitionAttribute) {
return processDefinition((ComponentDefinition) value.getValue());
} else if (value instanceof DefinitionNameAttribute) {
return processDefinitionName((String) value.getValue());
}
return new InsertHandler(
(String) value.getValue(),
role,
getController());
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:InsertTag.java
示例3: DefinitionsFactory
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Constructor.
* Create a factory initialized with definitions from {@link XmlDefinitionsSet}.
* @param xmlDefinitions Resolved definition from XmlDefinitionSet.
* @throws NoSuchDefinitionException If an error occurs while resolving inheritance
*/
public DefinitionsFactory(XmlDefinitionsSet xmlDefinitions)
throws NoSuchDefinitionException
{
definitions = new HashMap();
// First, resolve inheritance
xmlDefinitions.resolveInheritances();
// Walk thru xml set and copy each definitions.
Iterator i = xmlDefinitions.getDefinitions().values().iterator();
while( i.hasNext() )
{
XmlDefinition xmlDefinition = (XmlDefinition)i.next();
putDefinition( new ComponentDefinition( xmlDefinition) );
} // end loop
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:DefinitionsFactory.java
示例4: processAsDefinitionOrURL
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Try to process name as a definition, or as an URL if not found.
* @param name Name to process.
* @return appropriate TagHandler
* @throws JspException InstantiationException Can't create requested controller
*/
public TagHandler processAsDefinitionOrURL(String name)
throws JspException {
try {
ComponentDefinition definition =
TilesUtil.getDefinition(
name,
pageContext.getRequest(),
pageContext.getServletContext());
if (definition != null) {
return processDefinition(definition);
}
} catch (DefinitionsFactoryException ex) {
// silently failed, because we can choose to not define a factory.
}
// no definition found, try as url
return processUrl(name);
}
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:27,代码来源:InsertTag.java
示例5: processTypedAttribute
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Process typed attribute according to its type.
* @param value Typed attribute to process.
* @return appropriate TagHandler.
* @throws JspException - Throws by underlying nested call to processDefinitionName()
*/
public TagHandler processTypedAttribute(AttributeDefinition value)
throws JspException {
if (value instanceof DirectStringAttribute) {
return new DirectStringHandler((String) value.getValue());
} else if (value instanceof DefinitionAttribute) {
return processDefinition((ComponentDefinition) value.getValue());
} else if (value instanceof DefinitionNameAttribute) {
return processDefinitionName((String) value.getValue());
}
return new InsertHandler(
(String) value.getValue(),
role,
getController());
}
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:24,代码来源:InsertTag.java
示例6: getController
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Get instantiated Controller.
* Return controller denoted by controllerType, or <code>null</code> if controllerType
* is null.
* @throws JspException If controller can't be created.
*/
private Controller getController() throws JspException {
if (controllerType == null) {
return null;
}
try {
return ComponentDefinition.createController(
controllerName,
controllerType);
} catch (InstantiationException ex) {
throw new JspException(ex.getMessage());
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:InsertTag.java
示例7: processObjectValue
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Process an object retrieved as a bean or attribute.
* Object can be a typed attribute, a String, or anything else.
* If typed attribute, use associated type.
* Otherwise, apply toString() on object, and use returned string as a name.
* @throws JspException - Throws by underlying nested call to
* processDefinitionName()
*/
public TagHandler processObjectValue(Object value) throws JspException {
// First, check if value is one of the Typed Attribute
if (value instanceof AttributeDefinition) {
// We have a type => return appropriate IncludeType
return processTypedAttribute((AttributeDefinition) value);
} else if (value instanceof ComponentDefinition) {
return processDefinition((ComponentDefinition) value);
}
// Value must denote a valid String
return processAsDefinitionOrURL(value.toString());
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:InsertTag.java
示例8: processDefinition
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* End of Process tag attribute "definition".
* Overload definition with tag attributes "template" and "role".
* Then, create appropriate tag handler.
* @param definition Definition to process.
* @return Appropriate TagHandler.
* @throws JspException InstantiationException Can't create requested controller
*/
protected TagHandler processDefinition(ComponentDefinition definition)
throws JspException {
// Declare local variable in order to not change Tag attribute values.
String role = this.role;
String page = this.page;
Controller controller = null;
try {
controller = definition.getOrCreateController();
// Overload definition with tag's template and role.
if (role == null) {
role = definition.getRole();
}
if (page == null) {
page = definition.getTemplate();
}
if (controllerName != null) {
controller =
ComponentDefinition.createController(
controllerName,
controllerType);
}
// Can check if page is set
return new InsertHandler(
definition.getAttributes(),
page,
role,
controller);
} catch (InstantiationException ex) {
throw new JspException(ex.getMessage());
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:InsertTag.java
示例9: getDefinition
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Get a definition by its name.
* Call appropriate method on underlying factory instance.
* Throw appropriate exception if definition or definition factory is not found.
* @param definitionName Name of requested definition.
* @param request Current servlet request.
* @param servletContext Current servlet context.
* @throws FactoryNotFoundException Can't find definition factory.
* @throws DefinitionsFactoryException General error in factory while getting definition.
*/
public ComponentDefinition getDefinition(
String definitionName,
ServletRequest request,
ServletContext servletContext)
throws FactoryNotFoundException, DefinitionsFactoryException {
return factory.getDefinition(
definitionName,
(HttpServletRequest) request,
servletContext);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:ReloadableDefinitionsFactory.java
示例10: getDefinition
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Get requested definition.
* @param name Name of the definition.
* @param request The request we are processing.
* @param servletContext Our servlet context.
* @return ComponentDefition
*/
public ComponentDefinition getDefinition(
String name,
ServletRequest request,
ServletContext servletContext)
throws NoSuchDefinitionException, DefinitionsFactoryException {
return factory.getDefinition(name, request, servletContext);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:ComponentDefinitionsFactoryWrapper.java
示例11: getDefinition
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Get a definition by its name.
*
* @param name Name of requested definition.
* @param request Current servlet request.
* @param servletContext Current servlet context.
* @throws NoSuchDefinitionException No definition found for specified name
* @throws DefinitionsFactoryException General exception
*/
public ComponentDefinition getDefinition(String name, ServletRequest request, ServletContext servletContext)
throws NoSuchDefinitionException, DefinitionsFactoryException
{
if( factories == null )
throw new FactoryNotFoundException( "No definitions factory defined" );
Object key = getDefinitionsFactoryKey( name, request, servletContext);
DefinitionsFactory factory = getFactory( key, request, servletContext);
return factory.getDefinition( name, request, servletContext );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:FactorySet.java
示例12: getController
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Get instantiated Controller.
* Return controller denoted by controllerType, or <code>null</code> if controllerType
* is null.
* @throws JspException If controller can't be created.
*/
private Controller getController() throws JspException {
if (controllerType == null) {
return null;
}
try {
return ComponentDefinition.createController(
controllerName,
controllerType);
} catch (InstantiationException ex) {
throw new JspException(ex);
}
}
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:21,代码来源:InsertTag.java
示例13: processObjectValue
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Process an object retrieved as a bean or attribute.
* Object can be a typed attribute, a String, or anything else.
* If typed attribute, use associated type.
* Otherwise, apply toString() on object, and use returned string as a name.
* @throws JspException - Throws by underlying nested call to
* processDefinitionName()
*/
public TagHandler processObjectValue(Object value) throws JspException {
// First, check if value is one of the Typed Attribute
if (value instanceof AttributeDefinition) {
// We have a type => return appropriate IncludeType
return processTypedAttribute((AttributeDefinition) value);
} else if (value instanceof ComponentDefinition) {
return processDefinition((ComponentDefinition) value);
}
// Value must denote a valid String
return processAsDefinitionOrURL(value.toString());
}
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:22,代码来源:InsertTag.java
示例14: processDefinition
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* End of Process tag attribute "definition".
* Overload definition with tag attributes "template" and "role".
* Then, create appropriate tag handler.
* @param definition Definition to process.
* @return Appropriate TagHandler.
* @throws JspException InstantiationException Can't create requested controller
*/
protected TagHandler processDefinition(ComponentDefinition definition)
throws JspException {
// Declare local variable in order to not change Tag attribute values.
String role = this.role;
String page = this.page;
Controller controller = null;
try {
controller = definition.getOrCreateController();
// Overload definition with tag's template and role.
if (role == null) {
role = definition.getRole();
}
if (page == null) {
page = definition.getTemplate();
}
if (controllerName != null) {
controller =
ComponentDefinition.createController(
controllerName,
controllerType);
}
// Can check if page is set
return new InsertHandler(
definition.getAttributes(),
page,
role,
controller);
} catch (InstantiationException ex) {
throw new JspException(ex);
}
}
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:46,代码来源:InsertTag.java
示例15: prepareForRendering
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Prepare for rendering the Tiles definition: Execute the associated
* component controller if any, and determine the request dispatcher path.
*/
@Override
protected String prepareForRendering(HttpServletRequest request, HttpServletResponse response)
throws Exception {
// get component definition
ComponentDefinition definition = getComponentDefinition(this.definitionsFactory, request);
if (definition == null) {
throw new ServletException("No Tiles definition found for name '" + getUrl() + "'");
}
// get current component context
ComponentContext context = getComponentContext(definition, request);
// execute component controller associated with definition, if any
Controller controller = getController(definition, request);
if (controller != null) {
if (logger.isDebugEnabled()) {
logger.debug("Executing Tiles controller [" + controller + "]");
}
executeController(controller, context, request, response);
}
// determine the path of the definition
String path = getDispatcherPath(definition, request);
if (path == null) {
throw new ServletException(
"Could not determine a path for Tiles definition '" + definition.getName() + "'");
}
return path;
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:36,代码来源:TilesView.java
示例16: getComponentContext
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Determine the Tiles component context for the given Tiles definition.
* @param definition the Tiles definition to render
* @param request current HTTP request
* @return the component context
* @throws Exception if preparations failed
*/
protected ComponentContext getComponentContext(ComponentDefinition definition, HttpServletRequest request)
throws Exception {
ComponentContext context = ComponentContext.getContext(request);
if (context == null) {
context = new ComponentContext(definition.getAttributes());
ComponentContext.setContext(context, request);
}
else {
context.addMissing(definition.getAttributes());
}
return context;
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:20,代码来源:TilesView.java
示例17: putDefinition
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Put definition in set.
* @param definition Definition to put.
*/
public void putDefinition(ComponentDefinition definition)
{
definitions.put( definition.getName(), definition );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:DefinitionsFactory.java
示例18: getDispatcherPath
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Determine the dispatcher path for the given Tiles definition,
* i.e. the request dispatcher path of the layout page.
* @param definition the Tiles definition to render
* @param request current HTTP request
* @return the path of the layout page to render
* @throws Exception if preparations failed
*/
protected String getDispatcherPath(ComponentDefinition definition, HttpServletRequest request)
throws Exception {
Object pathAttr = request.getAttribute(PATH_ATTRIBUTE);
return (pathAttr != null ? pathAttr.toString() : definition.getPath());
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:15,代码来源:TilesView.java
示例19: getDefinition
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Get a definition by its name.
* @param name Name of the definition.
* @param request Servlet request.
* @param servletContext Servlet context.
* @throws DefinitionsFactoryException An error occur while getting
* definition.
* @throws NoSuchDefinitionException No definition found for specified name
* Implementation can throw more accurate exception as a subclass of this
* exception.
*/
public ComponentDefinition getDefinition(String name, ServletRequest request, ServletContext servletContext)
throws NoSuchDefinitionException, DefinitionsFactoryException
{
return (ComponentDefinition)definitions.get(name);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:DefinitionsFactory.java
示例20: getComponentDefinition
import org.apache.struts.tiles.ComponentDefinition; //导入依赖的package包/类
/**
* Determine the Tiles component definition for the given Tiles
* definitions factory.
* @param factory the Tiles definitions factory
* @param request current HTTP request
* @return the component definition
*/
protected ComponentDefinition getComponentDefinition(DefinitionsFactory factory, HttpServletRequest request)
throws Exception {
return factory.getDefinition(getUrl(), request, getServletContext());
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:12,代码来源:TilesView.java
注:本文中的org.apache.struts.tiles.ComponentDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论