Interoperable interactive geometry for Europe
I forgot my login data

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

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.Method

public class DisplayerTool {

XWiki xwiki; Context context;

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

public String getFirstAttachmentDataAsBase64(Document doc) { Attachment att = doc.getAttachmentList().get(0); return new String((charapache.commons.codec.binary.Base64.encode Base64(att.content As Bytes)); }

public Object set Attachment(Document doc, String file Name, byte[? content) { if(content==null) throw new IllegalStateException("Can't have null content."); if(fileName==null) throw new IllegalStateException("Can't have null fileName."); if(doc==null) throw new IllegalStateException("Can't have null doc.");

Method method=doc.getClass().getDeclaredMethod("addAttachment", String.class, content.getClass()); method.setAccessible(true) System.out.println("Method: " + method);

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