/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else if (obj instanceof byte[]) os.write((byte[])obj); else if (obj instanceof String) { OutputStreamWriter osw = new OutputStreamWriter(os); osw.write((String)obj); osw.flush(); } else throw new UnsupportedDataTypeException( "no object DCH for MIME type " + this.mimeType); } }
/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else throw new UnsupportedDataTypeException( "no DCH for content type " + ds.getContentType()); } }
throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 BOOLEAN !"); throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 NUMBER !"); Double.parseDouble(rv.toString()); } catch (Exception e) { throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 DECIMAL !"); case "URL": if (rv instanceof String == false) { //JSONObject.getString 可转换任何类型 throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 STRING !"); new URL((String) rv); } catch (Exception e) { throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 URL !"); case "Object": // @Deprecated,用 OBJECT 替代,最快在 4.0.0 移除,请尽快修改 Request 表 structure 字段对应值里的 Object if (rv instanceof Map == false) { //JSONObject.getJSONObject 可转换String类型 throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 OBJECT !"); case "Array": // @Deprecated,用 ARRAY 替代,最快在 4.0.0 移除,请尽快修改 Request 表 structure 字段对应值里的 Array if (rv instanceof Collection == false) { //JSONObject.getJSONArray 可转换String类型 throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 ARRAY !"); type(tk, "BOOLEAN", o); } catch (UnsupportedDataTypeException e) { throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 BOOLEAN[] !"); type(tk, "NUMBER", o);
/**验证值类型 * @param tk * @param tv * @param real * @throws Exception */ public static void type(@NotNull String tk, Object tv, @NotNull JSONObject real) throws UnsupportedDataTypeException { if (tv instanceof String == false) { throw new UnsupportedDataTypeException("服务器内部错误," + tk + ":value 的value不合法!" + "Request表校验规则中 TYPE:{ key:value } 中的value只能是String类型!"); } type(tk, (String) tv, real.get(tk)); }
/**登录校验 * @author Lemon * @param visitorId * @throws Exception */ @Override public void verifyLogin() throws Exception { //未登录没有权限操作 if (visitorId == null) { throw new NotLoggedInException("未登录,请登录后再操作!"); } if (visitorId instanceof Number) { if (((Number) visitorId).longValue() <= 0) { throw new NotLoggedInException("未登录,请登录后再操作!"); } } else if (visitorId instanceof String) { if (StringUtil.isEmpty(visitorId, true)) { throw new NotLoggedInException("未登录,请登录后再操作!"); } } else { throw new UnsupportedDataTypeException("visitorId 只能是 Long 或 String 类型!"); } }
throw new UnsupportedDataTypeException( "no DCH for MIME type " + getBaseType()); throw new UnsupportedDataTypeException( "no object DCH for MIME type " + getBaseType());
for (Object r : array) { if (r instanceof String == false) { throw new UnsupportedDataTypeException(rk + ":" + rv + " 中value只支持 String 或 [String] 类型!"); throw new UnsupportedDataTypeException("服务器Request表verify配置错误!"); throw new UnsupportedDataTypeException("服务器Request表verify配置错误!");
throw new UnsupportedDataTypeException(table + ".id类型错误,id类型必须是Long!");
throw new UnsupportedDataTypeException(key + ":value 中value的类型不能为JSON!");
throw new UnsupportedDataTypeException(key + ":value 中value的类型不能为JSON!");
/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else throw new UnsupportedDataTypeException( "no object DCH for MIME type " + this.mimeType); } }
/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else throw new UnsupportedDataTypeException( "no DCH for content type " + ds.getContentType()); } }
throw new UnsupportedDataTypeException( "no DCH for MIME type " + getBaseType()); throw new UnsupportedDataTypeException( "no object DCH for MIME type " + getBaseType());
private BxPage importSource(InputSource source) throws IOException, ParserConfigurationException, SAXException{ Document doc = TrueVizUtils.newDocumentBuilder().parse(source); if ("Page".equalsIgnoreCase(doc.getDocumentElement().getTagName())) { BxPage page = parsePageNode(doc.getDocumentElement()); return page; } else if ("Document".equalsIgnoreCase(doc.getDocumentElement().getTagName())) { } throw new UnsupportedDataTypeException("There were no example of this type contact kura for more info"); } }
/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else throw new UnsupportedDataTypeException( "no DCH for content type " + ds.getContentType()); } }
/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else throw new UnsupportedDataTypeException( "no DCH for content type " + ds.getContentType()); } }
/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else throw new UnsupportedDataTypeException( "no DCH for content type " + ds.getContentType()); } }
/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else throw new UnsupportedDataTypeException( "no DCH for content type " + ds.getContentType()); } }
/** * Write the object to the output stream. */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (dch != null) dch.writeTo(obj, mimeType, os); else throw new UnsupportedDataTypeException( "no DCH for content type " + ds.getContentType()); } }
public Object getContent(DataSource ds) throws IOException { Iterator i = ImageIO.getImageReadersByMIMEType(flavour.getMimeType()); if (!i.hasNext()) { throw new UnsupportedDataTypeException("Unknown image type " + flavour.getMimeType()); } ImageReader reader = (ImageReader) i.next(); ImageInputStream iis = ImageIO.createImageInputStream(ds.getInputStream()); reader.setInput(iis); return reader.read(0); }