Examples of HttpParams


Examples of KFM.GUI.HttpParams

    String aName1=  "anchor";
    assertTrue("Anchor missing, expected #" + aName1, httpparams.getAnchor().equals(aName1));
  }

  public void testSetAnchor() {
    HttpParams httpparams = new HttpParams("https://www.siemens.com/pfad/zum/servlet/SieMap");
    String aName1=  "anchor";
    httpparams.setAnchor(aName1);
    assertTrue("Setting Anchor failed, expected #" + aName1, httpparams.getAnchor().equals(aName1));
  }
View Full Code Here

Examples of KFM.GUI.HttpParams

  }



  public void testToUrlEncodedQueryString() {
    HttpParams httpparams = new HttpParams("https://www.siemens.com/pfad/zum/servlet/SieMap?a=B+e%72nd&a=%2520");
    String stringRet = httpparams.toUrlEncodedQueryString();
    boolean tAssertion = stringRet.equals("a=B%20ernd&a=%2520") || stringRet.equals("a=%2520&a=B%20ernd");
    assertTrue("Got wrong QueryString, expected 'a=Bernd&c=abc%20def&a=%2520', found: " + stringRet, tAssertion);
  }
View Full Code Here

Examples of KFM.GUI.HttpParams

         XmlWithSchemaMapper tMapper = new XmlWithSchemaMapper(tSchemaLocation, "KB.community");

         // Test 1: buildXmlWithSchema
         System.out.println("buildXmlWithSchema:\n-------------------");

         RequestUrl tParams = new HttpParams();
         tParams.addParam("KB.community.membershipPolicy", "restricted");
         tParams.addParam("KB.community.communication", "FaceToFace");
         tParams.addParam("KB.community.contact.name", "Hans");
         //tParams.addParam("KB.community.contact.email", "a@siemens.com");
         tParams.addParam("KB.community.contact.email", "a@siemens.com");
         tParams.addParam("KB.community.sponsor$1.name", "ICM");
         tParams.addParam("KB.community.sponsor$1.url", "http://www.icm.de");
         tParams.addParam("KB.community.sponsor$2.name", "CIO");
         tParams.addParam("KB.community.sponsor$2.url", "http://www.cio.com");
         tParams.addParam("KB.community.hasSubCoPs$1", "subCoP1");
         tParams.addParam("KB.community.hasSubCoPs$2", "subCoP2");
         tParams.addParam("KB.community.hasSubCoPs$3", "subCoP3");
         tParams.addParam("KB.community.since", "20x02-12-02");

         Document tGenDoc = tMapper.buildXmlWithSchema(tParams, true /*complete*/, false /*CDATA as text*/);
         System.out.println(DOM.serializeToString(tGenDoc, "ISO-8859-1"));

         KFMSystem.log.setLogLevel(KFMLog.DEBUG_LEVEL);
         XmlValidator tValidator = new XmlValidator(KFMSystem.log);
         tValidator.reparseDom(tGenDoc, "KB.community");


         // Test 2: serializeToHttpParams
         System.out.println("\n\nserializeToHttpParams:\n----------------------");

         String tXmlFile = "O:/KFM/www-docs/public/Portal/SieMap/DTD/KB_Community.xml";
         Document tXmlDoc = DOM.parseToDOM(new File(tXmlFile), true);
         HttpParams tParamsGen = (HttpParams)tMapper.serializeToHttpParams(
                 tXmlDoc,
                 "KnowledgeBean");

         Enumeration tParamNames = tParamsGen.getParameterNames();
         String tName = null;
         while (tParamNames.hasMoreElements()) {
             tName = (String)tParamNames.nextElement();
             System.out.println(tName + " = " + tParamsGen.getParam(tName));
         }
     }
View Full Code Here

