Interoperable interactive geometry for Europe
I forgot my login data
Register


Report a bug


Fan club

Quick Intro Videos
click to start movie
Create A Simple
GeoGebra Resource (25Mb)
click to start movie
Filing a review
click to start movie
Find a Resource

SPONSORS
This platform is brought to you by the intergeo project, funded under the eContent Plus programme of the European commission and by partners

import com.xpn.xwiki.api.XWiki import com.xpn.xwiki.api.Context import com.xpn.xwiki.api.Document import com.xpn.xwiki.api.Attachment import java.lang.reflect.*;

public class TryIt2 {

XWiki xwiki; Context context;

public void init(XWiki xwiki, Context context) { this.xwiki = xwiki; this.context = context; }

public Object setAttachment(Document doc, String fileName, byte] content) { byte[? b = new byte2?; Method method=doc.getClass().getDeclaredMethod("addAttachment", String.class, b.getClass()); System.out.println("method is ${method} of class ${method.getClass()}.") method.setAccessible(true)

def attachment= method.invoke(doc, fileName,content); System.out.println("Attachment: ${attachment}.");

doc.saveWithProgrammingRights("TryIt") return attachment; }

}