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


Java ReflectionUtils.rethrowRuntimeException方法代码示例

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


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

示例1: run

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public Object run() {

    try {
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletResponse response = ctx.getResponse();

        if (!rateLimiter.tryAcquire()) {
            HttpStatus httpStatus = HttpStatus.TOO_MANY_REQUESTS;

            response.setContentType(MediaType.TEXT_PLAIN_VALUE);
            response.setStatus(httpStatus.value());
            ctx.setResponseStatusCode(httpStatus.value());
            ctx.setSendZuulResponse(false);
        }
    } catch (Exception e) {
        ReflectionUtils.rethrowRuntimeException(e);
    }
    return null;
}
 
开发者ID:kenly333,项目名称:service-hive,代码行数:21,代码来源:RateLimitZuulFilter.java

示例2: run

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public Object run() {
  try {
    RequestContext currentContext = RequestContext.getCurrentContext();
    HttpServletResponse response = currentContext.getResponse();

    if (!rateLimiter.tryAcquire()) {

      response.setContentType(MediaType.TEXT_PLAIN_VALUE);
      response.setStatus(this.tooManyRequests.value());
      response.getWriter().append(this.tooManyRequests.getReasonPhrase());

      currentContext.setSendZuulResponse(false);

      throw new ZuulException(this.tooManyRequests.getReasonPhrase(),
          this.tooManyRequests.value(),
          this.tooManyRequests.getReasonPhrase());
    }
  } catch (Exception e) {
    ReflectionUtils.rethrowRuntimeException(e);
  }
  return null;
}
 
开发者ID:drm317,项目名称:cloud-native-reference,代码行数:24,代码来源:ThrottlingPreFilter.java

示例3: run

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public Object run() {
    try {
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletRequest request = ctx.getRequest();
        Object blueOrGreen = request.getParameter("env");

        RequestMetadata requestMetadata = RequestMetadata.getCurrent().init();
        if (blueOrGreen != null ) {
            requestMetadata.add("env", "canary");
        } else {
            requestMetadata.add("env", "prod");
        }

    } catch (Exception e) {
        ReflectionUtils.rethrowRuntimeException(e);
    }
    return null;
}
 
开发者ID:kenly333,项目名称:service-hive,代码行数:20,代码来源:CanaryTestZuulFilter.java

示例4: asJson

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
private String asJson(Resource resource) {
    try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(resource.getInputStream()))) {
        Stream<String> lines = bufferedReader.lines();
        return lines.collect(Collectors.joining());
    } catch (Exception e) {
        ReflectionUtils.rethrowRuntimeException(e);
    }
    return null;
}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:testing-101,代码行数:10,代码来源:CustomerClientWiremockTest.java

示例5: run

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
public Object run() {
	RequestContext ctx = getCurrentContext();
	HttpServletRequest request = ctx.getRequest();
	// put the serviceId in `RequestContext`
	String port = request.getParameter("port");
	try {
		URL url = UriComponentsBuilder.fromUri(ctx.getRouteHost().toURI())
				.port(new Integer(port))
				.build().toUri().toURL();
		ctx.setRouteHost(url);
	} catch (Exception e) {
		ReflectionUtils.rethrowRuntimeException(e);
	}
	return null;
}
 
开发者ID:spring-cloud-samples,项目名称:sample-zuul-filters,代码行数:16,代码来源:QueryParamPortPreFilter.java

示例6: handleError

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public void handleError(Throwable t) {
	super.handleError(t);
	ReflectionUtils.rethrowRuntimeException(t);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:TaskUtils.java

示例7: getResult

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
public T getResult() {
	if (this.exception != null) {
		ReflectionUtils.rethrowRuntimeException(this.exception);
	}
	return this.result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:WebSphereUowTransactionManager.java


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