Package org.apache.jmeter.protocol.http.control

Examples of org.apache.jmeter.protocol.http.control.CookieManager


            if (cacheManager != null) {
                this.sampler.setCacheManager(cacheManager);
            }
           
            if(cookieManager != null) {
                CookieManager clonedCookieManager = (CookieManager) cookieManager.clone();
                this.sampler.setCookieManager(clonedCookieManager);
            }
            this.jmeterContextOfParentThread = JMeterContextService.getContext();
        }
View Full Code Here


        setByte((byte)0xff); // More general attributes not supported
    }

    private int getHeaderSize(String method, URL url) {
        HeaderManager headers = getHeaderManager();
        CookieManager cookies = getCookieManager();
        AuthManager auth = getAuthManager();
        int hsz = 1; // Host always
        if(method.equals(POST)) {
            HTTPFileArg[] hfa = getHTTPFiles();
            if(hfa.length > 0) {
                hsz += 3;
            } else {
                hsz += 2;
            }
        }
        if(headers != null) {
            hsz += headers.size();
        }
        if(cookies != null) {
            hsz += cookies.getCookieCount();
        }
        if(auth != null) {
                String authHeader = auth.getAuthHeaderForURL(url);
            if(authHeader != null) {
            ++hsz;
View Full Code Here

            String value = getString();
            if(HEADER_CONTENT_TYPE.equalsIgnoreCase(name)) {
                res.setContentType(value);
                res.setEncodingAndType(value);
            } else if(HEADER_SET_COOKIE.equalsIgnoreCase(name)) {
                CookieManager cookies = getCookieManager();
                if(cookies != null) {
                    cookies.addCookieFromHeader(value, res.getURL());
                }
            }
            sb.append(name).append(COLON_SPACE).append(value).append(NEWLINE);
        }
        res.setResponseHeaders(sb.toString());
View Full Code Here

        if (count == 0 || filter == null) {
          JMeterContextService.getContext().getThread().stop();
        }
        if (filter != null)
          filter.reset();
        CookieManager cm = getCookieManager();
        if (cm != null)
          cm.clear();
        count = 0;
        return errorResult(new Error("No entries found"), new HTTPSampleResult());
      }
      count = thisCount;
      res = sample();
View Full Code Here

        } else if (action.equals(LOAD_COMMAND)) {
            try {
                final String [] _txt={".txt"}; //$NON-NLS-1$
                final JFileChooser chooser = FileDialoger.promptToOpenFile(_txt);
                if (chooser != null) {
                    CookieManager manager = new CookieManager();
                    manager.addFile(chooser.getSelectedFile().getAbsolutePath());
                    for (int i = 0; i < manager.getCookieCount() ; i++){
                        addCookieToTable(manager.get(i));
                    }
                    tableModel.fireTableDataChanged();

                    if (tableModel.getRowCount() > 0) {
                        deleteButton.setEnabled(true);
View Full Code Here

            cookieTable.getCellEditor().stopCellEditing();
        }
        cm.clear();
        configureTestElement(cm);
        if (cm instanceof CookieManager) {
            CookieManager cookieManager = (CookieManager) cm;
            for (int i = 0; i < tableModel.getRowCount(); i++) {
                Cookie cookie = createCookie(tableModel.getRowData(i));
                cookieManager.add(cookie);
            }
            cookieManager.setClearEachIteration(clearEachIteration.isSelected());
            cookieManager.setCookiePolicy(policy.getText());
        }
    }
View Full Code Here

            addCookieToTable((Cookie) iter.next().getObjectValue());
        }
    }

    public TestElement createTestElement() {
        CookieManager cookieManager = new CookieManager();
        modifyTestElement(cookieManager);
        return cookieManager;
    }
View Full Code Here

    @Override
    public void configure(TestElement el) {
        super.configure(el);

        CookieManager cookieManager = (CookieManager) el;
        populateTable(cookieManager);
        clearEachIteration.setSelected((cookieManager).getClearEachIteration());
        policy.setText(cookieManager.getPolicy());
    }
View Full Code Here

    public HeaderManager getHeaderManager() {
        return (HeaderManager) getProperty(HEADER_MANAGER).getObjectValue();
    }

    public void setCookieManager(CookieManager value) {
        CookieManager mgr = getCookieManager();
        if (mgr != null) {
            log.warn("Existing CookieManager " + mgr.getName() + " superseded by " + value.getName());
        }
        setProperty(new TestElementProperty(COOKIE_MANAGER, value));
    }
View Full Code Here

        setByte((byte)0xff); // More general attributes not supported
    }

    private int getHeaderSize(String method, URL url) {
        HeaderManager headers = getHeaderManager();
        CookieManager cookies = getCookieManager();
        AuthManager auth = getAuthManager();
        int hsz = 1; // Host always
        if(method.equals(POST)) {
            HTTPFileArg[] hfa = getHTTPFiles();
            if(hfa.length > 0) {
                hsz += 3;
            } else {
                hsz += 2;
            }
        }
        if(headers != null) {
            hsz += headers.size();
        }
        if(cookies != null) {
            hsz += cookies.getCookieCount();
        }
        if(auth != null) {
                String authHeader = auth.getAuthHeaderForURL(url);
            if(authHeader != null) {
            ++hsz;
View Full Code Here

TOP

Related Classes of org.apache.jmeter.protocol.http.control.CookieManager

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.