Tuesday, September 21, 2010

Re: Problem with ClientBundle DataResource -> cryptic url

You are doing nothing wrong, DataResource encode your files as base64
in every browser but IE.
If you want a direct link to the pdf just put it into your war directory.

On Tue, Sep 21, 2010 at 5:34 AM, TL <thomas.lacroix@jouy.inra.fr> wrote:
> Hello!
> I have a pdf file that I want users to be able to download if they
> click on an hyperlink so I have tried to implement clientBundle
> following the example on the GWT website :
> http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html
>
> public interface MyResources extends ClientBundle {
>  public static final MyResources INSTANCE =
> GWT.create(MyResources.class);
>
>  @Source("manual.pdf")
>  public DataResource ownersManual();
> }
>
>
> [somewhere else in my code]
> @UiHandler("tutoPdf")
> void onTutoPdfClicked(ClickEvent event) {
>        Window.open(MyResources.INSTANCE.ownersManual().getUrl(), "tutorial",
> "");
> }
>
>
> Here is the string returned by
> MyResources.INSTANCE.ownersManual().getUrl() :
>
> data:application/
> pdf;base64,JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nH1Ru2oDMRDs9RVbB6TM6vQEIYhjX5HOIEhxpMsDUhjsJr8fScThcsRCsNrVMjuzIyimL3EmkERNHesafWzx8kbPd3TqzXYuH2JXhHUqkGeoicor3c9MrKm8LwmcXUjQWfqEKbsEk3WChYNHqHcvY5ahdRgJDz3ftedH7DMnHPJLeRKHIo7/
> sToXVNyyzvmX1GRZWffjGdbW1dYzEgMzI5fP2yDD13X1DwhcSUcQ7ZX9A1maK1I3n7oDQ5U8KX8LPQLaGDcWJeaRThvcxo
> +lG1I1sh5TGXPVuHKyfjUzY0V6pG/
> QGoQnCmVuZHN0cmVhbQplbmRvYmoKCjMgMCBvYmoKMjMyCmVuZG9iagoKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyL0ZsYXRlRGVjb2RlL0xlbmd0aDEgMTEwMzI
> [I spare you about 100 lines of the same cryptic chatter... ;-]
> +4zuvDP8dp9Lto9ryEeaUfX76O37iOxev48DUcuobnPl74mPz5aqnrmauXrpLOK8NXnrnCVV7B5itYh5YsS6Gl8NLM0rklrcH8EU5HH2Lrv16uc70feK/
> 3D4F3e9F7uCH03tx7ifc4WsgNvKczBt/DXO
> +7nMNlWRQXKxdnFucW31y8vHh1UTf384Wfk//6os9lftH1InFd6Lxw+AIX/
> iE2/9D1QxI6Ez5DFs5i81nXWd9Z7vuPVrgebct3PfJwsevyw1cfZl8N1TycYQ0O/
> yd8+Hunvkdmvjv33YXvcnPHFo6RZw5cOkBioVLX9JTXNdUmu4RATm9agOvVcivsC7KWnZ6SYHhYcQ2D0OBApWugrdSVFcjs1cBgeRA0cy6uievkprlT3CUuTbctlO/
> qgvty6GqImDtdnb5O9q1PpMMNitpn2ufauS3BUpfa
>
> I am using GWT 2.0.2, I have some .png images that works fine using
> ClientBundle (I don't use the method .getUrl() on them though, no
> need) but anyone knows what I am doing wrong with DataResource ?
>
> --
> 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.
>
>

--
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/

--
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