1 5 6 package com.raptus.owxv3.api; 7 8 import java.io.IOException ; 9 10 import javax.servlet.ServletException ; 11 import javax.servlet.http.*; 12 13 import org.apache.struts.action.*; 14 import org.apache.struts.util.MessageResources; 15 16 import com.raptus.owxv3.*; 17 import com.raptus.owxv3.api.usermgr.User; 18 19 41 public class VModuleAuthAction extends OmniaWebAction 42 { 43 58 public ActionForward perform(ActionMapping mapping, 59 ActionForm form, 60 HttpServletRequest request, 61 HttpServletResponse response) 62 throws IOException , ServletException 63 { 64 String element = getSelectedElement(form, request); 65 if(element == null || element.length() == 0) 66 { 67 LoggingManager.log("Parameter <element> not specified. Displaying " + 68 "error screen.", this); 69 return mapping.findForward(Constants.SCREEN_ERROR_UNKNOWNELEMENT); 70 } 71 72 String vmid = getSelectedVModule(form, request); 73 if(vmid == null || vmid.length() == 0) 74 { 75 LoggingManager.log("Parameter <vmodule> not specified. Element was " + element 76 + Constants.DEFAULT_SPACER + " Displaying error screen.", this); 77 return mapping.findForward(Constants.SCREEN_ERROR_UNKNOWNVMODULE); 78 } 79 80 HttpSession session = request.getSession(); 81 User user= checkForUserInSession(session); 82 if(user == null) 83 { 84 LoggingManager.log("Cannot find user in session. Displaying login screen.", this); 85 return mapping.findForward(Constants.SCREEN_LOGIN); 86 } 87 88 VModule vm = null; 89 103 if(vm == null) 104 return mapping.findForward(Constants.SCREEN_ERROR_ACCESSDENIED); 105 106 MessageResources msgRes = MessageResources.getMessageResources(Constants.OWXRESOURCES); 108 if(msgRes != null) 109 { 110 String bid = "base"; if(vm.isVirtual()) 112 bid = vm.getIdentification(); 113 114 String key = "module" + bid + Constants.VMODULE_SECTION_ELEMENT_PREFIX + 115 element + ".titletag"; 117 String titleTag = msgRes.getMessage(user.getLocale(),key); 118 if(titleTag != null) 119 request.setAttribute(Constants.SESSIONKEY_TITLETAG, titleTag); 120 } 121 122 String fwdTo = dispatchVModuleElement(request, element, form, vm, user); 124 if(fwdTo == null) 125 { 126 LoggingManager.log("Dispatcher wasn't able to dispatch element " + element, this); 127 return mapping.findForward(Constants.SCREEN_ERROR_UNKNOWNELEMENT); 128 } 129 130 return mapping.findForward(vm.getIdentification() + Constants.DEFAULT_SPACER + fwdTo); 131 } 132 133 136 public String dispatchVModuleElement(HttpServletRequest request, 137 String element, 138 ActionForm form, 139 VModule vm, 140 User user) 141 { 142 return null; 143 } 144 145 } 146 | Popular Tags |