Package org.cruxframework.crux.core.server.rest.spi

Examples of org.cruxframework.crux.core.server.rest.spi.InternalServerErrorException


    this.method = method;
    this.genericReturnType = ClassUtils.getGenericReturnTypeOfGenericInterfaceMethod(clazz, method);
    this.hasReturnType = genericReturnType != null && !genericReturnType.equals(Void.class) && !genericReturnType.equals(Void.TYPE);
    if (!hasReturnType && httpMethod.equals("GET"))
    {
      throw new InternalServerErrorException("Invalid rest method: " + method.toString() + ". @GET methods " +
          "can not be void.", "Can not execute requested service");
    }

    this.methodInvoker = new MethodInvoker(resourceClass, method, httpMethod);
    this.cacheInfo = HttpMethodHelper.getCacheInfoForGET(method);
View Full Code Here


    {
      throw e;
    }
    catch (Exception e)
    {
      throw new InternalServerErrorException("Error invoking rest service endpoint", "Error processing requested service", e);
    }
  }
View Full Code Here

        retVal = getReturnedValue(request, getReturnWriter().writeValueAsString(rtn));
      }
    }
    catch (Exception e)
    {
      throw new InternalServerErrorException("Error serializing rest service return", "Error processing requested service", e);
    }
    return new MethodReturn(hasReturnType, retVal, exeptionData, cacheInfo, null, isEtagGenerationEnabled());
  }
View Full Code Here

    {
      return EncryptUtils.hash(s);
    }
    catch (NoSuchAlgorithmException ns)
    {
      throw new InternalServerErrorException("Error generating MD5 hash for String["+s+"]", "Error processing requested service", ns);
    }
  }
View Full Code Here

  public Object inject(HttpRequest request)
  {
    List<String> list = request.getUri().getPathParameters(true).get(paramName);
    if (list == null)
    {
      throw new InternalServerErrorException("Unknown @PathParam: " + paramName + " for path: " + request.getUri().getPath(), "Can not execute requested service with informed params.");
    }
    if (list != null && list.size() > 0)
    {
      return extractValue(list.get(list.size() - 1));
    }
View Full Code Here

  public GroupValueInjector(RestParameterType restParameterType, Type type, String paramPrefix)
    {
    this.baseClass = ClassUtils.getRawType(type);
    if (!isAllowedComplexType(baseClass))
    {
      throw new InternalServerErrorException("Invalid rest parameter for rest method: " + baseClass.getCanonicalName() + ". Type not allowed for " +
          "this type of parameter. It can only be passed as a body parameter", "Can not execute requested service");
    }
    List<PropertyInfo> writeableProperties = new ArrayList<PropertyInfo>();
    PropertyInfo[] properties = ClassUtils.extractBeanPropertiesInfo(type);
View Full Code Here

    {
      throw (RestFailure)cause;
    }
    else
    {
      throw new InternalServerErrorException("Can not execute requested service. Unchecked Exception occurred on method: "+method.toString(),
          "Can not execute requested service", cause);
    }
    }
View Full Code Here

      Object result = method.invoke(resource, args);
      return result;
    }
    catch (IllegalAccessException e)
    {
      throw new InternalServerErrorException("Not allowed to reflect on method: " + method.toString(), "Can not execute requested service", e);
    }
    catch (InvocationTargetException e)
    {
      return restErrorHandler.handleError(e);
    }
    catch (IllegalArgumentException e)
    {
      String msg = "Bad arguments passed to " + method.toString() + "  (";
      if (args != null)
      {
        boolean first = false;
        for (Object arg : args)
        {
          if (!first)
          {
            first = true;
          }
          else
          {
            msg += ",";
          }
          if (arg == null)
          {
            msg += " null";
            continue;
          }
          msg += " " + arg.getClass().getName();
        }
      }
      msg += " )";
      throw new InternalServerErrorException(msg, "Can not execute requested service", e);
    }
  }
View Full Code Here

          }
          if (paramInjector instanceof MessageBodyParamInjector)
          {
          if (hasBodyParam)
          {
            throw new InternalServerErrorException("Invalid rest method: " + method.toString() + ". Can not receive " +
                "more than one parameter through body text", "Can not execute requested service");
          }
            hasBodyParam = true;
          }
        }

    if (hasBodyParam && hasFormParam)
    {
      throw new InternalServerErrorException("Invalid rest method: " + method.toString() + ". Can not use both " +
          "types on the same method: FormParam and BodyParam", "Can not execute requested service");
    }
    if ((hasBodyParam || hasFormParam) && httpMethod.equals("GET"))
    {
      throw new InternalServerErrorException("Invalid rest method: " + method.toString() + ". Can not receive " +
          "parameters on body for GET methods.", "Can not execute requested service");
    }
    }
View Full Code Here

        try
        {
          methodRegistrationInfo = processMethod(base, clazz, method, restMethodNames)
        } catch (Exception e)
        {
          throw new InternalServerErrorException("Error to processMethod: " + method.toString(), "Can not execute requested service", e);
        }
        if (methodRegistrationInfo != null)
        {
          List<RestMethodRegistrationInfo> methodsForPath = validRestMethods.get(methodRegistrationInfo.pathExpression);
          if (methodsForPath == null)
View Full Code Here

TOP

Related Classes of org.cruxframework.crux.core.server.rest.spi.InternalServerErrorException

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.