public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null) {
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    switch (__method.intValue()) {
      case 0: // org/eclipse/persistence/internal/remotecommand/corba/sun/SunCORBAConnection/executeCommand
        {
          byte[] commandData =
              org.eclipse.persistence.internal.sessions.coordination.corba.sun.CommandDataHelper
                  .read(in);
          byte[] $result = null;
          $result = this.executeCommand(commandData);
          out = $rh.createReply();
          org.eclipse.persistence.internal.sessions.coordination.corba.sun.CommandDataHelper.write(
              out, $result);
          break;
        }
      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  }
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {
      case 0: // at/owlsoft/owl/corbamodel/ISearchFieldDefinition/getKey
        {
          String $result = null;
          $result = this.getKey();
          out = $rh.createReply();
          out.write_string($result);
          break;
        }

      case 1: // at/owlsoft/owl/corbamodel/ISearchFieldDefinition/getLabel
        {
          String $result = null;
          $result = this.getLabel();
          out = $rh.createReply();
          out.write_string($result);
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {

        // bind initial name
      case 0: // activation/InitialNameService/bind
        {
          try {
            String name = in.read_string();
            org.omg.CORBA.Object obj = org.omg.CORBA.ObjectHelper.read(in);
            boolean isPersistant = in.read_boolean();
            this.bind(name, obj, isPersistant);
            out = $rh.createReply();
          } catch (com.sun.corba.se.spi.activation.InitialNameServicePackage.NameAlreadyBound $ex) {
            out = $rh.createExceptionReply();
            com.sun.corba.se.spi.activation.InitialNameServicePackage.NameAlreadyBoundHelper.write(
                out, $ex);
          }
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
Example #4
0
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {
      case 0: // corbaserver/Corba/getAverage
        {
          corba.server.Payload payload = corba.server.PayloadHelper.read(in);
          double $result[] = null;
          $result = this.getAverage(payload);
          out = $rh.createReply();
          corba.server.ArrayHelper.write(out, $result);
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {
      case 0: // HelloApp/Hello/sayHello
        {
          String $result = null;
          $result = this.sayHello();
          out = $rh.createReply();
          out.write_string($result);
          break;
        }

        // declaracion de la operacion
      case 1: // HelloApp/Hello/shutdown
        {
          this.shutdown();
          out = $rh.createReply();
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {
      case 0: // br/ufes/inf/lprm/generated/BuildingCommandDataWrapper/getCommandType
        {
          br.ufes.inf.lprm.generated.BuildingCommandType $result = null;
          $result = this.getCommandType();
          out = $rh.createReply();
          br.ufes.inf.lprm.generated.BuildingCommandTypeHelper.write(out, $result);
          break;
        }

      case 1: // br/ufes/inf/lprm/generated/BuildingCommandDataWrapper/getCommandData
        {
          org.omg.CORBA.Object $result = null;
          $result = this.getCommandData();
          out = $rh.createReply();
          org.omg.CORBA.ObjectHelper.write(out, $result);
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
  public org.omg.CORBA.portable.OutputStream _invoke(
      String method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler rh) {
    org.omg.CORBA.portable.OutputStream out = rh.createReply();
    java.lang.Integer __method = (java.lang.Integer) _methods.get(method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {
      case 0: // org/eclipse/persistence/testing/Remote/SunCORBA/CORBAServerManager/createRemoteSessionController
        {
          org.eclipse.persistence.sessions.remote.corba.sun.CORBARemoteSessionController __result =
              null;
          __result = this.createRemoteSessionController();
          org.eclipse.persistence.sessions.remote.corba.sun.CORBARemoteSessionControllerHelper
              .write(out, __result);
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
Example #8
0
 private synchronized void calcInterval() {
   int i = 0x7fffffff;
   int j = 0x80000000;
   synchronized (activeMonitors) {
     java.util.Iterator iterator = activeMonitors.values().iterator();
     while (iterator.hasNext()) {
       Monitor monitor = (Monitor) iterator.next();
       int k = monitor.getInterval();
       if (k < i) {
         i = k;
       }
       if (k > j) {
         j = k;
       }
     }
   }
   if (i != minInterval.intValue()) {
     synchronized (minInterval) {
       minInterval = new Integer(i);
       if (getMetricDataTimer != null) {
         getMetricDataTimer.cancel();
       }
       if (activeMonitors.size() != 0) {
         getMetricDataTimer = new Timer(true);
         getMetricDataTimer.scheduleAtFixedRate(
             new GetMetricDataTask(this), (i * 1000) / 4, (i * 1000) / 2);
       }
     }
   }
   if (j != maxInterval.intValue()) {
     synchronized (maxInterval) {
       maxInterval = new Integer(j);
     }
   }
 }
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {

        /**
         * Method used to cause ORB to activate the named adapter, if possible. This will cause the
         * named POA to register itself with the activator as a side effect. This should always
         * happen before this call can complete. This method returns true if adapter activation
         * succeeded, otherwise it returns false.
         */
      case 0: // PortableActivationIDL/ORBProxy/activate_adapter
        {
          String name[] = org.omg.PortableInterceptor.AdapterNameHelper.read(in);
          boolean $result = false;
          $result = this.activate_adapter(name);
          out = $rh.createReply();
          out.write_boolean($result);
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
Example #10
0
 public Model_Cat(PListObject plistObject) {
   Map<java.lang.String, PListObject> map = ((Dict) plistObject).getConfigMap();
   this.CatID = java.lang.Integer.parseInt(map.get(CatID).toString());
   this.SCatID = java.lang.Integer.parseInt(map.get(SCatID).toString());
   this.Name = map.get(Name).toString();
   this.Detail = map.get(Detail).toString();
   this.PictureURL = map.get(PictureURL).toString();
 }
  public static void main(String[] args) throws IOException {
    long readfilelen = 0;
    BufferedRandomAccessFile brafReadFile, brafWriteFile;

    brafReadFile = new BufferedRandomAccessFile("C:\\WINNT\\Fonts\\STKAITI.TTF");
    readfilelen = brafReadFile.initfilelen;
    brafWriteFile = new BufferedRandomAccessFile(".\\STKAITI.001", "rw", 10);

    byte buf[] = new byte[1024];
    int readcount;

    long start = System.currentTimeMillis();

    while ((readcount = brafReadFile.read(buf)) != -1) {
      brafWriteFile.write(buf, 0, readcount);
    }

    brafWriteFile.close();
    brafReadFile.close();

    System.out.println(
        "BufferedRandomAccessFile Copy & Write File: "
            + brafReadFile.filename
            + "    FileSize: "
            + java.lang.Integer.toString((int) readfilelen >> 1024)
            + " (KB)    "
            + "Spend: "
            + (double) (System.currentTimeMillis() - start) / 1000
            + "(s)");

    java.io.FileInputStream fdin = new java.io.FileInputStream("C:\\WINNT\\Fonts\\STKAITI.TTF");
    java.io.BufferedInputStream bis = new java.io.BufferedInputStream(fdin, 1024);
    java.io.DataInputStream dis = new java.io.DataInputStream(bis);

    java.io.FileOutputStream fdout = new java.io.FileOutputStream(".\\STKAITI.002");
    java.io.BufferedOutputStream bos = new java.io.BufferedOutputStream(fdout, 1024);
    java.io.DataOutputStream dos = new java.io.DataOutputStream(bos);

    start = System.currentTimeMillis();

    for (int i = 0; i < readfilelen; i++) {
      dos.write(dis.readByte());
    }

    dos.close();
    dis.close();

    System.out.println(
        "DataBufferedios Copy & Write File: "
            + brafReadFile.filename
            + "    FileSize: "
            + java.lang.Integer.toString((int) readfilelen >> 1024)
            + " (KB)    "
            + "Spend: "
            + (double) (System.currentTimeMillis() - start) / 1000
            + "(s)");
  }
Example #12
0
 public void setPenColor(java.awt.Color color) {
   super.setPenColor(color);
   java.lang.Integer integer = (java.lang.Integer) colorMap.get(color);
   if (integer == null) {
     colorIndex = image.colorAllocate(color.getRed(), color.getGreen(), color.getBlue());
     colorMap.put(color, new Integer(colorIndex));
   } else {
     colorIndex = integer.intValue();
   }
 }
Example #13
0
  public static String bytesToHex(byte[] data) {
    if (data == null) {
      return null;
    }

    int len = data.length;
    String str = "";
    for (int i = 0; i < len; i++) {
      if ((data[i] & 0xFF) < 16) str = str + "0" + java.lang.Integer.toHexString(data[i] & 0xFF);
      else str = str + java.lang.Integer.toHexString(data[i] & 0xFF);
    }
    return str;
  }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   final Individuals other = (Individuals) obj;
   if (indId == null) {
     if (other.indId != null) return false;
   } else if (!indId.equals(other.indId)) return false;
   if (indFname == null) {
     if (other.indFname != null) return false;
   } else if (!indFname.equals(other.indFname)) return false;
   if (indMname == null) {
     if (other.indMname != null) return false;
   } else if (!indMname.equals(other.indMname)) return false;
   if (indLname == null) {
     if (other.indLname != null) return false;
   } else if (!indLname.equals(other.indLname)) return false;
   if (indEmail == null) {
     if (other.indEmail != null) return false;
   } else if (!indEmail.equals(other.indEmail)) return false;
   if (indQualification == null) {
     if (other.indQualification != null) return false;
   } else if (!indQualification.equals(other.indQualification)) return false;
   if (indAreaOfExperties == null) {
     if (other.indAreaOfExperties != null) return false;
   } else if (!indAreaOfExperties.equals(other.indAreaOfExperties)) return false;
   if (indExperinceYears == null) {
     if (other.indExperinceYears != null) return false;
   } else if (!indExperinceYears.equals(other.indExperinceYears)) return false;
   if (indAboutExperience == null) {
     if (other.indAboutExperience != null) return false;
   } else if (!indAboutExperience.equals(other.indAboutExperience)) return false;
   if (indCellno == null) {
     if (other.indCellno != null) return false;
   } else if (!indCellno.equals(other.indCellno)) return false;
   if (indAddress == null) {
     if (other.indAddress != null) return false;
   } else if (!indAddress.equals(other.indAddress)) return false;
   if (indCity == null) {
     if (other.indCity != null) return false;
   } else if (!indCity.equals(other.indCity)) return false;
   if (indState == null) {
     if (other.indState != null) return false;
   } else if (!indState.equals(other.indState)) return false;
   if (indCreationDate == null) {
     if (other.indCreationDate != null) return false;
   } else if (!indCreationDate.equals(other.indCreationDate)) return false;
   return true;
 }
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {
      case 0: // CosTransactions/NonTxTargetPolicy/_get_tpv
        {
          short $result = (short) 0;
          $result = this.tpv();
          out = $rh.createReply();
          out.write_ushort($result);
          break;
        }

      case 1: // org/omg/CORBA/Policy/_get_policy_type
        {
          int $result = (int) 0;
          $result = this.policy_type();
          out = $rh.createReply();
          out.write_ulong($result);
          break;
        }

      case 2: // org/omg/CORBA/Policy/copy
        {
          org.omg.CORBA.Policy $result = null;
          $result = this.copy();
          out = $rh.createReply();
          org.omg.CORBA.PolicyHelper.write(out, $result);
          break;
        }

      case 3: // org/omg/CORBA/Policy/destroy
        {
          this.destroy();
          out = $rh.createReply();
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
Example #16
0
File: set.java Project: wcyuan/Set
      public static void main(String[] args) {

        if (args.length < 3) return;

        int a = java.lang.Integer.parseInt(args[0]);
        int b = java.lang.Integer.parseInt(args[1]);
        int c = java.lang.Integer.parseInt(args[2]);
        int mask = 1, div = 3;
        int x, y, z;
        // a--; b--; c--;
        for (int i = 0; i < 4; i++) {
          x = (a % div);
          y = (b % div);
          z = (c % div);
          System.out.println(
              "mask: " + mask + " div: " + div + " x: " + x + " y: " + y + " z: " + z);
          x /= mask;
          y /= mask;
          z /= mask;
          if (!(x == y && x == z) && !(x != y && x != z && y != z)) {
            System.out.println(
                "mask: " + mask + " div: " + div + " x: " + x + " y: " + y + " z: " + z);
            return;
          }
          mask *= 3;
          div *= 3;
        }
        return;

        /*
          if (IsSet(java.lang.Integer.parseInt(args[0]),
          java.lang.Integer.parseInt(args[1]),
          java.lang.Integer.parseInt(args[2])))
          {
          System.out.println("YES");
          } else
          {
          System.out.println("NO");
          }

          Cards c = new Cards(21);
          for (int j = 0; j < 2; j++)
          for (int i = 0; i < 21; i++)
          {
          System.out.println(i + " " + c.NextCard());
          }
        */
      }
Example #17
0
  // #line 90
  private static java.lang.Thread startTimeoutTimer() {

    // #line 91
    final int seconds =
        /* template:place-check { */ ((java.lang.Integer)
                x10.lang.Runtime.hereCheck(
                    java.lang.Integer.getInteger("x10test.timeout", 300))) /* } */
            .intValue();

    // #line 93
    java.lang.Thread timer =
        new java.lang.Thread(
            new java.lang.Runnable() {

              // #line 94
              public void run() {

                // #line 95
                if (x10.lang.Runtime.sleep(seconds * 1000)) {

                  // #line 96
                  x10.lang.Runtime.exit(128);
                }
              }
            });

    // #line 100
    /* template:place-check { */ ((java.lang.Thread) x10.lang.Runtime.hereCheck(timer)) /* } */
        .start();

    // #line 101
    return timer;
  }
 public int compareTo(Integer other) {
   if (other instanceof ScalableInt32) {
     return java.lang.Integer.compare(this.value, ((ScalableInt32) other).value);
   } else {
     return asBigInteger().compareTo(other.asBigInteger());
   }
 }
Example #19
0
  /**
   * 加密(使用DES算法)
   *
   * @param txt 需要加密的文本
   * @param key 密钥
   * @return 成功加密的文本
   * @throws InvalidKeySpecException
   * @throws InvalidKeyException
   * @throws NoSuchPaddingException
   * @throws IllegalBlockSizeException
   * @throws BadPaddingException
   */
  private static String enCrypto(String txt, String key)
      throws InvalidKeySpecException, InvalidKeyException, NoSuchPaddingException,
          IllegalBlockSizeException, BadPaddingException {
    StringBuffer sb = new StringBuffer();
    DESKeySpec desKeySpec = new DESKeySpec(key.getBytes());
    SecretKeyFactory skeyFactory = null;
    Cipher cipher = null;
    try {
      skeyFactory = SecretKeyFactory.getInstance("DES");
      cipher = Cipher.getInstance("DES");
    } catch (NoSuchAlgorithmException e) {
      e.printStackTrace();
    }
    SecretKey deskey = skeyFactory != null ? skeyFactory.generateSecret(desKeySpec) : null;
    if (cipher != null) {
      cipher.init(Cipher.ENCRYPT_MODE, deskey);
    }
    byte[] cipherText = cipher != null ? cipher.doFinal(txt.getBytes()) : new byte[0];
    for (int n = 0; n < cipherText.length; n++) {
      String stmp = (java.lang.Integer.toHexString(cipherText[n] & 0XFF));

      if (stmp.length() == 1) {
        sb.append("0" + stmp);
      } else {
        sb.append(stmp);
      }
    }
    return sb.toString().toUpperCase();
  }
Example #20
0
 @Override
 public Object stringToObject(String value) {
   if (value == null || value.isEmpty()) {
     return null;
   }
   return java.lang.Integer.parseInt(value);
 }
 /**
  * CAUTION: Decompiled by hand.
  *
  * @return
  */
 public int getPort() {
   try {
     return java.lang.Integer.parseInt(getProperty("port"));
   } catch (java.lang.Exception exception) {
     return 22;
   }
 }
Example #22
0
  public Child() {

    URI = java.lang.Integer.toString(System.identityHashCode(this));
    this.version = 0L;
    this.AuthorID = 0;
    this.Index = 0;
  }
Example #23
0
 public void setValue(String value) {
   try {
     this.value = getEntry(value, values);
   } catch (KMIPEnumUndefinedKeyException e) {
     try {
       int intValue;
       if (value.length() > 1 && value.substring(0, 2).equals("0x")) {
         intValue = java.lang.Integer.parseInt(value.substring(2), 16);
       } else {
         intValue = java.lang.Integer.parseInt(value);
       }
       this.value = getEntry(intValue, values);
     } catch (KMIPEnumUndefinedValueException e1) {
       e1.printStackTrace();
     }
   }
 }
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {
      case 0: // scs/execution_node/ContainerManager/registerContainer
        {
          try {
            String name = in.read_string();
            scs.core.IComponent ctr = scs.core.IComponentHelper.read(in);
            this.registerContainer(name, ctr);
            out = $rh.createReply();
          } catch (scs.execution_node.ContainerAlreadyExists $ex) {
            out = $rh.createExceptionReply();
            scs.execution_node.ContainerAlreadyExistsHelper.write(out, $ex);
          } catch (scs.execution_node.InvalidContainer $ex) {
            out = $rh.createExceptionReply();
            scs.execution_node.InvalidContainerHelper.write(out, $ex);
          }
          break;
        }

      case 1: // scs/execution_node/ContainerManager/unregisterContainer
        {
          try {
            String name = in.read_string();
            this.unregisterContainer(name);
            out = $rh.createReply();
          } catch (scs.core.InvalidName $ex) {
            out = $rh.createExceptionReply();
            scs.core.InvalidNameHelper.write(out, $ex);
          }
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke
  @Override
  protected byte[] send(
      final byte[] request, final URL responderURL, final RequestOptions requestOptions)
      throws IOException {
    int size = request.length;
    HttpURLConnection httpUrlConnection;
    if (size <= MAX_LEN_GET && requestOptions.isUseHttpGetForRequest()) {
      String b64Request = Base64.toBase64String(request);
      String urlEncodedReq = URLEncoder.encode(b64Request, "UTF-8");
      StringBuilder urlBuilder = new StringBuilder();
      String baseUrl = responderURL.toString();
      urlBuilder.append(baseUrl);
      if (!baseUrl.endsWith("/")) {
        urlBuilder.append('/');
      }
      urlBuilder.append(urlEncodedReq);

      URL newURL = new URL(urlBuilder.toString());

      httpUrlConnection = (HttpURLConnection) newURL.openConnection();
      httpUrlConnection.setRequestMethod("GET");
    } else {
      httpUrlConnection = (HttpURLConnection) responderURL.openConnection();
      httpUrlConnection.setDoOutput(true);
      httpUrlConnection.setUseCaches(false);

      httpUrlConnection.setRequestMethod("POST");
      httpUrlConnection.setRequestProperty("Content-Type", CT_REQUEST);
      httpUrlConnection.setRequestProperty("Content-Length", java.lang.Integer.toString(size));
      OutputStream outputstream = httpUrlConnection.getOutputStream();
      outputstream.write(request);
      outputstream.flush();
    }

    InputStream inputstream = httpUrlConnection.getInputStream();
    if (httpUrlConnection.getResponseCode() != HttpURLConnection.HTTP_OK) {
      inputstream.close();
      throw new IOException(
          "bad response: "
              + httpUrlConnection.getResponseCode()
              + "  "
              + httpUrlConnection.getResponseMessage());
    }
    String responseContentType = httpUrlConnection.getContentType();
    boolean isValidContentType = false;
    if (responseContentType != null) {
      if (responseContentType.equalsIgnoreCase(CT_RESPONSE)) {
        isValidContentType = true;
      }
    }
    if (!isValidContentType) {
      inputstream.close();
      throw new IOException("bad response: mime type " + responseContentType + " not supported!");
    }

    return IoUtil.read(inputstream);
  }
 public Packet fromHttpRequest(javax.servlet.http.HttpServletRequest argRequest, String argId) {
   org.apache.commons.lang3.Validate.notNull(argRequest);
   String lclIdString = argRequest.getParameter(argId);
   if (org.apache.commons.lang3.StringUtils.isBlank(lclIdString)) {
     return null;
   }
   java.lang.Integer lclId = java.lang.Integer.valueOf(lclIdString);
   return forId(lclId);
 }
Example #27
0
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null) {
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    switch (__method.intValue()) {
      case 0:
        {
          String apelidoOrigem = in.read_string();
          String mensagem = in.read_string();
          this.ReceberMensagemServidor(apelidoOrigem, mensagem);
          out = $rh.createReply();
          break;
        }

      case 1:
        {
          String apelido = in.read_string();
          String nome = in.read_string();
          this.ReceberNovaConexao(apelido, nome);
          out = $rh.createReply();
          break;
        }

      case 2:
        {
          String apelido = in.read_string();
          String nome = in.read_string();
          this.DesconexaoCliente(apelido, nome);
          out = $rh.createReply();
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  }
  /**
   * @param value
   * @param type
   * @return
   */
  private Object createTypedObject(String value, Class type) {
    if (java.lang.String.class == type) return value;
    else if (java.lang.Integer.class == type) return java.lang.Integer.parseInt(value);
    else if (java.lang.Long.class == type) return java.lang.Long.parseLong(value);
    else if (java.lang.Boolean.class == type) return java.lang.Boolean.parseBoolean(value);
    else if (java.lang.Float.class == type) return java.lang.Float.parseFloat(value);
    else if (java.lang.Double.class == type) return java.lang.Double.parseDouble(value);

    return null;
  }
Example #29
0
 /**
  * 二行制转字符串
  *
  * @param b
  * @return
  */
 public static String byte2hex(byte[] b) {
   String hs = "";
   String stmp = "";
   for (int n = 0; n < b.length; n++) {
     stmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
     if (stmp.length() == 1) hs = hs + "0" + stmp;
     else hs = hs + stmp;
   }
   return hs.toUpperCase();
 }
Example #30
0
  public org.omg.CORBA.portable.OutputStream _invoke(
      String $method,
      org.omg.CORBA.portable.InputStream in,
      org.omg.CORBA.portable.ResponseHandler $rh) {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer) _methods.get($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue()) {
      case 0: // MTalk/Peer/getInformations
        {
          String $result = null;
          $result = this.getInformations();
          out = $rh.createReply();
          out.write_string($result);
          break;
        }

        /**
         * @param numConvSideA : le numéro que l'appelant donne à la conversation vue de son côté.
         * @param subject : sujet de la conversation
         * @param myInformations : informations de l'appelant (username ou autre)
         * @param mytalkIor : Ior du talk que l'appelant crée pour la conversation (de son côté
         *     donc)
         */
      case 1: // MTalk/Peer/requestTalk
        {
          short numConvSideA = in.read_ushort();
          String subject = in.read_string();
          String myInformations = in.read_string();
          String mytalkIor = in.read_string();
          this.requestTalk(numConvSideA, subject, myInformations, mytalkIor);
          out = $rh.createReply();
          break;
        }

      default:
        throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke