Results 1 to 4 of 4

Thread: how to configure spring MVC - view resolver to get .manifest for HTML 5 offline cache

  1. #1
    Join Date
    Sep 2012
    Location
    India
    Posts
    7

    Default how to configure spring MVC - view resolver to get .manifest for HTML 5 offline cache

    Hello,

    I am trying to HTML 5 offline caching with spring. But i am not getting success for resolve the .manifiest file URL.

    I used below resolver to try to get but didnt get success.

    Code:
    <bean id="viewres3"
              class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix">
                <value>/WEB-INF/views/mb/</value>
            </property>
            <property name="suffix">
                <value>.manifest</value>
            </property>
            <property name="order"><value>1</value></property>
        </bean>
    In web.xml also i have added the manifest mime mapping
    Code:
     <mime-mapping>
            <extension>manifest</extension>
            <mime-type>text/cache-manifest</mime-type>
        </mime-mapping>
    below is web controller request mapping method which try to resolve

    Code:
     @RequestMapping("/offm")
        public String offMainifest() {
            return "/mob/offui";
        }

    Below code HTML 5 snippet. in html tag there attribute is namely "manifest" which requires .manifest file path as value.
    Code:
    <!DOCTYPE html>
    <html lang="en" manifest="offui.manifest">
      // your html document
    </html>

    Please help me if somebody knows then for how to resolve .manifest file view?

    Because for HTML 5 offline caching i must require . manifest file.

    Regards
    Abhijit.

  2. #2
    Join Date
    Sep 2012
    Location
    India
    Posts
    7

    Default

    I have solved this issue.


    Add new mime type in web.xml

    <mime-mapping>
    <extension>manifest</extension>
    <mime-type>text/cache-manifest</mime-type>
    </mime-mapping>


    Web controller method request mapping updates as per below

    @RequestMapping(value = "/offm.appcache", produces = "text/cache-manifest")
    public String offMainifest() {

    StringBuilder strManiFstBuilder = new StringBuilder();
    strManiFstBuilder.append("CACHE MANIFEST");

    strManiFstBuilder.append(Your all other includes add here);

    return strManiFstBuilder.toString();

    }


    Its works for me.

    Thanks.
    Last edited by abhijitaitwade; Oct 2nd, 2012 at 02:08 AM.

  3. #3
    Join Date
    Sep 2012
    Posts
    3

    Default

    with your first approach add that in your dispatcher servlet :

    <resources mapping="/WEB-INF/views/mb/**" location="/WEB-INF/views/mb/".

    and it should works.

  4. #4
    Join Date
    Sep 2012
    Location
    India
    Posts
    7

    Default

    thanks for reply.

    I tried it. Its also work nice and its really helpful.

    My manifest data is dynamically generates so i am going generate manifest data with help of web controller method.

    Thanks once again for help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •