Giter VIP home page Giter VIP logo

Comments (10)

drallgood avatar drallgood commented on May 31, 2024

That has nothing to do with the file itself but with the webserver that serves it.

from jpasskit.

hnthuan avatar hnthuan commented on May 31, 2024

Hi drallgood,
Thanks for quick reply.
I'm using Eclipse and coding portlet with Liferay open source. I have tried many way to write file from byte[], but the content type always is "application/octet-stream".
Do you have any example or demo source to write file with content type "appication/vnd.apple.pkpass" in java?
Thanks again!

from jpasskit.

jerryrt avatar jerryrt commented on May 31, 2024

I am not familiar with portlet programming, but using "portlet set content
type" as keywords, one of google search results provide me with this:

public void serveResource(
ResourceRequest req, ResourceResponse res)

res.setContentType("application/pdf");

The whole long post is here:

http://www.liferay.com/community/wiki/-/wiki/Main/Generate+PDF+File+in+Portlet

On Thu, Oct 25, 2012 at 11:17 AM, hnthuan [email protected] wrote:

Hi drallgood,
Thanks for quick reply.
I'm using Eclipse and coding portlet with Liferay open source. I have
tried many way to write file from byte[], but the content type always is
"application/octet-stream".
Do you have any example or demo source to write file with content type
"appication/vnd.apple.pkpass" in java?
Thanks again!


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-9764735.

from jpasskit.

drallgood avatar drallgood commented on May 31, 2024

You are using liferay? My condolences ;)

The code looks okay to me.
The one thing you should make sure, is that you are also sending the .pkpass file extension (not .pkpass.zip or something like that). iOS seems to need the extension to determine the App to use (rather than the content-type)

from jpasskit.

hnthuan avatar hnthuan commented on May 31, 2024

Thanks all for reply!
This is my mistake :)
The problem is not from content type, just because of the number of parameters passing to PKPass object.

@drallgood: There is one problem with Barcode when creating pkpass file .
When I call function "setMessageEncoding( Charset.forName( "utf-8" ) )",I receive a string {"register":"true"} in pass.json file , so PassBook can't read pkpass file .
I fix this by editing your code, replying Charset by String, rebuilding project and creating new pkpass file that PassBook read successfully.
I'm not sure the message which will be encode to UTF-8, so I hope you can check this bug for everyone can use your code easier.

Thanks for great project!

from jpasskit.

drallgood avatar drallgood commented on May 31, 2024

Let me check that. I'll create a new issue for it and close this one, if that's okay for you?

from jpasskit.

drallgood avatar drallgood commented on May 31, 2024

hmm.. It's not happening here... Is it possible to get a full code example?

from jpasskit.

hnthuan avatar hnthuan commented on May 31, 2024

Okay, you can close this issue :)

from jpasskit.

hnthuan avatar hnthuan commented on May 31, 2024

This is my code:

  • package de.brendamour.jpasskit:
public class PKBarcode implements IPKValidateable {
...
//    private Charset messageEncoding;
    private String messageEncoding;

//    public Charset getMessageEncoding() {
//        return messageEncoding;
//    }
//
//    public void setMessageEncoding(final Charset messageEncoding) {
//        this.messageEncoding = messageEncoding;
//    }

    public String getMessageEncoding() {
        return messageEncoding;
    }

    public void setMessageEncoding(String messageEncoding) {
        this.messageEncoding = messageEncoding;
    }
...
}
  • package de.brendamour.jpasskit;
public class PKBarcodeTest {
...
//    private static final Charset CHARSET = Charset.forName("UTF-8");
    private static final String CHARSET = "UTF-8";
...
}

That's all. Hope this help.

edited by drallgood: Just formatting stuff

from jpasskit.

drallgood avatar drallgood commented on May 31, 2024

No, sorry. I meant, whether you could sent my the actual code you were using to create the pass and maybe the generated pass.json.

I'm not seeing this issue, but maybe there is something else happening.

Also: Let's use issue #6 for this.

from jpasskit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.