user1403078
user1403078

Reputation: 71

How to use servlet in slim3 with GWT to upload BlobStore

i have project similar to http://ikaisays.com/2010/09/08/gwt-blobstore-the-new-high-performance-image-serving-api-and-cute-dogs-on-office-chairs/, It use BlobStore to store image on google app engine. But I work with slim3 freamwork.

follow the tutorial i create Fileupload form and Servlet. When i submit the form, note that it don't call to Servlet. I thing may be i don't know config the app.

As i do :

<servlet>
    <servlet-name>uploadServlet</servlet-name>
    <servlet-class>daTotNghiep.server.UploadServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>uploadServlet</servlet-name>
    <url-pattern>/upload</url-pattern>
</servlet-mapping>

// get blobStore URL to upload, and set return value to uploadForm.Action(string)

public String getBlobstoreUploadUrl() {
    // TODO Auto-generated method stub
    BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
    return blobstoreService.createUploadUrl("/upload");
}

With 2 config at that , Sure uploadForm.submit() will call to servlet ?

Full tutorial source : http://github.com/ikai/gwt-gae-image-gallery

Upvotes: 1

Views: 330

Answers (2)

user2981890
user2981890

Reputation: 1

try this one if u go like that

  <servlet>
    <servlet-name>Upload</servlet-name>
    <servlet-class>gwtwithslim.server.service.Upload</servlet-class>
  </servlet>

  <servlet>
    <servlet-name>Serve</servlet-name>
    <servlet-class>gwtwithslim.server.service.Serve</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>Upload</servlet-name>
    <url-pattern>/service.s3gwt/upload/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>Serve</servlet-name>
    <url-pattern>/service.s3gwt/serve/*</url-pattern>
  </servlet-mapping>

Upvotes: 0

user1403078
user1403078

Reputation: 71

Slim3 Controller is a thin framework of Servlet. Slim3 can find a controller that is like Servlet from the path automatically, so you don't need the manual configuration. Due to HOT reloading, when you change the source code, you can see the result on your browser without restarting web application.

so instant use servlet in Slim3 we use Controller. It has work for me

Upvotes: 1

Related Questions