本文整理汇总了Java中org.jboss.resteasy.spi.DefaultOptionsMethodException类的典型用法代码示例。如果您正苦于以下问题:Java DefaultOptionsMethodException类的具体用法?Java DefaultOptionsMethodException怎么用?Java DefaultOptionsMethodException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultOptionsMethodException类属于org.jboss.resteasy.spi包,在下文中一共展示了DefaultOptionsMethodException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toResponse
import org.jboss.resteasy.spi.DefaultOptionsMethodException; //导入依赖的package包/类
@Override
public Response toResponse(DefaultOptionsMethodException arg0)
{
final ResponseBuilder response = Response.ok();
response.header("Access-Control-Allow-Origin", "*");
response.header("Access-Control-Allow-Methods", ALL_METHODS);
response.header("Allow", ALL_METHODS);
response.header("Access-Control-Allow-Headers", "X-Authorization, Content-Type");
response.header("Access-Control-Max-Age", TimeUnit.DAYS.toSeconds(1));
response.header("Access-Control-Expose-Headers", "Location");
return response.build();
}
示例2: toResponse
import org.jboss.resteasy.spi.DefaultOptionsMethodException; //导入依赖的package包/类
@Override
public Response toResponse(DefaultOptionsMethodException e) {
return e.getResponse();
}
示例3: doFilter
import org.jboss.resteasy.spi.DefaultOptionsMethodException; //导入依赖的package包/类
/**
* The <code>doFilter</code> method of the Filter is called by the container
* each time a request/response pair is passed through the chain due
* to a client request for a resource at the end of the chain. The FilterChain passed in to this
* method allows the Filter to pass on the request and response to the next entity in the
* chain.<p>
* A typical implementation of this method would follow the following pattern:- <br>
* 1. Examine the request<br>
* 2. Optionally wrap the request object with a custom implementation to
* filter content or headers for input filtering <br>
* 3. Optionally wrap the response object with a custom implementation to
* filter content or headers for output filtering <br>
* 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object (<code>chain.doFilter()</code>), <br>
* * 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter chain to block the request processing<br>
* * 5. Directly set headers on the response after invocation of the next entity in the filter chain.
*/
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
try {
chain.doFilter(request,response);
} catch (DefaultOptionsMethodException | NoMessageBodyWriterFoundFailure ex) {
if(response instanceof HttpServletResponse) {
HttpServletResponse resp = (HttpServletResponse)response;
HttpServletRequest req = (HttpServletRequest)request;
if(req.getMethod().equalsIgnoreCase("OPTIONS")) {
resp.setStatus(200);
resp.resetBuffer();
}
}
}
}
示例4: toResponse
import org.jboss.resteasy.spi.DefaultOptionsMethodException; //导入依赖的package包/类
@Override
public Response toResponse(DefaultOptionsMethodException exception) {
throw exception;
}