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


Java DefaultOptionsMethodException类代码示例

本文整理汇总了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();
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:DefaultOptionsExceptionMapper.java

示例2: toResponse

import org.jboss.resteasy.spi.DefaultOptionsMethodException; //导入依赖的package包/类
@Override
public Response toResponse(DefaultOptionsMethodException e) {
    return e.getResponse();
}
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:5,代码来源:DefaultOptionsExceptionMapper.java

示例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();
            }
        }
    }
}
 
开发者ID:apache,项目名称:marmotta,代码行数:32,代码来源:MarmottaOptionsFilter.java

示例4: toResponse

import org.jboss.resteasy.spi.DefaultOptionsMethodException; //导入依赖的package包/类
@Override
public Response toResponse(DefaultOptionsMethodException exception) {
    throw exception;
}
 
开发者ID:apache,项目名称:marmotta,代码行数:5,代码来源:MarmottaOptionsFilter.java


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