mirror of https://github.com/apache/archiva.git
o fixed npe in dependency tree on artifact browse by adding the nodevar attribute dependencytree page
o removed PlexusTagUtil and lookup the dependency tree component in the tag using the webappcontext git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1137917 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c18ad9781
commit
c8617ac77e
|
@ -44,7 +44,7 @@ import java.util.List;
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* plexus.component role="org.apache.maven.archiva.web.tags.DependencyTree"
|
* plexus.component role="org.apache.maven.archiva.web.tags.DependencyTree"
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service( "dependencyTree" )
|
||||||
public class DependencyTree
|
public class DependencyTree
|
||||||
{
|
{
|
||||||
private Logger log = LoggerFactory.getLogger( DependencyTree.class );
|
private Logger log = LoggerFactory.getLogger( DependencyTree.class );
|
||||||
|
|
|
@ -19,13 +19,14 @@ package org.apache.maven.archiva.web.tags;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.IteratorUtils;
|
import org.apache.commons.collections.IteratorUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.common.ArchivaException;
|
import org.apache.maven.archiva.common.ArchivaException;
|
||||||
import org.apache.maven.archiva.web.tags.DependencyTree.TreeEntry;
|
import org.apache.maven.archiva.web.tags.DependencyTree.TreeEntry;
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
@ -113,9 +114,12 @@ public class DependencyTreeTag
|
||||||
DependencyTree deptree;
|
DependencyTree deptree;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
deptree = (DependencyTree) PlexusTagUtil.lookup( pageContext, DependencyTree.class );
|
WebApplicationContext webApplicationContext =
|
||||||
|
WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
|
||||||
|
|
||||||
|
deptree = ( DependencyTree ) webApplicationContext.getBean( "dependencyTree" );
|
||||||
}
|
}
|
||||||
catch ( PlexusSisuBridgeException e )
|
catch ( BeansException e )
|
||||||
{
|
{
|
||||||
throw new JspException( "Unable to lookup DependencyTree: " + e.getMessage(), e );
|
throw new JspException( "Unable to lookup DependencyTree: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package org.apache.maven.archiva.web.tags;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
|
||||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
import javax.servlet.jsp.PageContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlexusTagUtil
|
|
||||||
*
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PlexusTagUtil
|
|
||||||
{
|
|
||||||
public static Object lookup( PageContext pageContext, Class<?> clazz )
|
|
||||||
throws PlexusSisuBridgeException
|
|
||||||
{
|
|
||||||
return getContainer( pageContext ).lookup( clazz );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PlexusSisuBridge getContainer( PageContext pageContext )
|
|
||||||
{
|
|
||||||
ServletContext servletContext = pageContext.getServletContext();
|
|
||||||
|
|
||||||
WebApplicationContext webApplicationContext =
|
|
||||||
WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
|
|
||||||
|
|
||||||
return webApplicationContext.getBean( PlexusSisuBridge.class );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,7 +22,7 @@
|
||||||
<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>
|
<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>
|
||||||
|
|
||||||
<archiva:dependency-tree groupId="${groupId}" artifactId="${artifactId}" version="${version}"
|
<archiva:dependency-tree groupId="${groupId}" artifactId="${artifactId}" version="${version}"
|
||||||
modelVersion="${model.version}">
|
modelVersion="${model.version}" nodevar="node">
|
||||||
<my:showArtifactLink groupId="${node.groupId}" artifactId="${node.artifactId}"
|
<my:showArtifactLink groupId="${node.groupId}" artifactId="${node.artifactId}"
|
||||||
version="${node.version}"/>
|
version="${node.version}"/>
|
||||||
</archiva:dependency-tree>
|
</archiva:dependency-tree>
|
||||||
|
|
Loading…
Reference in New Issue