List of usage examples for javax.activation DataHandler getBean
public Object getBean(CommandInfo cmdinfo)
From source file:MultipartViewer.java
protected Component getComponent(BodyPart bp) { try {//from w ww . j ava 2s. c o m DataHandler dh = bp.getDataHandler(); CommandInfo ci = dh.getCommand("view"); if (ci == null) { throw new MessagingException("view command failed on: " + bp.getContentType()); } Object bean = dh.getBean(ci); if (bean instanceof Component) { return (Component) bean; } else { if (bean == null) throw new MessagingException( "bean is null, class " + ci.getCommandClass() + " , command " + ci.getCommandName()); else throw new MessagingException("bean is not a awt.Component" + bean.getClass().toString()); } } catch (MessagingException me) { return new Label(me.toString()); } }
From source file:MessageViewer.java
protected Component getBodyComponent() { //------------ // now get a content viewer for the main type... //------------ try {/*w w w .ja v a2 s.c o m*/ DataHandler dh = displayed.getDataHandler(); CommandInfo ci = dh.getCommand("view"); if (ci == null) { throw new MessagingException("view command failed on: " + displayed.getContentType()); } Object bean = dh.getBean(ci); if (bean instanceof Component) { return (Component) bean; } else { throw new MessagingException("bean is not a component " + bean.getClass().toString()); } } catch (MessagingException me) { return new Label(me.toString()); } }