1313
1414public class CloudinaryUploadTag extends SimpleTagSupport {
1515
16- private String resourceType = "auto" ;
16+ // HTML basics
17+ private String id = null ;
18+ private String name = "file" ;
19+ private String extraClasses = null ;
20+
21+ // Cloudinary Specific
22+ private String tags = null ;
1723 private String fieldName ;
18- private String extraClasses ;
24+ private String resourceType = "auto" ;
1925
2026 public void doTag () throws JspException , IOException {
2127 Cloudinary cloudinary = Singleton .getCloudinary ();
@@ -29,10 +35,16 @@ public void doTag() throws JspException, IOException {
2935
3036 Map <String , String > attributes = new HashMap <String , String >();
3137 attributes .put ("type" , "file" );
32- attributes .put ("name" , "file" );
38+ attributes .put ("name" , name );
39+ if (id != null ) {
40+ attributes .put ("id" , id );
41+ }
3342
3443 Map <String , String > options = new HashMap <String , String >();
3544 options .put ("resource_type" , resourceType );
45+ if (tags != null ) {
46+ options .put ("tags" , tags );
47+ }
3648
3749 String cloudinaryUrl = cloudinary .cloudinaryApiUrl ("upload" , options );
3850
@@ -65,20 +77,20 @@ public void doTag() throws JspException, IOException {
6577 getJspContext ().getOut ().println (renderedHtml .toString ());
6678 }
6779
68- public void setResourceType (String resourceType ) {
69- this .resourceType = resourceType ;
80+ public void setId (String id ) {
81+ this .id = id ;
7082 }
7183
72- public String GetResourceType () {
73- return resourceType ;
84+ public String getId () {
85+ return id ;
7486 }
7587
76- public void setFieldName (String fieldName ) {
77- this .fieldName = fieldName ;
88+ public void setName (String name ) {
89+ this .name = name ;
7890 }
7991
80- public String getFieldName () {
81- return fieldName ;
92+ public String getName () {
93+ return name ;
8294 }
8395
8496 public void setExtraClasses (String extraClasses ) {
@@ -89,4 +101,28 @@ public String getExtraClasses() {
89101 return extraClasses ;
90102 }
91103
104+ public void setTags (String tags ) {
105+ this .tags = tags ;
106+ }
107+
108+ public String getTags () {
109+ return tags ;
110+ }
111+
112+ public void setFieldName (String fieldName ) {
113+ this .fieldName = fieldName ;
114+ }
115+
116+ public String getFieldName () {
117+ return fieldName ;
118+ }
119+
120+ public void setResourceType (String resourceType ) {
121+ this .resourceType = resourceType ;
122+ }
123+
124+ public String GetResourceType () {
125+ return resourceType ;
126+ }
127+
92128}
0 commit comments