Examples of KFM.GUI.HttpParams

     {
         // The currently worked parameter (called path because we use here the parameter's
         // dot-syntax that represents the path in the tree from the root down to the leaf.
         String tCurrentPath;

         RequestUrl tParams = new HttpParams();

         String tElementValue = null;
         String tNewPath = null;
         String tXPathExpression = null;
         for (int i = 0; i < mKeyOrder.size(); i++) {
             tCurrentPath = (String)mKeyOrder.get(i);

             // map mKeyPrefix to aDocPrefix in aCurrentPath
             // e.g. "KB.community.sponsor$2.url" -> "KnowledgeBean.sponsor$2.url"
             tNewPath = aDocPrefix + "." + tCurrentPath.substring(mKeyPrefix.length() + 1);
             tXPathExpression = constructXPathFromParam(tNewPath);
             tElementValue = DOM.applyXPath(aDocument, tXPathExpression);

             // Value exists corresponding to the possible Key.
             // (null means: element is missing, "" means: empty element)
             if (! (tElementValue == null || "".equals(tElementValue))) {
                 tParams.addParam(tCurrentPath, tElementValue);
                 // System.out.println("* " + tCurrentPath + " = " + tElementValue);
             }
         }

         return tParams;
View Full Code Here

Examples of org.apache.commons.httpclient.params.HttpParams

        }
    }

    private void checkDate(String date) throws Exception {
        Header header = new Header("Set-Cookie", "custno=12345;Expires='"+date+"';");
        HttpParams params = new DefaultHttpParamsFactory().getDefaultParams();
        CookieSpec cookiespec = new CookieSpecBase();
        cookiespec.setValidDateFormats(
                (Collection)params.getParameter(HttpMethodParams.DATE_PATTERNS));
        cookieParse(cookiespec, "localhost", 80, "/", false, header);
    }
View Full Code Here

Examples of org.apache.http.params.HttpParams

    /**
     * get HTTP protocol parameters to which the listener must adhere to
     * @return the applicable HTTP protocol parameters
     */
    private HttpParams getListenerParameters() {
        HttpParams params = new BasicHttpParams();
        NHttpConfiguration cfg = NHttpConfiguration.getInstance();
        params
            .setIntParameter(HttpConnectionParams.SO_TIMEOUT,
                cfg.getProperty(HttpConnectionParams.SO_TIMEOUT, 60000))
            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE,
                cfg.getProperty(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024))
            .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK,
                cfg.getProperty(HttpConnectionParams.STALE_CONNECTION_CHECK, 0) == 1)
            .setBooleanParameter(HttpConnectionParams.TCP_NODELAY,
                cfg.getProperty(HttpConnectionParams.TCP_NODELAY, 1) == 1)
            .setParameter(HttpProtocolParams.ORIGIN_SERVER, "Synapse-HttpComponents-NIO");

        if (cfg.getBooleanValue(NIOReactorPNames.INTEREST_OPS_QUEUEING, false)) {
            params.setBooleanParameter(NIOReactorPNames.INTEREST_OPS_QUEUEING, true);
        }
        return params;
    }
View Full Code Here

Examples of org.apache.http.params.HttpParams

        }

        preserveUserAgentHeader = NHttpConfiguration.getInstance().isPreserveUserAgentHeader();
        preserveServerHeader = NHttpConfiguration.getInstance().isPreserveServerHeader();

        HttpParams params = getClientParameters();
        try {
            String prefix = (sslContext == null ? "http" : "https") + "-Sender I/O dispatcher";
            ioReactor = new DefaultConnectingIOReactor(
                NHttpConfiguration.getInstance().getClientIOWorkers(),
                new NativeThreadFactory(new ThreadGroup(prefix + " thread group"), prefix), params);
View Full Code Here

Examples of org.apache.http.params.HttpParams

     * get HTTP protocol parameters to which the sender must adhere to
     * @return the applicable HTTP protocol parameters
     */
    private HttpParams getClientParameters() {
        NHttpConfiguration cfg = NHttpConfiguration.getInstance();
        HttpParams params = new BasicHttpParams();
        params
            .setIntParameter(HttpConnectionParams.SO_TIMEOUT,
                cfg.getProperty(HttpConnectionParams.SO_TIMEOUT, 60000))
            .setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT,
                cfg.getProperty(HttpConnectionParams.CONNECTION_TIMEOUT, 10000))
            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE,
                cfg.getProperty(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024))
            .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK,
                cfg.getProperty(HttpConnectionParams.STALE_CONNECTION_CHECK, 0) == 1)
            .setBooleanParameter(HttpConnectionParams.TCP_NODELAY,
                cfg.getProperty(HttpConnectionParams.TCP_NODELAY, 1) == 1)
            .setParameter(HttpProtocolParams.USER_AGENT, "Synapse-HttpComponents-NIO");

        if (cfg.getBooleanValue(NIOReactorPNames.INTEREST_OPS_QUEUEING, false)) {
            params.setBooleanParameter(NIOReactorPNames.INTEREST_OPS_QUEUEING, true);
        }
        return params;
    }
View Full Code Here

Examples of org.apache.http.params.HttpParams

  }

  private void doSimpleGetRequest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/");
    HttpResponse response = httpclient.execute(httpget);
    List<String> expectedHeaders = Arrays.asList(new String[] {"Server", "Date", "Content-Length", "Etag", "Connection"});
View Full Code Here

Examples of org.apache.http.params.HttpParams

   */
  @Test
  public void wTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/w");
    HttpResponse response = httpclient.execute(httpget);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.