예제 #1
0
  /**
   * Check if html client info already exists in servlet request as one of the attributes. If not,
   * parse HTML request parameter to get html client info a json string. Use it to construct html
   * client info object with HtmlClientInfoFactory. Note that carrier info is derived from
   * devicecarrierMapping file based on program code.
   *
   * @param request
   * @return HtmlClientInfo
   */
  protected HtmlClientInfo getClientInfo(HttpServletRequest request) {

    HtmlClientInfo clientInfo =
        (HtmlClientInfo) request.getAttribute(HtmlFrameworkConstants.HTML_CLIENT_INFO);
    if (clientInfo == null) {
      String clientInfoString = HtmlCommonUtil.filterLastPara(request.getParameter("clientInfo"));
      try {
        clientInfoString = URLDecoder.decode(clientInfoString, "UTF-8");
      } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      String clientWidth =
          HtmlCommonUtil.filterLastPara(
              request.getParameter(HtmlFrameworkConstants.CLIENT_INFO_KEY_WIDTH));
      String clientHeight =
          HtmlCommonUtil.filterLastPara(
              request.getParameter(HtmlFrameworkConstants.CLIENT_INFO_KEY_HEIGHT));
      String ssoToken =
          HtmlCommonUtil.filterLastPara(
              request.getParameter(HtmlFrameworkConstants.CLIENT_INFO_KEY_SSOTOKEN));

      clientInfo =
          HtmlClientInfoFactory.getInstance()
              .build(clientInfoString, clientWidth, clientHeight, ssoToken);
    }
    return clientInfo;
  }
  /**
   * TODO get server
   *
   * @return
   */
  public UserManagementServiceStub getServer() {

    UserManagementServiceStub server = null;
    try {
      server =
          new UserManagementServiceStub(
              HtmlCommonUtil.getWSContext(), WebServiceConfigurator.getUrlOfPoiReviewWrite());
    } catch (AxisFault e) {
      e.getCause();
    }

    return server;
  }
예제 #3
0
  /**
   * Get the cli client information from request.
   *
   * @param request
   * @return
   */
  private String getClientInfoFromRequest(HttpServletRequest request) {
    StringBuilder sb = new StringBuilder();
    HtmlClientInfo clientInfo =
        (HtmlClientInfo) request.getAttribute(HtmlFrameworkConstants.HTML_CLIENT_INFO);
    String userId = clientInfo.getUserId();
    if ("".equals(userId)) {
      userId =
          HtmlCommonUtil.getString(
              (String) request.getAttribute(HtmlFrameworkConstants.CLI_KEY_USERID));
    }
    String macAddress =
        HtmlCommonUtil.getString(
            (String) request.getAttribute(HtmlFrameworkConstants.CLI_KEY_MACADDRESS));
    String email =
        HtmlCommonUtil.getString(
            (String) request.getAttribute(HtmlFrameworkConstants.CLI_KEY_EMAIL));

    String servletPath = request.getServletPath();
    sb.append("ServletUrl=[").append(servletPath).append("]&");
    // hardcode ptn for cli search since we can't get PTN directly since 7.0
    sb.append("Ptn=[").append("HTML5").append("]&");
    sb.append("UserId=[").append(userId).append("]&");
    sb.append("macAddress=[").append(macAddress).append("]&");
    sb.append("email=[").append(email).append("]&");
    // sb.append("Pin=[").append(clientInfo.getPin()).append("]&");
    sb.append("ProgramCode=[").append(clientInfo.getProgramCode()).append("]&");
    // sb.append("Carrier=[").append(clientInfo.getCarrier()).append("]&");
    sb.append("Platform=[").append(clientInfo.getPlatform()).append("]&");
    // sb.append("Device=[").append(clientInfo.getDevice()).append("]&");
    sb.append("Version=[").append(clientInfo.getVersion()).append("]&");
    // sb.append("BuildNumber[").append(clientInfo.getBuildNo()).append("]&");
    sb.append("ProductType=[").append(clientInfo.getProduct()).append("]&");
    sb.append("Locale=[").append(clientInfo.getLocale()).append("]&");
    // sb.append("Region=[").append(clientInfo.getRegion()).append("]&");
    sb.append("screenWidth=[").append(clientInfo.getWidth()).append("]&");
    sb.append("screenHeight=[").append(clientInfo.getHeight()).append("]");

    return sb.toString();
  }