String authorization = request.getHeader("authorization"); if ( authorization != null ) reqtrans.set ("authorization", authorization );  for (Enumeration e = request.getParameterNames(); e.hasMoreElements(); ) {  String nextKey = (String)e.nextElement(); String[] paramValues = request.getParameterValues(nextKey); if (paramValues != null) { reqtrans.set (nextKey, paramValues[0]); if (paramValues.length > 1) reqtrans.set (nextKey+"_array", paramValues); } }  String contentType = request.getContentType(); if (contentType != null && contentType.indexOf("multipart/form-data")==0) {  Uploader up; try { if ((up = getUpload (request)) != null) { Hashtable upload = up.getParts (); for (Enumeration e = upload.keys(); e.hasMoreElements(); ) { String nextKey = (String) e.nextElement (); Object nextPart = upload.get (nextKey); reqtrans.set (nextKey, nextPart); } } } catch (Exception upx) { String uploadErr = upx.getMessage (); if (uploadErr == null || uploadErr.length () == 0) uploadErr = upx.toString (); reqtrans.set ("uploadError", uploadErr); } }
String authorization = request.getHeader("authorization"); if ( authorization != null ) reqtrans.set ("authorization", authorization );
    protected void execute (HttpServletRequest request, HttpServletResponse response, byte method) {	String protocol = request.getProtocol ();	Cookie[] cookies = request.getCookies();	// get app and path from original request path	String pathInfo = request.getPathInfo ();	String appID = getAppID (pathInfo);	RequestTrans reqtrans = new RequestTrans (method);	reqtrans.path = getRequestPath (pathInfo);	try {	    if (cookies != null) {	        for (int i=0; i < cookies.length;i++) try {	// get Cookies	            String nextKey = cookies[i].getName ();	            String nextPart = cookies[i].getValue ();	            if ("HopSession".equals (nextKey))	                reqtrans.session = nextPart;	            else	                reqtrans.set (nextKey, nextPart);	        } catch (Exception badCookie) {}	    }	    // check if we need to create a session id	    if (reqtrans.session == null) {	        reqtrans.session = Long.toString (Math.round (Math.random ()*Long.MAX_VALUE), 16);	        reqtrans.session += "@"+Long.toString (System.currentTimeMillis (), 16);	        Cookie c = new Cookie("HopSession", reqtrans.session);	        c.setPath ("/");	        if (cookieDomain != null)	            c.setDomain (cookieDomain);	        response.addCookie(c);	    }	    String host = request.getHeader ("Host");	    if (host != null) {	        host = host.toLowerCase();	        reqtrans.set ("http_host", host);	    }	    String referer = request.getHeader ("Referer");	    if (referer != null)	        reqtrans.set ("http_referer", referer);	    String remotehost = request.getRemoteAddr ();	    if (remotehost != null)	        reqtrans.set ("http_remotehost", remotehost);	    String browser = request.getHeader ("User-Agent");	    if (browser != null)	        reqtrans.set ("http_browser", browser);		String authorization = request.getHeader("authorization");		if ( authorization != null )			reqtrans.set ("authorization", authorization );	    for (Enumeration e = request.getParameterNames(); e.hasMoreElements(); ) {	        // Params parsen	        String nextKey = (String)e.nextElement();	        String[] paramValues = request.getParameterValues(nextKey);	        if (paramValues != null) {	            reqtrans.set (nextKey, paramValues[0]);    // set to single string value	            if (paramValues.length > 1)	                reqtrans.set (nextKey+"_array", paramValues);     // set string array	        }	    }	    String contentType = request.getContentType();	    if (contentType != null && contentType.indexOf("multipart/form-data")==0) {	        // File Upload	        Uploader up;	        try {	            if ((up = getUpload (request)) != null) {	                Hashtable upload = up.getParts ();	                for (Enumeration e = upload.keys(); e.hasMoreElements(); ) {	                    String nextKey = (String) e.nextElement ();	                    Object nextPart = upload.get (nextKey);	                    reqtrans.set (nextKey, nextPart);	                }	            }	        } catch (Exception upx) {	            String uploadErr = upx.getMessage ();	            if (uploadErr == null || uploadErr.length () == 0)	                uploadErr = upx.toString ();	            reqtrans.set ("uploadError", uploadErr);	        }	    }	    // get RMI ref to application and execute request	    IRemoteApp app = getApp (appID);	    ResponseTrans restrans = null;	    try {	        restrans = app.execute (reqtrans);	    } catch (RemoteException cnx) {	        invalidateApp (appID);	        app = getApp (appID);	        app.ping ();                restrans = app.execute (reqtrans);	    }	    writeResponse (response, restrans, cookies, protocol);	} catch (Exception x) {	    invalidateApp (appID);	    try {	        response.setContentType ("text/html");	        Writer out = response.getWriter ();	        if (debug)	            out.write ("<b>Error:</b><br>" +x);	        else	            out.write ("This server is temporarily unavailable. Please check back later.");	        out.flush ();	    } catch (Exception io_e) {}	}    }