/** * Constructor. * * @param msg The message. Can be <jk>null</jk>. */ public NotAcceptable(String msg) { super(msg); setStatus(CODE); }
@RestMethod public void notAcceptable() { throw new NotAcceptable("foo {0}", "bar"); } @RestMethod public void notExtended() { throw new NotExtended("foo {0}", "bar"); }
@RestMethod public void notAcceptable() { throw new NotAcceptable(); } @RestMethod public void notExtended() { throw new NotExtended(); }
@RestMethod public void notAcceptable() { throw new NotAcceptable(t); } @RestMethod public void notExtended() { throw new NotExtended(t); }
/** * Constructor. * * @param msg The message. Can be <jk>null</jk>. */ public NotAcceptable(String msg) { super(msg); setStatus(CODE); }
@RestMethod public void notAcceptable() { throw new NotAcceptable(t, "foo {0}", "bar"); } @RestMethod public void notExtended() { throw new NotExtended(t, "foo {0}", "bar"); }
/** * Constructor. * * @param msg The message. Can be <jk>null</jk>. */ public NotAcceptable(String msg) { super(msg); setStatus(CODE); }
throw new NotAcceptable( "Unsupported encoding in request header ''Accept-Encoding'': ''{0}''\n\tSupported codings: {1}", ae, encoders.getSupportedEncodings()
throw new NotAcceptable( "Unsupported encoding in request header ''Accept-Encoding'': ''{0}''\n\tSupported codings: {1}", ae, encoders.getSupportedEncodings()
throw new NotAcceptable( "Unsupported encoding in request header ''Accept-Encoding'': ''{0}''\n\tSupported codings: {1}", ae, encoders.getSupportedEncodings()
final void init(RestJavaMethod rjm, RequestProperties properties) throws NotAcceptable { this.restJavaMethod = rjm; this.properties = properties; // Find acceptable charset String h = request.getHeader("accept-charset"); String charset = null; if (h == null) charset = rjm.defaultCharset; else for (MediaTypeRange r : MediaTypeRange.parse(h)) { if (r.getQValue() > 0) { MediaType mt = r.getMediaType(); if (mt.getType().equals("*")) charset = rjm.defaultCharset; else if (Charset.isSupported(mt.getType())) charset = mt.getType(); if (charset != null) break; } } if (charset == null) throw new NotAcceptable("No supported charsets in header ''Accept-Charset'': ''{0}''", request.getHeader("Accept-Charset")); super.setCharacterEncoding(charset); this.responseMeta = rjm.responseMeta; }
final void init(RestJavaMethod rjm, RequestProperties properties) throws NotAcceptable { this.restJavaMethod = rjm; this.properties = properties; // Find acceptable charset String h = request.getHeader("accept-charset"); String charset = null; if (h == null) charset = rjm.defaultCharset; else for (MediaTypeRange r : MediaTypeRange.parse(h)) { if (r.getQValue() > 0) { MediaType mt = r.getMediaType(); if (mt.getType().equals("*")) charset = rjm.defaultCharset; else if (Charset.isSupported(mt.getType())) charset = mt.getType(); if (charset != null) break; } } if (charset == null) throw new NotAcceptable("No supported charsets in header ''Accept-Charset'': ''{0}''", request.getHeader("Accept-Charset")); super.setCharacterEncoding(charset); this.responseMeta = rjm.responseMeta; }
final void init(RestJavaMethod rjm, RequestProperties properties) throws NotAcceptable { this.restJavaMethod = rjm; this.properties = properties; // Find acceptable charset String h = request.getHeader("accept-charset"); String charset = null; if (h == null) charset = rjm.defaultCharset; else for (MediaTypeRange r : MediaTypeRange.parse(h)) { if (r.getQValue() > 0) { MediaType mt = r.getMediaType(); if (mt.getType().equals("*")) charset = rjm.defaultCharset; else if (Charset.isSupported(mt.getType())) charset = mt.getType(); if (charset != null) break; } } if (charset == null) throw new NotAcceptable("No supported charsets in header ''Accept-Charset'': ''{0}''", request.getHeader("Accept-Charset")); super.setCharacterEncoding(charset); this.responseMeta = rjm.responseMeta; }
@SuppressWarnings("resource") private FinishablePrintWriter getWriter(boolean raw, boolean autoflush) throws NotAcceptable, IOException { if (w != null) return w; // If plain text requested, override it now. if (request.isPlainText()) setHeader("Content-Type", "text/plain"); try { OutputStream out = (raw ? getOutputStream() : getNegotiatedOutputStream()); w = new FinishablePrintWriter(out, getCharacterEncoding(), autoflush); return w; } catch (UnsupportedEncodingException e) { String ce = getCharacterEncoding(); setCharacterEncoding("UTF-8"); throw new NotAcceptable("Unsupported charset in request header ''Accept-Charset'': ''{0}''", ce); } }
@SuppressWarnings("resource") private FinishablePrintWriter getWriter(boolean raw, boolean autoflush) throws NotAcceptable, IOException { if (w != null) return w; // If plain text requested, override it now. if (request.isPlainText()) setHeader("Content-Type", "text/plain"); try { OutputStream out = (raw ? getOutputStream() : getNegotiatedOutputStream()); w = new FinishablePrintWriter(out, getCharacterEncoding(), autoflush); return w; } catch (UnsupportedEncodingException e) { String ce = getCharacterEncoding(); setCharacterEncoding("UTF-8"); throw new NotAcceptable("Unsupported charset in request header ''Accept-Charset'': ''{0}''", ce); } }
@SuppressWarnings("resource") private FinishablePrintWriter getWriter(boolean raw, boolean autoflush) throws NotAcceptable, IOException { if (w != null) return w; // If plain text requested, override it now. if (request.isPlainText()) setHeader("Content-Type", "text/plain"); try { OutputStream out = (raw ? getOutputStream() : getNegotiatedOutputStream()); w = new FinishablePrintWriter(out, getCharacterEncoding(), autoflush); return w; } catch (UnsupportedEncodingException e) { String ce = getCharacterEncoding(); setCharacterEncoding("UTF-8"); throw new NotAcceptable("Unsupported charset in request header ''Accept-Charset'': ''{0}''", ce); } }
throw new NotAcceptable( "Unsupported media-type in request header ''Accept'': ''{0}''\n\tSupported media-types: {1}", req.getHeaders().getString("Accept", ""), g.getSupportedMediaTypes()
throw new NotAcceptable( "Unsupported media-type in request header ''Accept'': ''{0}''\n\tSupported media-types: {1}", req.getHeaders().getString("Accept", ""), g.getSupportedMediaTypes()
throw new NotAcceptable( "Unsupported media-type in request header ''Accept'': ''{0}''\n\tSupported media-types: {1}", req.getHeaders().getString("Accept", ""), g.getSupportedMediaTypes()