本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例6: handleError
import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public void handleError(Throwable t) {
super.handleError(t);
ReflectionUtils.rethrowRuntimeException(t);
}
示例7: getResult
import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
public T getResult() {
if (this.exception != null) {
ReflectionUtils.rethrowRuntimeException(this.exception);
}
return this.result;
}