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 javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse;
24 import javax.servlet.jsp.JspException;
26 import org.apache.struts2.components.Component;
27 import org.apache.struts2.views.jsp.ComponentTagSupport;
29 import com.opensymphony.xwork2.util.ValueStack;
36 public class DownloadArtifactTag
37 extends ComponentTagSupport
39 private String groupId_; // stores EL-based groupId property
41 private String groupId; // stores the evaluated groupId object.
43 private String artifactId_; // stores EL-based artifactId property
45 private String artifactId; // stores the evaluated artifactId object.
47 private String version_; // stores EL-based version property
49 private String version; // stores the evaluated version object.
51 private String mini_; // stores EL-based mini property
53 private boolean mini; // stores the evaluated mini object.
56 public Component getBean(ValueStack valueStack, HttpServletRequest request, HttpServletResponse response) {
57 return new DownloadArtifact(valueStack, pageContext);
64 evaluateExpressions();
66 DownloadArtifact download = (DownloadArtifact)component;
67 download.setGroupId( groupId );
68 download.setArtifactId( artifactId );
69 download.setVersion( version );
70 download.setMini( mini );
72 return super.doEndTag();
75 private void evaluateExpressions()
78 ExpressionTool exprTool = new ExpressionTool( pageContext, this, "download" );
80 // Handle required properties.
81 groupId = exprTool.requiredString( "groupId", groupId_ );
82 artifactId = exprTool.requiredString( "artifactId", artifactId_ );
83 version = exprTool.requiredString( "version", version_ );
85 // Handle optional properties
86 mini = exprTool.optionalBoolean( "mini", mini_, false );
89 public void setArtifactId( String artifactId )
91 this.artifactId_ = artifactId;
94 public void setGroupId( String groupId )
96 this.groupId_ = groupId;
99 public void setVersion( String version )
101 this.version_ = version;