Announcement Announcement Module
Collapse
No announcement yet.
how to configure spring MVC - view resolver to get .manifest for HTML 5 offline cache Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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, 03:08 AM.

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment

        Working...
        X