1 25 26 package net.killingar.actions.wiki; 27 28 import com.portalwizard.silo.Version; 29 30 public class View extends WikiAction 31 { 32 public Version version; 33 public boolean setContentType = true; 34 35 public Version getVersion() { return version; } 36 public void setSetContentType(boolean in) { setContentType = in; } 37 public String getTitle() { return version == null? null: version.getTitle(); } 38 39 protected String doExecute() throws Exception 40 { 41 try 42 { 43 version = vm.get(getContext(), getWiki()); 44 45 if ("text/wiki".equals(version.getMimetype())) 46 return "wiki"; 47 if ("text/html-wiki".equals(version.getMimetype())) 48 return "htmlWiki"; 49 else 50 { 51 52 javax.servlet.http.HttpServletResponse response = webwork.action.ServletActionContext.getResponse(); 53 javax.servlet.http.HttpServletRequest req = webwork.action.ServletActionContext.getRequest(); 54 55 if (setContentType) 56 response.setContentType(version.getMimetype()); 57 58 response.getOutputStream().write(version.getContentBytes()); 59 60 64 return NONE; 65 } 66 } 67 catch (com.portalwizard.util.NotFoundException e) 68 { 69 return "notfound"; 70 } 71 catch (Exception e) 72 { 73 e.printStackTrace(); 74 addErrorMessage(e.toString()); 75 return ERROR; 76 } 77 } 78 } 79 | Popular Tags |