Пример #1
0
  /**
   * 访问服务器环境
   *
   * @param names 参数名字
   * @param values 参数值
   */
  public static void visitEnvServerByParameters(String[] names, String[] values) {
    int len = Math.min(ArrayUtils.getLength(names), ArrayUtils.getLength(values));
    String[] segs = new String[len];
    for (int i = 0; i < len; i++) {
      try {
        // 设计器里面据说为了改什么界面统一, 把分隔符统一用File.separator, 意味着在windows里面报表路径变成了\
        // 以前的超链, 以及预览url什么的都是/, 产品组的意思就是用到的地方替换下, 真恶心.
        String value = values[i].replaceAll("\\\\", "/");
        segs[i] =
            URLEncoder.encode(CodeUtils.cjkEncode(names[i]), EncodeConstants.ENCODING_UTF_8)
                + "="
                + URLEncoder.encode(CodeUtils.cjkEncode(value), "UTF-8");
      } catch (UnsupportedEncodingException e) {
        FRContext.getLogger().error(e.getMessage(), e);
      }
    }
    String postfixOfUri = (segs.length > 0 ? "?" + StableUtils.join(segs, "&") : StringUtils.EMPTY);

    if (FRContext.getCurrentEnv() instanceof RemoteEnv) {
      try {
        if (Utils.isEmbeddedParameter(postfixOfUri)) {
          String time = Calendar.getInstance().getTime().toString().replaceAll(" ", "");
          boolean isUserPrivilege =
              ((RemoteEnv) FRContext.getCurrentEnv()).writePrivilegeMap(time, postfixOfUri);
          postfixOfUri =
              isUserPrivilege
                  ? postfixOfUri
                      + "&fr_check_url="
                      + time
                      + "&id="
                      + FRContext.getCurrentEnv().getUserID()
                  : postfixOfUri;
        }

        String urlPath = getWebBrowserPath();
        Desktop.getDesktop().browse(new URI(urlPath + postfixOfUri));
      } catch (Exception e) {
        FRContext.getLogger().error("cannot open the url Successful", e);
      }
    } else {
      try {
        String web = GeneralContext.getCurrentAppNameOfEnv();
        String url =
            "http://localhost:"
                + DesignerEnvManager.getEnvManager().getJettyServerPort()
                + "/"
                + web
                + "/"
                + ConfigManager.getProviderInstance().getServletMapping()
                + postfixOfUri;
        StartServer.browerURLWithLocalEnv(url);
      } catch (Throwable e) {
        //
      }
    }
  }
Пример #2
0
 /** Append an integer as a four byte number. */
 public void appendInt(int x) {
   elems = ArrayUtils.ensureCapacity(elems, length + 3);
   elems[length] = (byte) ((x >> 24) & 0xFF);
   elems[length + 1] = (byte) ((x >> 16) & 0xFF);
   elems[length + 2] = (byte) ((x >> 8) & 0xFF);
   elems[length + 3] = (byte) ((x) & 0xFF);
   length = length + 4;
 }
Пример #3
0
 /** Append a character as a two byte number. */
 public void appendChar(int x) {
   elems = ArrayUtils.ensureCapacity(elems, length + 1);
   elems[length] = (byte) ((x >> 8) & 0xFF);
   elems[length + 1] = (byte) ((x) & 0xFF);
   length = length + 2;
 }
Пример #4
0
 /** Append `len' bytes from byte array, starting at given `start' offset. */
 public void appendBytes(byte[] bs, int start, int len) {
   elems = ArrayUtils.ensureCapacity(elems, length + len);
   System.arraycopy(bs, start, elems, length, len);
   length += len;
 }
Пример #5
0
 /** Append byte to this buffer. */
 public void appendByte(int b) {
   elems = ArrayUtils.ensureCapacity(elems, length);
   elems[length++] = (byte) b;
 }