我们在这里运行RESTEasy 2.3.0.GA并且我正在努力使用https://stackoverflow.com/questions/18219237/jax-rs-path-regex-fails-for-just-one-of-an-or-expression我无法弄清楚如何让RESTEasy认为为什么它认为特定的URI没有映射我的经纪人。是否有一些调试级别可以让RESTEasy显示其调度?
答案 0 :(得分:3)
文档对于你会得到什么是模糊的,但Logger他们正在使用log4j,logback和java.util.logging。在我的例子中,将以下内容添加到logback.xml中会给我一些稀疏的信息。
<logger name="org.jboss.resteasy.core" level="debug" />
<logger name="org.jboss.resteasy.specimpl" level="debug" />
<logger name="org.jboss.resteasy.plugins.server" level="debug" />
答案 1 :(得分:0)
这对我有用:
@Provider
@ServerInterceptor
public class LoggingInterceptor implements ContainerRequestFilter {
private static final ObjectMapper MAPPER = new ObjectMapper();
@Override
public void filter(ContainerRequestContext containerRequestContext) throws IOException {
if (REQUESTS_LOGGER.isDebugEnabled()) {
final String method = containerRequestContext.getMethod();
final String url = containerRequestContext.getUriInfo().getRequestUri().toString();
final StringBuilder headersStr = new StringBuilder();
MultivaluedMap<String, String> headers = containerRequestContext.getHeaders();
for (MultivaluedMap.Entry<String, List<String>> header : headers.entrySet()) {
headersStr.append(header.getKey()).append(": ").append(header.getValue()).append('\n');
}
String json = null;
if ("POST".equals(method) || "PUT".equals(method)) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(containerRequestContext.getEntityStream(), baos);
byte[] jsonBytes = baos.toByteArray();
json = new String(jsonBytes, "UTF-8");
Object jsonObject = MAPPER.readValue(json, Object.class);
json = MAPPER.writeValueAsString(jsonObject);
containerRequestContext.setEntityStream(new ByteArrayInputStream(jsonBytes));
}
REQUESTS_LOGGER.restCall(method, url, headersStr.toString(), json == null ? "empty" : json);
}
}
}