1 package org.apache.maven.archiva.web.tags;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import com.opensymphony.webwork.views.jsp.TagUtils;
24 import javax.servlet.jsp.JspException;
25 import javax.servlet.jsp.tagext.TagSupport;
30 * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
33 public class DownloadArtifactTag
36 private String groupId_; // stores EL-based groupId property
38 private String groupId; // stores the evaluated groupId object.
40 private String artifactId_; // stores EL-based artifactId property
42 private String artifactId; // stores the evaluated artifactId object.
44 private String version_; // stores EL-based version property
46 private String version; // stores the evaluated version object.
48 private String mini_; // stores EL-based mini property
50 private boolean mini; // stores the evaluated mini object.
55 evaluateExpressions();
57 DownloadArtifact download = new DownloadArtifact( TagUtils.getStack( pageContext ), pageContext );
58 download.setGroupId( groupId );
59 download.setArtifactId( artifactId );
60 download.setVersion( version );
61 download.setMini( mini );
63 download.end( pageContext.getOut(), "" );
65 return super.doEndTag();
68 private void evaluateExpressions()
71 ExpressionTool exprTool = new ExpressionTool( pageContext, this, "download" );
73 // Handle required properties.
74 groupId = exprTool.requiredString( "groupId", groupId_ );
75 artifactId = exprTool.requiredString( "artifactId", artifactId_ );
76 version = exprTool.requiredString( "version", version_ );
78 // Handle optional properties
79 mini = exprTool.optionalBoolean( "mini", mini_, false );
82 public void setArtifactId( String artifactId )
84 this.artifactId_ = artifactId;
87 public void setGroupId( String groupId )
89 this.groupId_ = groupId;
92 public void setVersion( String version )
94 this.version_ = version;