Ahh, sorry Max , didnt notice it was python at a quick glance. I dont know
Python, but the principle is the same.
You have a class that generates the HTML for your page, you need a new class
similar to my servlet to do the actual serving of blobs.

If you do "<img src="/serve/{{ img.link }}" />", the image (blob) will be
written to the same stream as the html, which wont work.
The html should load first, and when it is parsed the browser will make
another call to your new blob serving class to get the blob.

Hope my explanation makes sense :-)

/Tomas


On Mon, Jun 21, 2010 at 10:07, Massimiliano <massimiliano.pietr...@gmail.com
> wrote:

> Hi Tomas,
> thank you very much, but I can't understand Java, as I know just Python.
>
> Regards
>
> Massimiliano
>
> 2010/6/21 Tomas Petersson <to...@petersson.net>
>
>> Hello, I made a simple app to evaluate App Engine and I solved it like
>> this.
>> Hope it helps.
>>
>> Cheers, Tomas
>>
>>
>>
>> *JSP:*
>> <img  src="/blobServe?blobKeyString=<%= blobKey().getKeyString() %>">
>>
>> *web.xml:*
>> <servlet>
>>     <servlet-name>blobServe</servlet-name>
>>
>> <servlet-class>appengine_eval.servlets.BlobServeServlet</servlet-class>
>> </servlet>
>> <servlet-mapping>
>>     <servlet-name>blobServe</servlet-name>
>>     <url-pattern>/blobServe</url-pattern>
>> </servlet-mapping>
>>
>> *BlobServeServlet.java:*
>> package appengine_eval.servlets;
>>
>> import java.io.IOException;
>> import java.util.logging.Logger;
>>
>> import javax.servlet.http.HttpServlet;
>> import javax.servlet.http.HttpServletRequest;
>> import javax.servlet.http.HttpServletResponse;
>>
>> import com.google.appengine.api.blobstore.BlobKey;
>> import com.google.appengine.api.blobstore.BlobstoreService;
>> import com.google.appengine.api.blobstore.BlobstoreServiceFactory;
>>
>> public class BlobServeServlet extends HttpServlet {
>>
>>     private static final long serialVersionUID = 1L;
>>
>>     @SuppressWarnings("unused")
>>     private static final Logger log =
>> Logger.getLogger(BlobServeServlet.class.getName());
>>
>>     private BlobstoreService blobstoreService =
>> BlobstoreServiceFactory.getBlobstoreService();
>>
>>     /**
>>      *
>>      */
>>     @SuppressWarnings("unchecked")
>>     public void doGet(HttpServletRequest request, HttpServletResponse
>> response) throws IOException {
>>
>>         BlobKey blobKey = new
>> BlobKey(request.getParameter("blobKeyString"));
>>         blobstoreService.serve(blobKey, response);
>>
>>
>>     }
>>
>> }
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To post to this group, send email to google-appeng...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine?hl=en.
>>
>
>
>
> --
>
> My email: massimiliano.pietr...@gmail.com
> My Google Wave: massimiliano.pietr...@googlewave.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to