Package nexj.core.util

Examples of nexj.core.util.HTTPClient$Cookie


      checkAttributes();

      try
      {
         m_httpClient = new HTTPClient();

         attemptLogin(); // login

         sEditToken = getEditToken(); // get edit token for target page
         log("Edit token: " + sEditToken, Project.MSG_DEBUG);
View Full Code Here


   /**
    * @see nexj.core.tools.GenericTool#execute(java.lang.String)
    */
   protected void execute(String sCommand) throws Exception
   {
      HTTPClient client = new HTTPClient();

      client.setPasswordProvider(new PasswordAuthenticationProvider()
      {
         public PasswordAuthentication getPasswordAuthentication()
         {
            return new PasswordAuthentication("nexjsa", "nexj".toCharArray());
         }

         public boolean isAuthenticationDeterministic()
         {
            return true;
         }
      });

      int nReqCount = Integer.parseInt(getProperty("req.count", "1"));

      final Request request = new Request();
      TransferObject tobj = new TransferObject();
     
      tobj.setClassName("TestMessage");
      tobj.setEventName("runTest");
     
      request.addInvocation(tobj);
      request.setAsync(StringUtil.parseBoolean(getProperty("async", "0")));

      for (int nReq = 0; nReq < nReqCount; ++ nReq)
      {
         Object response = client.invoke(new URI(getProperty("url", "http://localhost:8080/nexj/text")), HTTP.METHOD_POST,
            new HTTPClient.RequestHandler()
            {
               public void handleRequest(HTTPClient client, OutputStream ostream) throws IOException
               {
                  Writer writer = new OutputStreamWriter(ostream, XMLUtil.ENCODING);
  
                  new TextMarshaller(null).serialize(request, writer);
                  writer.close();
               }
            },
            new HTTPClient.ResponseHandler()
            {
               public Object handleResponse(HTTPClient client, InputStream istream) throws IOException
               {
                  int nResult = client.getResponseStatus();
  
                  if (nResult != HTTP.STATUS_OK)
                  {
                     RuntimeException e = null;
  
                     if (nResult == HTTP.STATUS_UNAUTHORIZED ||
                        nResult == HTTP.STATUS_FORBIDDEN)
                     {
                        e = new LoginException("err.auth.login");
                     }
  
                     if (e == null || e.getCause() == null)
                     {
                        RuntimeException x = new HTTPException(nResult, client.getResponseMessage());
  
                        if (e == null)
                        {
                           e = x;
                        }
View Full Code Here

      try
      {
         if (m_client == null)
         {
            m_client = new HTTPClient();
         }

         m_client.setTrustedCertificate(m_channel.getTrustedCertificate());
         m_client.setReadTimeout(m_channel.getReadTimeout());
         m_client.setConnectionTimeout(m_channel.getConnectionTimeout());
View Full Code Here

TOP

Related Classes of nexj.core.util.HTTPClient$Cookie

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.