當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。