Tuesday, July 27, 2010

Re: HTML5 Offline GWT APP

I am doing like the Google IO Linkers video:

@LinkerOrder(Order.POST)
public class OfflineLinker extends AbstractLinker {

@Override
public String getDescription() {
return "HTML 5 Offline Linker";
}

@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context,
ArtifactSet artifacts) throws UnableToCompleteException {
ArtifactSet artifactSet = new ArtifactSet(artifacts);
StringBuilder buf = new StringBuilder();
buf.append("CACHE MANIFEST\nindex.html\n");
buf.append("#").append(System.currentTimeMillis()).append("\n");

for(EmittedArtifact artifact:artifacts.find(EmittedArtifact.class)){
if(!artifact.isPrivate()){
buf.append(artifact.getPartialPath()).append("\n");
}
}
EmittedArtifact artifact = emitString(logger, buf.toString(),
"gt.manifest"); //my manifest file name
artifactSet.add(artifact);
return artifactSet;
}
}

I also needed this servlet (mapped to /gt.manifest) :

public class ManifestServlet extends HttpServlet{
@Override
protected void service(HttpServletRequest req, HttpServletResponse
resp)
throws ServletException, IOException {
resp.setContentType("text/cache-manifest");
RequestDispatcher disp = req.getRequestDispatcher("/gt/
gt.manifest");
disp.forward(req, resp);
}
}

It seems to be working, but debugging is not easy.

On Jul 27, 6:37 am, Shawn Brown <big.coffee.lo...@gmail.com> wrote:
> Hi Julio,
>
> > Thanks Arthur, the linker works perfectly.
>
> Did you use the  com.google.gwt.core.ext.linker.AbstractLinker  and
> just override the link method?
>
> If so, are we just outputting the file names to make a suitable
> manifest in the link method.  Will this compile the project and make
> the manifest at the same time or is it a two step process.
>
> May I please see your linker code!?!  Is there a manifest linker
> available someplace?
>
> > I am using google plugin for eclipse and gae-java
>
> Me too and if I have any info I'll share but right now am a step or
> two behind you.
>
> Thanks,
>
> Shawn

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

No comments:

Post a Comment