Package KFM.HTML

Examples of KFM.HTML.HtmlLoader2


    {
            String tUrlString = this.buildUrl(aWord, this.getDisplayLanguage());


            // load URL
            mHtmlLoader = new HtmlLoader2();
            boolean tResult=false;

            try {
                tResult = mHtmlLoader.load(tUrlString, 0);
            } catch (MalformedURLException me){
View Full Code Here


     */
    public void run ()
    {
        int i=0;
        boolean tError;
        HtmlLoader2 tHtmlLoad = new HtmlLoader2();
        mProblemMailSent = false;

        // Loop for mNumberOfIntervals, 0 means unfinite
        while((i++ < mNumberOfIntervals) || (mNumberOfIntervals == 0)){
            int tCounter = 0;

            // In every interval load file mRunsPerInterval times
            while(tCounter++ < mRunsPerInterval) {
                tError=false;
                String tContent=null;
                long tEndTime;
                long tStartTime = new Date().getTime();

                boolean tResult = false;
                try
                {
                    tResult = tHtmlLoad.get(mHost, mFile, mPort, mTimeoutValue, mProtocol.equalsIgnoreCase("https"));
                }
                catch (java.io.InterruptedIOException ioe)
                {
                    tResult = false;
                    tError = true;
                    System.out.println(ioe);
                }
                tEndTime = new Date().getTime();

                if (!tResult){
                    if (!mProblemMailSent){
                        mErrorTime = tEndTime;
                        mUptimeTester.sendMail("DOWN", mNotLoadedMessage);
                        mProblemMailSent=true;
                    }
                    System.out.println(KFM_DateTimeService.createTimeStamp()+": test " + i +":" +tCounter+mNotLoadedMessage);
                    tError=true;
                }

                // Send sign of life message to the watchdog observer
                // if HtmlLoad.get blocks, watchdog observer terminates the program
                mWatchdogObserver.setAlive(true);

                // load was successful
                if(!tError){

                    // Check if page contains given label
                    tContent = tHtmlLoad.getContent();
                    if (tContent.indexOf(mLabel) == -1){
                        if (!mProblemMailSent){
                            mErrorTime = tEndTime;
                            mUptimeTester.sendMail("LABEL not found", mLabelNotFoundMessage);
                            mProblemMailSent=true;
View Full Code Here

     *
     */
    public void run ()
    {
        int i=0;
        mHtmlLoad = new HtmlLoader2();
        int tCounter=0;

        // Loop for mNumberOfIntervals, 0 means unfinite
        while((i++ < mNumberOfIntervals) || (mNumberOfIntervals == 0)){
            tCounter = 0;
View Full Code Here

                String tUrl = computeWorkUrl(tPath);
                //append the http parameter to the properties file
                tUrl += getParamString();

                HtmlLoader2 tLoader = new HtmlLoader2(); //because the htmlloader has a memory lead
                //initialize it new for each work file
                //process through jsp engine the file
                tLoader.load(tUrl, 0);
                if (tLoader.getStatusCode() != 200){
                    mErrors ++;
                    printConnectionError(tLoader);
                }
                else
                {
                    //get the content

                    String tContent = tLoader.getContent();

                    String[] tErrorStrings = {
                        "<h1>Error: 500</h1>",
                        "<h1>500 Servlet Exception</h1>"
                    };
View Full Code Here

        Properties tProps = processArguments(args);

        int tTimeout = Integer.parseInt(tProps.getProperty(HttpGetArgs.timeout));
        String tUrl = tProps.getProperty(HttpGetArgs.url);

        HtmlLoader2 tHtmlLoader = new HtmlLoader2();
        int tStatusCode = -1;

        try {
            boolean tResult = tHtmlLoader.get(new URL(tUrl), tTimeout);
            tStatusCode = tHtmlLoader.getStatusCode();

            if(tResult) {
                System.out.println(tHtmlLoader.getContent());
            }

        } catch(IOException e) {
            System.out.println("HTMLLoader2 got an Exception.");
        }
View Full Code Here

TOP

Related Classes of KFM.HTML.HtmlLoader2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.