package com.interwoven.livesite.runtime.controller.impl;import java.io.IOException;import javax.servlet.ServletOutputStream;import javax.servlet.http.HttpServletResponse;import com.interwoven.livesite.runtime.RequestContext;import com.interwoven.livesite.common.web.ForwardAction;import com.interwoven.livesite.common.web.URLRedirectForwardAction;public class test { /** * method that preforms a redirect * * @param context * runtime context * @return forward action */ public ForwardAction methodRedirect(RequestContext context) { return new URLRedirectForwardAction(context, context.getParameterString("redirectUrl")); } /** * Override output * * @param context * runtime context * @return forward action * @throws IOException * write exception */ public ForwardAction methodOutput(RequestContext context) throws IOException { ServletOutputStream output = context.getResponse().getOutputStream(); context.getResponse().setContentType("text/html"); context.getResponse().setStatus(HttpServletResponse.SC_OK); output.print("Output overridden, have a niceday."); output.flush(); return null; } /** * non-redirect work task * * @param context * runtime context * @return forward action */ public ForwardAction methodOne(RequestContext context) { System.out.println("methodOne called."); return null; } /** * non-redirect work task that uses component parameters * * @param context * runtime context * @return forward action */ public ForwardAction methodTwo(RequestContext context) { String p1 = context.getParameterString("parameter1"); String p2 = context.getParameterString("parameter2"); System.out.println("methodTwo called with '" + p1 + "' and '" + p2 + "'"); return null; }}
Hi, I am trying to implement the controller example with livesite 3.0. I have used the code above but I haven´t been able to made it work. I think the mistake is in the readMyFile method, Can you help me please to fix it? By the way, i am trying to preview the component, do I have to add it first to a page? Thanks in advance,