Object fieldValue = TypeUtil.getFieldValue(object, fieldName); response.setContentType("text/plain"); response.setHeader("Content-Disposition ", "inline; filename=" + fieldName + ".txt"); PrintStream out = new PrintStream(response.getOutputStream()); out.print(fieldValue); out.flush();
WebConfig webConfig = (WebConfig) servletContext.getAttribute(Constants.WEBCONFIG);  FieldExporter fieldExporter = null;  Set classes = DynamicUtil.decomposeClass(object.getClass());  Iterator classIter = classes.iterator();  while (classIter.hasNext()) { Class c = (Class) classIter.next();  Type thisTypeConfig = (Type) webConfig.getTypes().get(c.getName());  FieldConfig fc = (FieldConfig) thisTypeConfig.getFieldConfigMap().get(fieldName);  if (fc != null) { String fieldExporterClassName = fc.getFieldExporter(); if (fieldExporterClassName != null) { fieldExporter = (FieldExporter) Class.forName(fieldExporterClassName).newInstance(); break; } } }  if (fieldExporter == null) { Object fieldValue = TypeUtil.getFieldValue(object, fieldName); response.setContentType("text/plain"); response.setHeader("Content-Disposition ", "inline; filename=" + fieldName + ".txt"); PrintStream out = new PrintStream(response.getOutputStream()); out.print(fieldValue); out.flush(); } else { fieldExporter.exportField(object, fieldName, os, response); }
    public ActionForward execute(ActionMapping mapping,                                 ActionForm form,                                 HttpServletRequest request,                                 HttpServletResponse response)        throws Exception {        HttpSession session = request.getSession();        ServletContext servletContext = session.getServletContext();        ObjectStore os = (ObjectStore) servletContext.getAttribute(Constants.OBJECTSTORE);        Integer objectId = new Integer(request.getParameter("object"));        String fieldName = request.getParameter("field");        InterMineObject object = os.getObjectById(objectId);        Object fieldValue = TypeUtil.getFieldValue(object, fieldName);        response.setContentType("text/plain");        response.setHeader("Content-Disposition ", "inline; filename=" + fieldName + ".txt");        PrintStream out = new PrintStream(response.getOutputStream());        out.print(fieldValue);        out.flush();        return null;    }