<%@ page import = "java.text.DateFormat" %> <%@ page import = "java.util.*" %> <%@ page import = "organic.util.jsp.JSPUtil" %> <%@ page import = "organic.client.dc.universal.UniversalJSPUtil" %> <%@ page import = "organic.client.dc.gaq.app.JSPGAQUtil" %> <%@ page import = "java.util.Properties" %> <%@ page import = "organic.util.PropertiesManager" %> <%@ page import = "organic.util.UnableToLoadPropertiesException" %> <%! /* need SE help in moving these out into a bean or util class FIXME(jm3) */ String basename( String s ) { String tmp = ""; java.util.StringTokenizer toke = new java.util.StringTokenizer( s, "/" ); while( toke.hasMoreElements() ) tmp = toke.nextToken(); if( tmp.lastIndexOf( "." ) > 0 ) tmp = tmp.substring( 0, tmp.lastIndexOf( "." ) ); return tmp; } void prettyPrintRequest( javax.servlet.http.HttpServletRequest request, JspWriter out) throws java.io.IOException, Exception { Enumeration params = request.getParameterNames(); String param = ""; out.println( "PARAMETERS:" ); while( params.hasMoreElements() ) { param = params.nextElement().toString(); for( int i = 0; i < (java.lang.Math.abs(25 - param.length() )); i++) out.print( " " ); out.println( param + ": " + request.getParameter( param ) ); } Enumeration attrs = request.getAttributeNames(); String attr = ""; out.println( "ATTRIBUTES:" ); while( attrs.hasMoreElements() ) { attr = attrs.nextElement().toString(); for( int i = 0; i < (java.lang.Math.abs(25 - attr.length() )); i++) out.print( " " ); out.println( attr + ": " + request.getAttribute( attr ) ); } } /* get something from the request. * first look for it as a property, if that's not found look for a parameter */ String getParam( javax.servlet.http.HttpServletRequest request, String param ) throws Exception { if( request != null && UniversalJSPUtil.Useful( param )) { String value = ""; value = (String) request.getAttribute( param ); if( UniversalJSPUtil.Useless( value )) value = request.getParameter( param ); return value; } else throw new Exception( "Wrapper Warning: invalid or empty args passed to getParam" ); } void prettyPrintRequestToErr( javax.servlet.http.HttpServletRequest request, java.io.PrintStream err) throws java.io.IOException, Exception { Enumeration params = request.getParameterNames(); String param = ""; err.println( "PARAMETERS:" ); while( params.hasMoreElements() ) { param = params.nextElement().toString(); for( int i = 0; i < (java.lang.Math.abs(25 - param.length() )); i++) err.print( " " ); err.println( param + ": " + getParam( request, param ) ); } Enumeration attrs = request.getAttributeNames(); String attr = ""; err.println( "ATTRIBUTES:" ); while( attrs.hasMoreElements() ) { attr = attrs.nextElement().toString(); for( int i = 0; i < (java.lang.Math.abs(25 - attr.length() )); i++) err.print( " " ); err.println( attr + ": " + request.getAttribute( attr ) ); } } String getAppProperty( String application, String property ) throws Exception { // sanity-check args if( UniversalJSPUtil.Useless( application )) throw new Exception( "Wrapper Warning: refusing to look for empty-named properties file " + application ); else if( UniversalJSPUtil.Useless( property )) throw new Exception( "Wrapper Warning: refusing to look for empty-named property for application " + application ); else { String propertyValue = ""; try { propertyValue = PropertiesManager.getPropertiesGroup( application ).getProperty( property ); } catch( Exception e ) { System.err.println( "Wrapper Warning: couldn't load property '" + property + "' or properties file '" + application + ".properties'- perhaps it doesn't exist?" ); } return propertyValue; } } %> <% // ALL INDEX.JSP code is being wrapped in a big try {} catch block // this is NOT reverting back to the old days where each JSP had // its own try {} catch block!!!!! // this is only for index.jsp. it is needed because EVERY // exception thrown from a jsp:include child page ALSO // generates an exception in here. we need to ignore the one // here in order to allow the child exception to // propagate up through the system and automatic errorPage // handling to take place. //try { String app = getParam( request, "appStr" ); String title = getParam( request, "titleStr" ); String family = getParam( request, "familyStr" ); if( UniversalJSPUtil.Useless( family ) ) family = getParam( request, "family" ); String franchise = getParam( request, "franchise" ); String prefix = getParam( request, "prefix" ); String actionURL = getParam( request, "actionURL" ); //String topNavURL = getParam( request, "topNavURL" ); String leftNavURL = getParam( request, "leftNavURL" ); String setupPage = getParam( request, "setupPage" ); String headerPage = getParam( request, "headerPage" ); // set any http headers with this if( UniversalJSPUtil.Useful( headerPage )) { %> <% } %> <% // do assertion: if( UniversalJSPUtil.Useless( title ) || UniversalJSPUtil.Useless( family ) || UniversalJSPUtil.Useless( franchise ) || UniversalJSPUtil.Useless( actionURL ) ) { // calculate franchise based on server String server = request.getServerName(); if( UniversalJSPUtil.Useful( server )) { if( server.indexOf( "jeep" ) >= 0 ) franchise = "J"; else if( server.indexOf( "4adodge" ) >= 0 ) franchise = "D"; else if( server.indexOf( "chrysler" ) >= 0 ) franchise = "C"; } // this is a "can't happen", so we blow up now. System.err.println( "Wrapper Warning: certain required parameters [titleStr, appStr, familyStr, franchise] were absent." ); prettyPrintRequestToErr( request, System.err ); JSPUtil.sendRedirect( request, response, "/universal/index.jsp" + "?" + "family=brand" + "&franchise=" + franchise + "&titleStr=Error" + "&actionURL=/PriceEquip/expiredSession.jsp" + "&leftNavURL=/universal/brand_templates/" + franchise + "/brandleft.jsp" + "&familyStr=brand" ); return; } // format defaults title = (UniversalJSPUtil.Useless( title )) ? "Universal " : title; if( UniversalJSPUtil.Useless( prefix ) ) prefix = ""; if( UniversalJSPUtil.Useless( leftNavURL ) ) leftNavURL = ""; %> <%= title %> <% if( UniversalJSPUtil.Useful( setupPage ) ) { %> <% } %>
<% if( "PriceEquip".equals( app ) ) { %> <% } else if( "priceequipmopar".equalsIgnoreCase( app ) ) { %> <% } %>

©1995-2003 DaimlerChrysler. All rights reserved. Privacy Statement, Legal Notices and Terms.