docmanpubmultiactioncontroller.java
来自「Java的框架」· Java 代码 · 共 86 行
JAVA
86 行
package mcaps.core.docman.webapp.controller;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContextException;
import org.springframework.web.servlet.ModelAndView;
import mcaps.core.docman.util.NameConstants;
import mcap.core.base.webapp.controller.BaseMultiActionController;
import mcap.core.docman.model.FolderObject;
import mcap.core.docman.service.DocAccessException;
import mcap.core.docman.service.DocManManager;
/**
* This class handle multiple request pertaining to
* document publication.
*
* @author Chan Chin Wei
* @date May 25, 2006
* @version 1.0.1.0
*/
public class DocManPubMultiActionController extends BaseMultiActionController implements InitializingBean {
private static final String DOC_PUB_VIEW = "core/docMan/docPubList";
private DocManManager docManager;
public DocManManager getDocManager() {
return docManager;
}
public void setDocManager(DocManManager docManager) {
this.docManager = docManager;
}
// ===========================================================================================================
// INITIALIZING BEAN IMPLEMENTATION
// ===========================================================================================================
/* (non-Javadoc)
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
* Invoked by a BeanFactory after it has set all bean properties supplied. This allows
* the bean instance to perform initialization only possible when all bean properties
* have been set and to throw an exception in the event of misconfiguration.
*/
public void afterPropertiesSet() throws Exception {
if (docManager == null)
throw new ApplicationContextException ("Must set docManager bean property on " + getClass());
}
// ===========================================================================================================
// HANDLERS
// ===========================================================================================================
/**
* Custom handler for main page display
*
* @param request current HTTP request
* @param response current HTTP response
* @return a ModelAndView to render the response
*/
public ModelAndView mainPageHandler(HttpServletRequest request,
HttpServletResponse response) throws ServletException {
String path = request.getParameter ("path");
FolderObject folder = null;
String mainPagePath = null;
try {
folder = docManager.getFolderPublished (path);
mainPagePath = docManager.getMainPagePath();
} catch (DocAccessException e) {
e.printStackTrace();
throw new ServletException (e.getMessage());
}
ModelAndView mv = new ModelAndView(DOC_PUB_VIEW, NameConstants.FOLDERSTRUCT, folder);
mv.addObject(NameConstants.DOC_MAIN_PAGE_PATH, mainPagePath);
return mv;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?