List of usage examples for javax.servlet.http HttpServletRequest getAttributeNames
public Enumeration<String> getAttributeNames();
Enumeration
containing the names of the attributes available to this request. From source file:org.jkcsoft.web.struts.http.HttpHelper.java
public static void logRequest(HttpServletRequest request, Object logCategory) { // quick reject if (!LogHelper.getLogger(logCategory).isDebugEnabled()) return;// ww w. j a v a 2s .com StringBuilder sbMsg = new StringBuilder(100); appendLine(sbMsg, ""); appendLine(sbMsg, "---------- Start Request Dump:"); appendLine(sbMsg, "method [" + request.getMethod() + "]"); appendLine(sbMsg, "servletPath [" + request.getServletPath() + "]"); appendLine(sbMsg, "pathInfo [" + request.getPathInfo() + "]"); appendLine(sbMsg, "queryString [" + request.getQueryString() + "]"); Enumeration e = null; String name = null; appendLine(sbMsg, "-------------- Header Information"); e = request.getHeaderNames(); String header; while (e.hasMoreElements()) { header = (String) e.nextElement(); appendLine(sbMsg, header + " [" + request.getHeader(header) + "]"); } appendLine(sbMsg, "-------------- Parameter Information"); e = request.getParameterNames(); while (e.hasMoreElements()) { name = (String) e.nextElement(); String[] values = request.getParameterValues(name); String value = ""; if (values.length > 1) { for (int inx = 0; inx < values.length; inx++) { value = value + values[inx] + ","; } } else { value = values[0]; } if (name.startsWith("password")) { value = "******"; } appendLine(sbMsg, name + " [" + value + "]"); } appendLine(sbMsg, "-------------- Attribute Information"); e = request.getAttributeNames(); while (e.hasMoreElements()) { name = (String) e.nextElement(); appendLine(sbMsg, name + " [" + request.getAttribute(name).toString() + "]"); } appendLine(sbMsg, "---------- End Request Dump:"); LogHelper.debug(logCategory, sbMsg); }
From source file:com.cws.us.pws.controllers.AboutController.java
@RequestMapping(value = "/default", method = RequestMethod.GET) public final ModelAndView showDefaultPage() { final String methodName = AboutController.CNAME + "#showDefaultPage()"; if (DEBUG) {//from w ww.j a va 2 s . com DEBUGGER.debug(methodName); } ModelAndView mView = new ModelAndView(); final ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder .currentRequestAttributes(); final HttpServletRequest hRequest = requestAttributes.getRequest(); final HttpSession hSession = hRequest.getSession(); if (DEBUG) { DEBUGGER.debug("ServletRequestAttributes: {}", requestAttributes); DEBUGGER.debug("HttpServletRequest: {}", hRequest); DEBUGGER.debug("HttpSession: {}", hSession); DEBUGGER.debug("Dumping session content:"); @SuppressWarnings("unchecked") Enumeration<String> sessionEnumeration = hSession.getAttributeNames(); while (sessionEnumeration.hasMoreElements()) { String sessionElement = sessionEnumeration.nextElement(); Object sessionValue = hSession.getAttribute(sessionElement); DEBUGGER.debug("Attribute: " + sessionElement + "; Value: " + sessionValue); } DEBUGGER.debug("Dumping request content:"); @SuppressWarnings("unchecked") Enumeration<String> requestEnumeration = hRequest.getAttributeNames(); while (requestEnumeration.hasMoreElements()) { String requestElement = requestEnumeration.nextElement(); Object requestValue = hRequest.getAttribute(requestElement); DEBUGGER.debug("Attribute: " + requestElement + "; Value: " + requestValue); } DEBUGGER.debug("Dumping request parameters:"); @SuppressWarnings("unchecked") Enumeration<String> paramsEnumeration = hRequest.getParameterNames(); while (paramsEnumeration.hasMoreElements()) { String requestElement = paramsEnumeration.nextElement(); Object requestValue = hRequest.getParameter(requestElement); DEBUGGER.debug("Parameter: " + requestElement + "; Value: " + requestValue); } } try { CareerRequest request = new CareerRequest(); request.setLang( (StringUtils.isBlank(hRequest.getParameter("lang"))) ? "en" : hRequest.getParameter("lang")); if (DEBUG) { DEBUGGER.debug("CareerRequest: {}", request); } CareerResponse response = this.careerRefSvc.getCareerList(request); if (DEBUG) { DEBUGGER.debug("CareerResponse: {}", response); } if (response.getRequestStatus() == CoreServicesStatus.SUCCESS) { mView.addObject("doCareersExist", Boolean.TRUE); } } catch (CareerRequestException crx) { ERROR_RECORDER.error(crx.getMessage(), crx); } mView.setViewName(this.aboutUsPage); if (DEBUG) { DEBUGGER.debug("ModelAndView: {}", mView); } return mView; }
From source file:com.cws.us.pws.controllers.AboutController.java
@RequestMapping(value = "/careers", method = RequestMethod.GET) public final ModelAndView showCareersPage() { final String methodName = AboutController.CNAME + "#showCareersPage()"; if (DEBUG) {/*from www . j a va 2 s .com*/ DEBUGGER.debug(methodName); } ModelAndView mView = new ModelAndView(); final ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder .currentRequestAttributes(); final HttpServletRequest hRequest = requestAttributes.getRequest(); final HttpSession hSession = hRequest.getSession(); if (DEBUG) { DEBUGGER.debug("ServletRequestAttributes: {}", requestAttributes); DEBUGGER.debug("HttpServletRequest: {}", hRequest); DEBUGGER.debug("HttpSession: {}", hSession); DEBUGGER.debug("Dumping session content:"); @SuppressWarnings("unchecked") Enumeration<String> sessionEnumeration = hSession.getAttributeNames(); while (sessionEnumeration.hasMoreElements()) { String sessionElement = sessionEnumeration.nextElement(); Object sessionValue = hSession.getAttribute(sessionElement); DEBUGGER.debug("Attribute: " + sessionElement + "; Value: " + sessionValue); } DEBUGGER.debug("Dumping request content:"); @SuppressWarnings("unchecked") Enumeration<String> requestEnumeration = hRequest.getAttributeNames(); while (requestEnumeration.hasMoreElements()) { String requestElement = requestEnumeration.nextElement(); Object requestValue = hRequest.getAttribute(requestElement); DEBUGGER.debug("Attribute: " + requestElement + "; Value: " + requestValue); } DEBUGGER.debug("Dumping request parameters:"); @SuppressWarnings("unchecked") Enumeration<String> paramsEnumeration = hRequest.getParameterNames(); while (paramsEnumeration.hasMoreElements()) { String requestElement = paramsEnumeration.nextElement(); Object requestValue = hRequest.getParameter(requestElement); DEBUGGER.debug("Parameter: " + requestElement + "; Value: " + requestValue); } } try { CareerRequest request = new CareerRequest(); request.setLang( (StringUtils.isBlank(hRequest.getParameter("lang"))) ? "en" : hRequest.getParameter("lang")); if (DEBUG) { DEBUGGER.debug("CareerRequest: {}", request); } CareerResponse response = this.careerRefSvc.getCareerList(request); if (DEBUG) { DEBUGGER.debug("CareerResponse: {}", response); } if (response.getRequestStatus() == CoreServicesStatus.SUCCESS) { mView.addObject("careerList", response.getCareerList()); } } catch (CareerRequestException crx) { ERROR_RECORDER.error(crx.getMessage(), crx); } mView.setViewName(this.careersPage); if (DEBUG) { DEBUGGER.debug("ModelAndView: {}", mView); } return mView; }
From source file:com.cws.us.pws.controllers.AboutController.java
@RequestMapping(value = "/careers/career/{reqId}", method = RequestMethod.GET) public final ModelAndView showCareer(@PathVariable("reqId") final String reqId) { final String methodName = AboutController.CNAME + "#showCareer(@PathVariable(\"reqId\") final String reqId)"; if (DEBUG) {// w w w . j a v a 2 s . c om DEBUGGER.debug(methodName); } ModelAndView mView = new ModelAndView(); final ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder .currentRequestAttributes(); final HttpServletRequest hRequest = requestAttributes.getRequest(); final HttpSession hSession = hRequest.getSession(); if (DEBUG) { DEBUGGER.debug("ServletRequestAttributes: {}", requestAttributes); DEBUGGER.debug("HttpServletRequest: {}", hRequest); DEBUGGER.debug("HttpSession: {}", hSession); DEBUGGER.debug("Dumping session content:"); @SuppressWarnings("unchecked") Enumeration<String> sessionEnumeration = hSession.getAttributeNames(); while (sessionEnumeration.hasMoreElements()) { String sessionElement = sessionEnumeration.nextElement(); Object sessionValue = hSession.getAttribute(sessionElement); DEBUGGER.debug("Attribute: " + sessionElement + "; Value: " + sessionValue); } DEBUGGER.debug("Dumping request content:"); @SuppressWarnings("unchecked") Enumeration<String> requestEnumeration = hRequest.getAttributeNames(); while (requestEnumeration.hasMoreElements()) { String requestElement = requestEnumeration.nextElement(); Object requestValue = hRequest.getAttribute(requestElement); DEBUGGER.debug("Attribute: " + requestElement + "; Value: " + requestValue); } DEBUGGER.debug("Dumping request parameters:"); @SuppressWarnings("unchecked") Enumeration<String> paramsEnumeration = hRequest.getParameterNames(); while (paramsEnumeration.hasMoreElements()) { String requestElement = paramsEnumeration.nextElement(); Object requestValue = hRequest.getParameter(requestElement); DEBUGGER.debug("Parameter: " + requestElement + "; Value: " + requestValue); } } try { Career career = new Career(); career.setJobReqId(reqId); if (DEBUG) { DEBUGGER.debug("Career: {}", career); } CareerRequest request = new CareerRequest(); request.setCareer(career); request.setLang( (StringUtils.isBlank(hRequest.getParameter("lang"))) ? "en" : hRequest.getParameter("lang")); if (DEBUG) { DEBUGGER.debug("CareerRequest: {}", request); } CareerResponse response = this.careerRefSvc.getCareerData(request); if (DEBUG) { DEBUGGER.debug("CareerResponse: {}", response); } if (response.getRequestStatus() == CoreServicesStatus.SUCCESS) { mView.addObject("career", response.getCareer()); } else { mView.addObject(Constants.ERROR_MESSAGE, this.messageNoCareerLocated); } } catch (CareerRequestException crx) { ERROR_RECORDER.error(crx.getMessage(), crx); mView = new ModelAndView(new RedirectView()); mView.setViewName(this.appConfig.getErrorResponsePage()); } mView.setViewName(this.careersPage); if (DEBUG) { DEBUGGER.debug("ModelAndView: {}", mView); } return mView; }
From source file:org.springframework.web.servlet.SimpleDispatcherServlet.java
/** * Restore the request attributes after an include. * @param request current HTTP request// w w w . jav a 2 s . c om * @param attributesSnapshot the snapshot of the request attributes before the include */ private void restoreAttributesAfterInclude(HttpServletRequest request, Map attributesSnapshot) { logger.debug("Restoring snapshot of request attributes after include"); // Need to copy into separate Collection here, to avoid side effects // on the Enumeration when removing attributes. Set<String> attrsToCheck = new HashSet<String>(); Enumeration attrNames = request.getAttributeNames(); while (attrNames.hasMoreElements()) { String attrName = (String) attrNames.nextElement(); if (this.cleanupAfterInclude || attrName.startsWith("org.springframework.web.servlet")) { attrsToCheck.add(attrName); } } // Iterate over the attributes to check, restoring the original value // or removing the attribute, respectively, if appropriate. for (String attrName : attrsToCheck) { Object attrValue = attributesSnapshot.get(attrName); if (attrValue != null) { if (logger.isDebugEnabled()) { logger.debug("Restoring original value of attribute [" + attrName + "] after include"); } request.setAttribute(attrName, attrValue); } else { if (logger.isDebugEnabled()) { logger.debug("Removing attribute [" + attrName + "] after include"); } request.removeAttribute(attrName); } } }
From source file:uk.ac.cam.caret.sakai.rwiki.component.service.impl.XSLTEntityHandler.java
public void addRequestAttributes(ContentHandler ch, HttpServletRequest request) throws Exception { if (!isAvailable()) return;// ww w. j a v a 2s.com // add the attributes AttributesImpl dummyAttributes = new AttributesImpl(); ch.startElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_REQUEST_ATTRIBUTES, SchemaNames.EL_NSREQUEST_ATTRIBUTES, dummyAttributes); for (Enumeration e = request.getAttributeNames(); e.hasMoreElements();) { String name = (String) e.nextElement(); Object attr = request.getAttribute(name); AttributesImpl propA = new AttributesImpl(); propA.addAttribute("", SchemaNames.ATTR_NAME, //$NON-NLS-1$ SchemaNames.ATTR_NAME, "string", name); //$NON-NLS-1$ if (attr instanceof Object[]) { Object[] oattr = (Object[]) attr; ch.startElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_REQUEST_ATTRIBUTE, SchemaNames.EL_NSREQUEST_ATTRIBUTE, propA); for (int i = 0; i < oattr.length; i++) { addElement(ch, SchemaNames.NS_CONTAINER, SchemaNames.EL_VALUE, SchemaNames.EL_NSVALUE, dummyAttributes, oattr[i]); } ch.endElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_REQUEST_ATTRIBUTE, SchemaNames.EL_NSREQUEST_ATTRIBUTE); } else { ch.startElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_REQUEST_ATTRIBUTE, SchemaNames.EL_NSREQUEST_ATTRIBUTE, propA); addElement(ch, SchemaNames.NS_CONTAINER, SchemaNames.EL_VALUE, SchemaNames.EL_NSVALUE, dummyAttributes, attr); ch.endElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_REQUEST_ATTRIBUTE, SchemaNames.EL_NSREQUEST_ATTRIBUTE); } } ch.endElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_REQUEST_ATTRIBUTES, SchemaNames.EL_NSREQUEST_ATTRIBUTES); }
From source file:org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext.java
public GenericWebAppContext(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, SessionProvider sessionProvider, ManageableRepository repository) { initialize(servletContext, request, response); this.sessionProvider = sessionProvider; this.repository = repository; // log.info("WEb context ---------------"); // initialize context with all props Enumeration en = servletContext.getInitParameterNames(); while (en.hasMoreElements()) { String name = (String) en.nextElement(); put(name, servletContext.getInitParameter(name)); LOG.debug("ServletContext init param: " + name + "=" + servletContext.getInitParameter(name)); }/*from ww w . j a v a 2 s . com*/ en = servletContext.getAttributeNames(); while (en.hasMoreElements()) { String name = (String) en.nextElement(); put(name, servletContext.getAttribute(name)); LOG.debug("ServletContext: " + name + "=" + servletContext.getAttribute(name)); } HttpSession session = request.getSession(false); if (session != null) { en = session.getAttributeNames(); while (en.hasMoreElements()) { String name = (String) en.nextElement(); put(name, session.getAttribute(name)); LOG.debug("Session: " + name + "=" + session.getAttribute(name)); } } en = request.getAttributeNames(); while (en.hasMoreElements()) { String name = (String) en.nextElement(); put(name, request.getAttribute(name)); } en = request.getParameterNames(); while (en.hasMoreElements()) { String name = (String) en.nextElement(); put(name, request.getParameter(name)); LOG.debug("Request: " + name + "=" + request.getParameter(name)); } }
From source file:com.cws.us.pws.controllers.ProductController.java
@RequestMapping(value = "/search", method = RequestMethod.POST) public final ModelAndView searchProducts(@ModelAttribute("request") final Product request, final BindingResult binding) { final String methodName = ProductController.CNAME + "#searchProducts(@ModelAttribute(\"request\") final Product request, final BindingResult binding)"; if (DEBUG) {/*from ww w. ja v a2 s .co m*/ DEBUGGER.debug(methodName); DEBUGGER.debug("Product: {}", request); } // String viewName = null; ProductResponse productResponse = null; ModelAndView mView = new ModelAndView(); final ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder .currentRequestAttributes(); final HttpServletRequest hRequest = requestAttributes.getRequest(); final HttpSession hSession = hRequest.getSession(); final String lang = hRequest.getParameter(Constants.PARAMETER_LANG); if (DEBUG) { DEBUGGER.debug("ServletRequestAttributes: {}", requestAttributes); DEBUGGER.debug("HttpServletRequest: {}", hRequest); DEBUGGER.debug("HttpSession: {}", hSession); DEBUGGER.debug("lang: {}", lang); DEBUGGER.debug("Dumping session content:"); @SuppressWarnings("unchecked") Enumeration<String> sessionEnumeration = hSession.getAttributeNames(); while (sessionEnumeration.hasMoreElements()) { String sessionElement = sessionEnumeration.nextElement(); Object sessionValue = hSession.getAttribute(sessionElement); DEBUGGER.debug("Attribute: " + sessionElement + "; Value: " + sessionValue); } DEBUGGER.debug("Dumping request content:"); @SuppressWarnings("unchecked") Enumeration<String> requestEnumeration = hRequest.getAttributeNames(); while (requestEnumeration.hasMoreElements()) { String requestElement = requestEnumeration.nextElement(); Object requestValue = hRequest.getAttribute(requestElement); DEBUGGER.debug("Attribute: " + requestElement + "; Value: " + requestValue); } DEBUGGER.debug("Dumping request parameters:"); @SuppressWarnings("unchecked") Enumeration<String> paramsEnumeration = hRequest.getParameterNames(); while (paramsEnumeration.hasMoreElements()) { String requestElement = paramsEnumeration.nextElement(); Object requestValue = hRequest.getParameter(requestElement); DEBUGGER.debug("Parameter: " + requestElement + "; Value: " + requestValue); } } try { ProductRequest productRequest = new ProductRequest(); productRequest.setProduct(request); productRequest.setLang((StringUtils.isBlank(lang)) ? "en" : lang); if (DEBUG) { DEBUGGER.debug("ProductRequest: {}", productRequest); } productResponse = this.productRefSvc.getProductData(productRequest); if (DEBUG) { DEBUGGER.debug("ProductResponse: {}", productResponse); } if (productResponse.getRequestStatus() == CoreServicesStatus.FAILURE) { mView.setViewName(this.appConfig.getErrorResponsePage()); } } catch (ProductRequestException prx) { ERROR_RECORDER.error(prx.getMessage(), prx); mView.setViewName(this.appConfig.getErrorResponsePage()); } if (DEBUG) { DEBUGGER.debug("ModelAndView: {}", mView); } return mView; }
From source file:com.cws.us.pws.controllers.ProductController.java
@RequestMapping(value = "/default", method = RequestMethod.GET) public final ModelAndView showDefaultPage() { final String methodName = ProductController.CNAME + "#showDefaultPage()"; if (DEBUG) {/*from w w w . j av a 2 s .c o m*/ DEBUGGER.debug(methodName); } ModelAndView mView = new ModelAndView(); final ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder .currentRequestAttributes(); final HttpServletRequest hRequest = requestAttributes.getRequest(); final HttpSession hSession = hRequest.getSession(); final String lang = hRequest.getParameter(Constants.PARAMETER_LANG); if (DEBUG) { DEBUGGER.debug("ServletRequestAttributes: {}", requestAttributes); DEBUGGER.debug("HttpServletRequest: {}", hRequest); DEBUGGER.debug("HttpSession: {}", hSession); DEBUGGER.debug("lang: {}", lang); DEBUGGER.debug("Dumping session content:"); @SuppressWarnings("unchecked") Enumeration<String> sessionEnumeration = hSession.getAttributeNames(); while (sessionEnumeration.hasMoreElements()) { String sessionElement = sessionEnumeration.nextElement(); Object sessionValue = hSession.getAttribute(sessionElement); DEBUGGER.debug("Attribute: " + sessionElement + "; Value: " + sessionValue); } DEBUGGER.debug("Dumping request content:"); @SuppressWarnings("unchecked") Enumeration<String> requestEnumeration = hRequest.getAttributeNames(); while (requestEnumeration.hasMoreElements()) { String requestElement = requestEnumeration.nextElement(); Object requestValue = hRequest.getAttribute(requestElement); DEBUGGER.debug("Attribute: " + requestElement + "; Value: " + requestValue); } DEBUGGER.debug("Dumping request parameters:"); @SuppressWarnings("unchecked") Enumeration<String> paramsEnumeration = hRequest.getParameterNames(); while (paramsEnumeration.hasMoreElements()) { String requestElement = paramsEnumeration.nextElement(); Object requestValue = hRequest.getParameter(requestElement); DEBUGGER.debug("Parameter: " + requestElement + "; Value: " + requestValue); } } try { ProductRequest productRequest = new ProductRequest(); productRequest.setIsFeatured(true); productRequest.setLang((StringUtils.isBlank(lang)) ? "en" : lang); if (DEBUG) { DEBUGGER.debug("ProductRequest: {}", productRequest); } ProductResponse productResponse = this.productRefSvc.getFeaturedProducts(productRequest); if (DEBUG) { DEBUGGER.debug("ProductResponse: {}", productResponse); } if (productResponse.getRequestStatus() == CoreServicesStatus.SUCCESS) { List<Product> featuredProducts = productResponse.getProductList(); if (DEBUG) { DEBUGGER.debug("List<Product>: {}", featuredProducts); } mView.addObject("featuredProducts", featuredProducts); } mView.addObject("command", new Product()); mView.setViewName(this.defaultPage); } catch (ProductRequestException prx) { ERROR_RECORDER.error(prx.getMessage(), prx); mView = new ModelAndView(new RedirectView()); mView.setViewName(this.appConfig.getErrorResponsePage()); } if (DEBUG) { DEBUGGER.debug("ModelAndView: {}", mView); } return mView; }
From source file:com.cws.us.pws.controllers.ProductController.java
@RequestMapping(value = "/product/{product}", method = RequestMethod.GET) public final ModelAndView getProductInfo(@PathVariable("product") final String product) { final String methodName = ProductController.CNAME + "#getProductInfo(@PathVariable(\"product\") final String product)"; if (DEBUG) {// w ww. ja v a 2 s .c o m DEBUGGER.debug(methodName); DEBUGGER.debug("Product: {}", product); } ModelAndView mView = new ModelAndView(); final ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder .currentRequestAttributes(); final HttpServletRequest hRequest = requestAttributes.getRequest(); final HttpSession hSession = hRequest.getSession(); final String lang = hRequest.getParameter(Constants.PARAMETER_LANG); if (DEBUG) { DEBUGGER.debug("ServletRequestAttributes: {}", requestAttributes); DEBUGGER.debug("HttpServletRequest: {}", hRequest); DEBUGGER.debug("HttpSession: {}", hSession); DEBUGGER.debug("lang: {}", lang); DEBUGGER.debug("Dumping session content:"); @SuppressWarnings("unchecked") Enumeration<String> sessionEnumeration = hSession.getAttributeNames(); while (sessionEnumeration.hasMoreElements()) { String sessionElement = sessionEnumeration.nextElement(); Object sessionValue = hSession.getAttribute(sessionElement); DEBUGGER.debug("Attribute: " + sessionElement + "; Value: " + sessionValue); } DEBUGGER.debug("Dumping request content:"); @SuppressWarnings("unchecked") Enumeration<String> requestEnumeration = hRequest.getAttributeNames(); while (requestEnumeration.hasMoreElements()) { String requestElement = requestEnumeration.nextElement(); Object requestValue = hRequest.getAttribute(requestElement); DEBUGGER.debug("Attribute: " + requestElement + "; Value: " + requestValue); } DEBUGGER.debug("Dumping request parameters:"); @SuppressWarnings("unchecked") Enumeration<String> paramsEnumeration = hRequest.getParameterNames(); while (paramsEnumeration.hasMoreElements()) { String requestElement = paramsEnumeration.nextElement(); Object requestValue = hRequest.getParameter(requestElement); DEBUGGER.debug("Parameter: " + requestElement + "; Value: " + requestValue); } } try { Product reqProduct = new Product(); reqProduct.setProductId(product); if (DEBUG) { DEBUGGER.debug("Product: {}", reqProduct); } ProductRequest productRequest = new ProductRequest(); productRequest.setProduct(reqProduct); productRequest.setLang((StringUtils.isBlank(lang)) ? "en" : lang); if (DEBUG) { DEBUGGER.debug("ProductRequest: {}", productRequest); } ProductResponse productResponse = this.productRefSvc.getProductData(productRequest); if (DEBUG) { DEBUGGER.debug("ProductResponse: {}", productResponse); } if (productResponse.getRequestStatus() == CoreServicesStatus.SUCCESS) { Product resProduct = productResponse.getProduct(); if (DEBUG) { DEBUGGER.debug("Product: {}", resProduct); } mView.addObject("product", resProduct); mView.setViewName(this.showProduct); } else { mView = new ModelAndView(new RedirectView()); mView.addObject(Constants.ERROR_MESSAGE, productResponse.getResponse()); mView.setViewName(this.defaultPage); } } catch (ProductRequestException prx) { ERROR_RECORDER.error(prx.getMessage(), prx); mView.setViewName(this.appConfig.getErrorResponsePage()); } if (DEBUG) { DEBUGGER.debug("ModelAndView: {}", mView); } return mView; }