Package org.b3log.latke.repository

Examples of org.b3log.latke.repository.Blob


                                  HttpServletResponse.SC_BAD_REQUEST,
                                  fail, cause);
                        return;
                    }

                    final Blob blob = new Blob(contentBytes);
                    final JSONObject file = new JSONObject();
                    final String id = Ids.genTimeMillisId();
                    file.put(Keys.OBJECT_ID, id);

                    file.put(File.FILE_CONTENT_TYPE, item.getContentType());
View Full Code Here


            if (null == file) {
                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                return;
            }

            final Blob content = (Blob) file.get(File.FILE_CONTENT);
            final String name = file.getString(File.FILE_NAME);
            response.addHeader("Content-Disposition",
                               "attachment; filename="
                               + URLEncoder.encode(name, "UTF-8"));
            response.setContentType(file.getString(File.FILE_CONTENT_TYPE));
            response.getOutputStream().write(content.getBytes());
            response.getOutputStream().close();

            final int downloadCnt = file.getInt(File.FILE_DOWNLOAD_COUNT);
            file.put(File.FILE_DOWNLOAD_COUNT, downloadCnt + 1);
            fileRepository.update(id, file);
View Full Code Here

            if (v instanceof Text) {
                final Text valueText = (Text) v;
                jsonMap.put(k, valueText.getValue());
            } else if (v instanceof com.google.appengine.api.datastore.Blob) {
                final com.google.appengine.api.datastore.Blob blob = (com.google.appengine.api.datastore.Blob) v;
                jsonMap.put(k, new Blob(blob.getBytes()));
            } else {
                jsonMap.put(k, v);
            }
        }
View Full Code Here

                       || value instanceof Date
                       || value instanceof Boolean
                       || GAE_SUPPORTED_TYPES.contains(value.getClass())) {
                entity.setProperty(key, value);
            } else if (value instanceof Blob) {
                final Blob blob = (Blob) value;
                entity.setProperty(key, new com.google.appengine.api.datastore.Blob(blob.getBytes()));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.b3log.latke.repository.Blob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.