Beispiel #1
0
        /**
         * Follow redirects and download page resources if appropriate. this works,
         * but the container stuff here is what's doing it. followRedirects() is
         * actually doing the work to make sure we have only one container to make
         * this work more naturally, I think this method - sample() - needs to take
         * an HTTPSamplerResult container parameter instead of a
         * boolean:areFollowingRedirect.
         *
         * @param areFollowingRedirect
         * @param frameDepth
         * @param res
         * @return the sample result
         */
        protected TestExecuteResult ResultProcessing(Boolean areFollowingRedirect, int frameDepth, TestExecuteResult res)
        {
            //Boolean wasRedirected = false;
            //if (!areFollowingRedirect)
            //{
            //    if (res.isRedirect())
            //    {
            //        log.Debug("Location set to - " + res.getRedirectLocation());

            //        if (getFollowRedirects()) {
            //            res = followRedirects(res, frameDepth);
            //            areFollowingRedirect = true;
            //            wasRedirected = true;
            //        }
            //    }
            //}
            //if (isImageParser() && (SampleResult.TEXT).equals(res.getDataType()) && res.isSuccessful()) {
            //    if (frameDepth > MAX_FRAME_DEPTH) {
            //        res.addSubResult(errorResult(new Exception("Maximum frame/iframe nesting depth exceeded."), new UPMPSampleResult(res)));
            //    } else {
            //        // Only download page resources if we were not redirected.
            //        // If we were redirected, the page resources have already been
            //        // downloaded for the sample made for the redirected url
            //        // otherwise, use null so the container is created if necessary unless
            //        // the flag is false, in which case revert to broken 2.1 behaviour
            //        // Bug 51939 -  https://issues.apache.org/bugzilla/show_bug.cgi?id=51939
            //        if(!wasRedirected) {
            //            UPMPSampleResult container = (UPMPSampleResult) (
            //                    areFollowingRedirect ? res.getParent() : SEPARATE_CONTAINER ? null : res);
            //            res = downloadPageResources(res, container, frameDepth);
            //        }
            //    }
            //}
            return res;
        }
Beispiel #2
0
 /*
  * @param res HTTPSampleResult to check
  * @return parser class name (may be "") or null if entry does not exist
  */
 private String GetParserClass(TestExecuteResult res)
 {
     //final String ct = res.getMediaType();
     //return parsersForType.get(ct);
     return "";
 }
Beispiel #3
0
 /**
  * Populates the provided HTTPSampleResult with details from the Exception.
  * Does not create a new instance, so should not be used directly to add a subsample.
  *
  * @param e
  *            Exception representing the error.
  * @param res
  *            SampleResult to be modified
  * @return the modified sampling result containing details of the Exception.
  */
 protected TestExecuteResult ErrorResult(TestExecuteResult res)
 {
     //res.setSampleLabel("Error: " + res.getSampleLabel());
     //res.setDataType(SampleResult.TEXT);
     //ByteArrayOutputStream text = new ByteArrayOutputStream(200);
     //e.printStackTrace(new PrintStream(text));
     //res.setResponseData(text.toByteArray());
     //res.setResponseCode(NON_HTTP_RESPONSE_CODE+": "+e.getClass().getName());
     //res.setResponseMessage(NON_HTTP_RESPONSE_MESSAGE+": "+e.getMessage());
     //res.setSuccessful(false);
     //res.setMonitor(this.isMonitor());
     //return res;
     return null;
 }
 protected TestExecuteResult ResultProcessing(TestExecuteResult res)
 {
     return res;
 }
 protected Byte[] ReadResponse(TestExecuteResult res)
 {
     return null;
 }
 protected String GetResponseHeaders(TestExecuteResult response)
 {
     return "";
 }
 protected TestExecuteResult ErrorResult(TestExecuteResult res)
 {
     return null;
 }