1 package org.infoglue.deliver.taglib.content; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 import java.util.Map ; 6 7 import javax.servlet.jsp.JspException ; 8 import javax.servlet.jsp.JspTagException ; 9 10 import org.infoglue.cms.security.InfoGluePrincipal; 11 import org.infoglue.deliver.taglib.TemplateControllerTag; 12 import org.infoglue.deliver.util.webservices.DynamicWebservice; 13 14 15 18 19 public class RemoteContentServiceTag extends TemplateControllerTag 20 { 21 24 private static final long serialVersionUID = -1904980538720103871L; 25 26 29 private List contents = new ArrayList (); 30 31 34 private String name; 35 36 39 private String targetEndpointAddress; 40 41 44 private String operationName; 45 46 49 private InfoGluePrincipal principal; 50 51 54 public RemoteContentServiceTag() 55 { 56 super(); 57 } 58 59 65 public int doStartTag() throws JspException 66 { 67 return EVAL_BODY_INCLUDE; 68 } 69 70 73 public int doEndTag() throws JspException 74 { 75 try 76 { 77 if(this.principal == null) 78 this.principal = this.getController().getPrincipal(); 79 80 final DynamicWebservice ws = new DynamicWebservice(principal); 81 82 ws.setTargetEndpointAddress(targetEndpointAddress); 83 ws.setOperationName(operationName); 84 ws.setReturnType(Boolean .class); 85 86 91 ws.addArgument("contents", contents); 92 93 ws.callService(); 94 setResultAttribute(ws.getResult()); 95 } 96 catch(Exception e) 97 { 98 e.printStackTrace(); 99 throw new JspTagException (e.getMessage()); 100 } 101 102 contents.clear(); 103 104 return EVAL_PAGE; 105 } 106 107 110 public void setTargetEndpointAddress(final String targetEndpointAddress) throws JspException 111 { 112 this.targetEndpointAddress = evaluateString("remoteContentService", "targetEndpointAddress", targetEndpointAddress); 113 } 114 115 118 public void setOperationName(final String operationName) 119 { 120 this.operationName = operationName; 121 } 122 123 126 public void setPrincipal(final String principalString) throws JspException 127 { 128 this.principal = (InfoGluePrincipal) this.evaluate("remoteContentService", "principal", principalString, InfoGluePrincipal.class); 129 } 130 131 134 143 144 147 public void addContentMap(final Map contentMap) 148 { 149 this.contents.add(contentMap); 150 } 151 152 } | Popular Tags |