Examples of GetMethod


Examples of org.hibernate.validator.internal.util.privilegedactions.GetMethod

      }
    }
    else {
      String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 );
      for ( String prefix : PROPERTY_ACCESSOR_PREFIXES ) {
        GetMethod action = GetMethod.action( clazz, prefix + methodName );
        if ( System.getSecurityManager() != null ) {
          member = AccessController.doPrivileged( action );
        }
        else {
          member = action.run();
        }
        if ( member != null ) {
          break;
        }
      }
View Full Code Here

Examples of org.hibernate.validator.util.GetMethod

   *         otherwise.
   */
  public boolean isMultiValueConstraint(Annotation annotation) {
    boolean isMultiValueConstraint = false;
    try {
      final GetMethod getMethod = GetMethod.action( annotation.getClass(), "value" );
      final Method method;
      if ( System.getSecurityManager() != null ) {
        method = AccessController.doPrivileged( getMethod );
      }
      else {
        method = getMethod.run();
      }
      if (method != null) {
        Class returnType = method.getReturnType();
        if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) {
          Annotation[] annotations = ( Annotation[] ) method.invoke( annotation );
View Full Code Here

Examples of org.hibernate.validator.util.privilegedactions.GetMethod

      }
    }
    else {
      String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 );
      for ( String prefix : PROPERTY_ACCESSOR_PREFIXES ) {
        GetMethod action = GetMethod.action( clazz, prefix + methodName );
        if ( System.getSecurityManager() != null ) {
          member = AccessController.doPrivileged( action );
        }
        else {
          member = action.run();
        }
        if ( member != null ) {
          break;
        }
      }
View Full Code Here

Examples of org.lilystudio.httpclient.GetMethod

      url = "http" + url.substring(4);
    } else {
      isGet = true;
      addParameter(relay, url, encoding);
    }
    IMethod httpMethod = isGet ? new GetMethod(url) : new PostMethod(url);
    // 设置客户端特殊的信息
    httpMethod.setRequestHeader("If-None-Match", request
        .getHeader("If-None-Match"));
    httpMethod.setRequestHeader("If-Modified-Since", request
        .getHeader("If-Modified-Since"));
    // 取出服务器端可能用到的Cookie信息
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
      StringBuilder s = new StringBuilder(64);
      for (Cookie cookie : cookies) {
        String name = cookie.getName();
        if (!name.equals("JSESSIONID")) {
          s.append(name).append('=').append(cookie.getValue()).append(';');
        }
      }
      UserInformation info = relay.getUserInformation(false);
      if (info != null) {
        Object o = info.getProperty(SESSION_COOKIE_KEY);
        if (o != null) {
          s.append(o);
        }
      }
      int len = s.length();
      if (len > 0) {
        s.setLength(len - 1);
      }
      httpMethod.setRequestHeader("Cookie", s.toString());
    }
    HttpClient httpClient = new HttpClient();
    httpClient.setAutoDecode(true);
    try {
      if (param != null) {
        if (!isGet) {
          PostMethod method = (PostMethod) httpMethod;
          int size = param.size();
          for (int i = 0; i < size; i++) {
            Parameter item = param.get(i);
            Object value = item.getValue(relay);
            method.addRequestBody(item.name, value != null ? URLDecoder.decode(
                value.toString(), encoding) : "");
          }
        }
      }
      while (true) {
        // 计算是否需要跳转
        int statusCode = 0;
        statusCode = httpClient.execute(httpMethod);
        if (statusCode == HttpServletResponse.SC_MOVED_PERMANENTLY
            || statusCode == HttpServletResponse.SC_MOVED_TEMPORARILY) {
          String locationHeader = httpClient.getResponseHeader("Location");
          if (locationHeader != null) {
            httpMethod = new GetMethod(locationHeader);
            continue;
          }
        }
        response.setStatus(statusCode);
        break;
View Full Code Here

Examples of our.apache.commons.httpclient.methods.GetMethod

        // Add the paramters (these should already be encoded)
        fullURL.append(paramString);

        // Now (finally!) create a http connection based on the url built up
        GetMethod method = new GetMethod(fullURL.toString());

        boolean succeeded = false;

        try {
            // Execute the request, synchonizing on the HTTPHelper to ensure
            // it's safe for use by multiple threads.
            synchronized(httpHelper) {
                int statusCode = httpHelper.executeRequest(method,
                        fullURL.toString());
               
                // Convert the response code to a binary "did this send work or not"
                succeeded = (statusCode == HttpURLConnection.HTTP_OK);
            }
        } finally {
            // Release the connection.
            method.releaseConnection();
        }

        // Return send status
        return succeeded;
    }
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.