Hi ...
I use servlet for display blob data,
@@@@@@@@@@code@@@@@@@@
@public class Serve extends HttpServlet {
@       private BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();
@
@       public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException {
@               BlobKey blobKey = new BlobKey(request.getParameter("blob-key"));
@               blobstoreService.serve(blobKey, response);
@       }
@}
@
@@@@@@@@@@code@@@@@@@@

but i want to rewrite url
                                /serve?blob-key=qHJjg3ecgk-
QbEeDMW8s5g
in
                               /file/qHJjg3ecgk-QbEeDMW8s5g/filename.
created in a jsp page with this two function

@@@@@@@@@@code@@@@@@@@
@public static String key2filename(String blobKey){
@                BlobInfoFactory bif= new BlobInfoFactory();
@                BlobInfo bi= bif.loadBlobInfo(new BlobKey(blobKey));
@                return bi.getFilename();
@        }
@       public static String key2Url(String basePath,String blobKey){
@                return basePath+"file/"+blobKey+"/"+
BlobUtil.key2filename(blobKey);
@
@        }
}@
@@@@@@@@@@code@@@@@@@@
I use this servlet for accept incoming connection

@@@@@@@@@@code@@@@@@@@
@public class ServeAdapter extends HttpServlet {
@       private BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();
@
@       public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
@               String info=req.getPathInfo();
@               String[] temp= info.split("/");
@               String key=temp[1];
@
@               try {
@                       
req.getRequestDispatcher("/serve?blob-key="+key).forward(req,
resp);
@               } catch (ServletException e) {
@                       // TODO Auto-generated catch block
@                       e.printStackTrace();
@               }
@       }
@@@@@@@@@@code@@@@@@@@}

web.xml
@@@@@@@@@@code@@@@@@@@
@<servlet>
 @              <servlet-name>Serve</servlet-name>
 @              <servlet-class>com.appspot.internal_test.util.Serve</servlet-
class>
@        </servlet>
@
@       <servlet-mapping>
 @              <servlet-name>Serve</servlet-name>
@               <url-pattern>/serve</url-pattern>
@       </servlet-mapping>
@
@       <servlet>
@               <servlet-name>ServeAdapter</servlet-name>
@               <servlet-class>com.appspot.internal_test.util.ServeAdapter</
servlet-class>
@        </servlet>
@
@       <servlet-mapping>
@               <servlet-name>ServeAdapter</servlet-name>
@               <url-pattern>/file/*</url-pattern>
@       </servlet-mapping>
@@@@@@@@@@code@@@@@@@@
but the code not work...
someone has an idea?

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

Reply via email to