当前位置: 首页>>代码示例>>Java>>正文


Java ParamException.getParameterName方法代码示例

本文整理汇总了Java中com.sun.jersey.api.ParamException.getParameterName方法的典型用法代码示例。如果您正苦于以下问题:Java ParamException.getParameterName方法的具体用法?Java ParamException.getParameterName怎么用?Java ParamException.getParameterName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jersey.api.ParamException的用法示例。


在下文中一共展示了ParamException.getParameterName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toResponse

import com.sun.jersey.api.ParamException; //导入方法依赖的package包/类
@Override
public Response toResponse(Exception e) {
  if (LOG.isTraceEnabled()) {
    LOG.trace("GOT EXCEPITION", e);
  }

  //clear content type
  response.setContentType(null);

  //Convert exception
  if (e instanceof ParamException) {
    final ParamException paramexception = (ParamException)e;
    e = new IllegalArgumentException("Invalid value for webhdfs parameter \""
        + paramexception.getParameterName() + "\": "
        + e.getCause().getMessage(), e);
  }
  if (e instanceof ContainerException) {
    e = toCause(e);
  }
  if (e instanceof RemoteException) {
    e = ((RemoteException)e).unwrapRemoteException();
  }

  if (e instanceof SecurityException) {
    e = toCause(e);
  }
  
  //Map response status
  final Response.Status s;
  if (e instanceof SecurityException) {
    s = Response.Status.FORBIDDEN;
  } else if (e instanceof AuthorizationException) {
    s = Response.Status.FORBIDDEN;
  } else if (e instanceof FileNotFoundException) {
    s = Response.Status.NOT_FOUND;
  } else if (e instanceof IOException) {
    s = Response.Status.FORBIDDEN;
  } else if (e instanceof UnsupportedOperationException) {
    s = Response.Status.BAD_REQUEST;
  } else if (e instanceof IllegalArgumentException) {
    s = Response.Status.BAD_REQUEST;
  } else {
    LOG.warn("INTERNAL_SERVER_ERROR", e);
    s = Response.Status.INTERNAL_SERVER_ERROR;
  }
 
  final String js = JsonUtil.toJsonString(e);
  return Response.status(s).type(MediaType.APPLICATION_JSON).entity(js).build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:50,代码来源:ExceptionHandler.java

示例2: exceptionCaught

import com.sun.jersey.api.ParamException; //导入方法依赖的package包/类
static DefaultFullHttpResponse exceptionCaught(Throwable cause) {
  Exception e = cause instanceof Exception ? (Exception) cause : new Exception(cause);

  if (LOG.isTraceEnabled()) {
    LOG.trace("GOT EXCEPITION", e);
  }

  //Convert exception
  if (e instanceof ParamException) {
    final ParamException paramexception = (ParamException)e;
    e = new IllegalArgumentException("Invalid value for webhdfs parameter \""
                                       + paramexception.getParameterName() + "\": "
                                       + e.getCause().getMessage(), e);
  } else if (e instanceof ContainerException || e instanceof SecurityException) {
    e = toCause(e);
  } else if (e instanceof RemoteException) {
    e = ((RemoteException)e).unwrapRemoteException();
  }

  //Map response status
  final HttpResponseStatus s;
  if (e instanceof SecurityException) {
    s = FORBIDDEN;
  } else if (e instanceof AuthorizationException) {
    s = FORBIDDEN;
  } else if (e instanceof FileNotFoundException) {
    s = NOT_FOUND;
  } else if (e instanceof IOException) {
    s = FORBIDDEN;
  } else if (e instanceof UnsupportedOperationException) {
    s = BAD_REQUEST;
  } else if (e instanceof IllegalArgumentException) {
    s = BAD_REQUEST;
  } else {
    LOG.warn("INTERNAL_SERVER_ERROR", e);
    s = INTERNAL_SERVER_ERROR;
  }

  final byte[] js = JsonUtil.toJsonString(e).getBytes(Charsets.UTF_8);
  DefaultFullHttpResponse resp =
    new DefaultFullHttpResponse(HTTP_1_1, s, Unpooled.wrappedBuffer(js));

  resp.headers().set(CONTENT_TYPE, APPLICATION_JSON_UTF8);
  resp.headers().set(CONTENT_LENGTH, js.length);
  return resp;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:47,代码来源:ExceptionHandler.java

示例3: exceptionCaught

import com.sun.jersey.api.ParamException; //导入方法依赖的package包/类
static DefaultFullHttpResponse exceptionCaught(Throwable cause) {
  Exception e = cause instanceof Exception ? (Exception) cause : new Exception(cause);

  if (LOG.isTraceEnabled()) {
    LOG.trace("GOT EXCEPTION", e);
  }

  //Convert exception
  if (e instanceof ParamException) {
    final ParamException paramexception = (ParamException)e;
    e = new IllegalArgumentException("Invalid value for webhdfs parameter \""
                                       + paramexception.getParameterName() + "\": "
                                       + e.getCause().getMessage(), e);
  } else if (e instanceof ContainerException || e instanceof SecurityException) {
    e = toCause(e);
  } else if (e instanceof RemoteException) {
    e = ((RemoteException)e).unwrapRemoteException();
  }

  //Map response status
  final HttpResponseStatus s;
  if (e instanceof SecurityException) {
    s = FORBIDDEN;
  } else if (e instanceof AuthorizationException) {
    s = FORBIDDEN;
  } else if (e instanceof FileNotFoundException) {
    s = NOT_FOUND;
  } else if (e instanceof IOException) {
    s = FORBIDDEN;
  } else if (e instanceof UnsupportedOperationException) {
    s = BAD_REQUEST;
  } else if (e instanceof IllegalArgumentException) {
    s = BAD_REQUEST;
  } else {
    LOG.warn("INTERNAL_SERVER_ERROR", e);
    s = INTERNAL_SERVER_ERROR;
  }

  final byte[] js = JsonUtil.toJsonString(e).getBytes(Charsets.UTF_8);
  DefaultFullHttpResponse resp =
    new DefaultFullHttpResponse(HTTP_1_1, s, Unpooled.wrappedBuffer(js));

  resp.headers().set(CONTENT_TYPE, APPLICATION_JSON_UTF8);
  resp.headers().set(CONTENT_LENGTH, js.length);
  return resp;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:47,代码来源:ExceptionHandler.java

示例4: toResponse

import com.sun.jersey.api.ParamException; //导入方法依赖的package包/类
@Override
public Response toResponse(Exception e) {
  if (LOG.isTraceEnabled()) {
    LOG.trace("GOT EXCEPITION", e);
  }

  //clear content type
  response.setContentType(null);

  //Convert exception
  if (e instanceof ParamException) {
    final ParamException paramexception = (ParamException)e;
    e = new IllegalArgumentException("Invalid value for webhdfs parameter \""
        + paramexception.getParameterName() + "\": "
        + e.getCause().getMessage(), e);
  }
  if (e instanceof ContainerException) {
    e = toCause(e);
  }
  if (e instanceof RemoteException) {
    e = ((RemoteException)e).unwrapRemoteException();
  }

  //Map response status
  final Response.Status s;
  if (e instanceof SecurityException) {
    s = Response.Status.UNAUTHORIZED;
  } else if (e instanceof AuthorizationException) {
    s = Response.Status.UNAUTHORIZED;
  } else if (e instanceof FileNotFoundException) {
    s = Response.Status.NOT_FOUND;
  } else if (e instanceof IOException) {
    s = Response.Status.FORBIDDEN;
  } else if (e instanceof UnsupportedOperationException) {
    s = Response.Status.BAD_REQUEST;
  } else if (e instanceof IllegalArgumentException) {
    s = Response.Status.BAD_REQUEST;
  } else {
    LOG.warn("INTERNAL_SERVER_ERROR", e);
    s = Response.Status.INTERNAL_SERVER_ERROR;
  }
 
  final String js = JsonUtil.toJsonString(e);
  return Response.status(s).type(MediaType.APPLICATION_JSON).entity(js).build();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:46,代码来源:ExceptionHandler.java

示例5: toResponse

import com.sun.jersey.api.ParamException; //导入方法依赖的package包/类
@Override
public Response toResponse(Exception e) {
  if (LOG.isTraceEnabled()) {
    LOG.trace("GOT EXCEPITION", e);
  }

  //clear content type
  response.setContentType(null);

  //Convert exception
  if (e instanceof ParamException) {
    final ParamException paramexception = (ParamException) e;
    e = new IllegalArgumentException(
        "Invalid value for webhdfs parameter \"" +
            paramexception.getParameterName() + "\": " +
            e.getCause().getMessage(), e);
  }
  if (e instanceof ContainerException) {
    e = toCause(e);
  }
  if (e instanceof RemoteException) {
    e = ((RemoteException) e).unwrapRemoteException();
  }

  //Map response status
  final Response.Status s;
  if (e instanceof SecurityException) {
    s = Response.Status.UNAUTHORIZED;
  } else if (e instanceof AuthorizationException) {
    s = Response.Status.UNAUTHORIZED;
  } else if (e instanceof FileNotFoundException) {
    s = Response.Status.NOT_FOUND;
  } else if (e instanceof IOException) {
    s = Response.Status.FORBIDDEN;
  } else if (e instanceof UnsupportedOperationException) {
    s = Response.Status.BAD_REQUEST;
  } else if (e instanceof IllegalArgumentException) {
    s = Response.Status.BAD_REQUEST;
  } else {
    LOG.warn("INTERNAL_SERVER_ERROR", e);
    s = Response.Status.INTERNAL_SERVER_ERROR;
  }

  final String js = JsonUtil.toJsonString(e);
  return Response.status(s).type(MediaType.APPLICATION_JSON).entity(js)
      .build();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:48,代码来源:ExceptionHandler.java

示例6: toResponse

import com.sun.jersey.api.ParamException; //导入方法依赖的package包/类
@Override
public Response toResponse(Exception e) {
  if (LOG.isTraceEnabled()) {
    LOG.trace("GOT EXCEPITION", e);
  }

  //clear content type
  response.setContentType(null);

  //Convert exception
  if (e instanceof ParamException) {
    final ParamException paramexception = (ParamException)e;
    e = new IllegalArgumentException("Invalid value for webhdfs parameter \""
        + paramexception.getParameterName() + "\": "
        + e.getCause().getMessage(), e);
  }
  if (e instanceof ContainerException) {
    e = toCause(e);
  }
  if (e instanceof RemoteException) {
    e = ((RemoteException)e).unwrapRemoteException();
  }

  //Map response status
  final Response.Status s;
  if (e instanceof SecurityException) {
    s = Response.Status.FORBIDDEN;
  } else if (e instanceof AuthorizationException) {
    s = Response.Status.FORBIDDEN;
  } else if (e instanceof FileNotFoundException) {
    s = Response.Status.NOT_FOUND;
  } else if (e instanceof IOException) {
    s = Response.Status.FORBIDDEN;
  } else if (e instanceof UnsupportedOperationException) {
    s = Response.Status.BAD_REQUEST;
  } else if (e instanceof IllegalArgumentException) {
    s = Response.Status.BAD_REQUEST;
  } else {
    LOG.warn("INTERNAL_SERVER_ERROR", e);
    s = Response.Status.INTERNAL_SERVER_ERROR;
  }
 
  final String js = JsonUtil.toJsonString(e);
  return Response.status(s).type(MediaType.APPLICATION_JSON).entity(js).build();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:46,代码来源:ExceptionHandler.java


注:本文中的com.sun.jersey.api.ParamException.getParameterName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。