Blame | Last modification | View Log | RSS feed
/****/package in.shop2020.serving.controllers;import java.io.IOException;import javax.servlet.ServletContext;import org.apache.juli.logging.Log;import org.apache.juli.logging.LogFactory;import org.apache.struts2.convention.annotation.Result;import org.apache.struts2.convention.annotation.Results;import org.apache.struts2.rest.DefaultHttpHeaders;import org.apache.struts2.rest.HttpHeaders;import org.apache.struts2.util.ServletContextAware;import com.opensymphony.xwork2.ModelDriven;/**** @author naveen**/@Results({@Result(name="success", type="redirectAction", params = {"actionName" ,"entity"})})public class EntityController extends BaseControllerimplements ModelDriven<Object>, ServletContextAware {/****/private static Log log = LogFactory.getLog(EntityController.class);/****/@SuppressWarnings("unused")private ServletContext servletContext = null;/****/private String id;// GET /entity/1000001public HttpHeaders show() throws SecurityException, IOException {log.info("id=" + id);/*String contextPath = this.servletContext.getContextPath();log.info("contextPath=" + contextPath);String realPath = this.servletContext.getRealPath("/");log.info("realPath=" + realPath);String path = this.servletContext.getRealPath("/WEB-INF/testdir/test.txt");log.info("path=" + path);FileReader fr = new FileReader(new File(path));LineNumberReader lnr = new LineNumberReader(fr);String line = lnr.readLine();log.info("line=" + line);*/return new DefaultHttpHeaders("show");}/**** @param id*/public void setId(String id) {this.id = id;}/* (non-Javadoc)* @see com.opensymphony.xwork2.ModelDriven#getModel()*/@Overridepublic Object getModel() {return this.id;}/****/@Overridepublic void setServletContext(ServletContext servletContext) {this.servletContext = servletContext;}}