本文整理匯總了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;
}