Search Results

Search found 3 results on 1 pages for 'weesilmania'.

Page 1/1 | 1 

  • Problem with GwtUpload on GAE

    - by weesilmania
    I'm using GwtUpload to upload images on GAE. The problem is that the images seem to get much bigger when I move them into a blob. I've noticed the same for simple text fields and in that case I've realised that some weirdo characters are being appended to the end of the field values (encoding right?). Can anyone help? public class ImageUploadServlet extends AppEngineUploadAction { /** * Maintain a list with received files and their content types */ Hashtable<String, File> receivedFiles = new Hashtable<String, File>(); Hashtable<String, String> receivedContentTypes = new Hashtable<String, String>(); private Objectify objfy; public ImageUploadServlet() { ObjectifyService.register(Thumbnail.class); objfy = ObjectifyService.begin(); System.out.println("ImageUploadServlet init"); } /** * Override executeAction to save the received files in a custom place and * delete this items from session. */ @Override public String executeAction(HttpServletRequest request, List<FileItem> sessionFiles) throws UploadActionException { Thumbnail t = new Thumbnail(); for (FileItem item : sessionFiles) { //CacheableFileItem item = (CacheableFileItem)fItem; if (false == item.isFormField()) { System.out.println("the name 1st:" + item.getFieldName()); try { // You can also specify the temporary folder InputStream imgStream = item.getInputStream(); Blob imageBlob = new Blob(IOUtils.toByteArray(imgStream)); t.setMainImage(imageBlob); System.out.println("blob: " + t.getMainImage()); } catch (Exception e) { throw new UploadActionException(e.getMessage()); } } else { System.out.println("the name 2nd:" + item.getFieldName()); String name = item.getFieldName(); String value; try { InputStream is = item.getInputStream(); StringWriter writer = new StringWriter(); IOUtils.copy(is, writer,"UTF-8"); value = writer.toString(); writer.close(); System.out.println("parm name: " + name); System.out.println("parm value: " + value + " **" + value.length()); System.out.println(item.getContentType()); if (name.equals("thumb-name")) { t.setName(value); } } catch (IOException e) { // TODO Auto-generated catch block System.out.println("Error"); e.printStackTrace(); } } removeSessionFileItems(request); } objfy.put(t); return null; } As an example the size of the image is 20kb, and the lib has some debugging that confirms that this is the case when it's uploading the file but the blob ends up being over 1 MB. Wes

    Read the article

  • Where does the query language sit within the MVC pattern?

    - by weesilmania
    I'd assume that since the query language sits within the controller (typically) that it belongs to that component, but if I play devil's advocate I'd argue that the query language is execute within the domain of the model, and is tightly coupled to that component so it might also be a part of it. Anyone know the answer? Is there a straight answer or is it technology specific?

    Read the article

1