Quantcast
Channel: Adobe Community : Popular Discussions - LiveCycle Output
Viewing all articles
Browse latest Browse all 9631

Help understanding this submit form servlet

$
0
0
I am trying to convert a Submit form servlet (used in 7.2) to 8.2, but I have no idea what's going on in the following snipplet, can anyone explain it to me and how I should go about converting so that it works on 8.2.<br /><br />            String requestHeader = new String();<br />            String userAgent = new String();<br />            Enumeration hen = request.getHeaderNames();<br />            String ampsep = new String();<br />            while(hen.hasMoreElements()) {<br />                String hn = hen.nextElement().toString();<br />                requestHeader = requestHeader.concat(ampsep).concat(hn.toUpperCase()).concat("=").concat(request.getHeade r(hn));<br />                ampsep = "&";<br />                if(hn.toUpperCase().equals("USER-AGENT")) {<br />                    userAgent = request.getHeader(hn);<br />                }<br />                if(hn.toUpperCase().equals("USER-AGENT")) {<br />                    requestHeader = requestHeader.concat(ampsep).concat("HTTP_USER_AGENT").concat("=").concat(request.getHead er(hn));<br />                }<br />                if(hn.toUpperCase().equals("CONTENT-TYPE")) {<br />                    requestHeader = requestHeader.concat(ampsep).concat("CONTENT_TYPE").concat("=").concat(request.getHeader( hn));<br />                }<br />                if(hn.toUpperCase().equals("CONTENT-LENGTH")) {<br />                    requestHeader = requestHeader.concat(ampsep).concat("CONTENT_LENGTH").concat("=").concat(request.getHeade r(hn));<br />                }<br />            }<br />            <br />            IOutputContext formServerOutput = null;<br />            EJBClient formServerObject = new EJBClient();<br />            <br />            //formServerOutput = formServerObject.processFormSubmission(new com.adobe.idp.Document(request.getInputStream()), requestHeader, userAgent, "OutputType=0");<br />            formServerOutput = formServerObject.processFormSubmission(request, "OutputType=0");<br /><br />            byte[] theData  = formServerOutput.getOutputXML().getBytes();<br />            <br />            formName = formServerOutput.getFormQuery();<br />            String theForm = formServerOutput.getOutputString();<br />            String theParameters = theForm.substring(theForm.lastIndexOf("<pdf href="),theForm.indexOf("http://ns.adobe.com/xdp/pd" ));<br />            appID = theParameters.substring(theParameters.indexOf("appID=")+"appID=".length(),theParameters.i ndexOf("&amp;fileID="));<br />            status = theParameters.substring(theParameters.indexOf("status=")+"status=".length(),theParameters .indexOf("&amp;configFile="));<br />            configFile = theParameters.substring(theParameters.indexOf("configFile=")+"configFile=".length(),thePa rameters.indexOf("xmlns=")-2);<br />            fileID = "initvalue";<br />            try {<br />                fileID = theParameters.substring(theParameters.indexOf("fileID=")+"fileID=".length(),theParameters .indexOf("&amp;status="));<br />            }<br />            catch(Exception e) {<br />                // fileID isn't necessary, but can cause the substring() to exception out.<br />            }

Viewing all articles
Browse latest Browse all 9631

Trending Articles