Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streams #2

Closed
RushPVA opened this issue Apr 4, 2013 · 14 comments
Closed

Streams #2

RushPVA opened this issue Apr 4, 2013 · 14 comments

Comments

@RushPVA
Copy link

RushPVA commented Apr 4, 2013

Now exists only File api. Streams api will be very usefull.

@snowindy
Copy link
Owner

snowindy commented Apr 4, 2013

ok. Please describe the way you use the library, so it's easier to create an appropriate api.
is it a web app?

@RushPVA
Copy link
Author

RushPVA commented Apr 4, 2013

yes it is web app,
Example: templates are in db. i need to process one of them and put it in response.
way to do it now:

  1. create tmp file with template
  2. process template and save it another tmp file
  3. copy processed file in response outputstream

@RushPVA
Copy link
Author

RushPVA commented Apr 4, 2013

I suppose easier way to get api somthing like:
DocxTemplater(InputStream is)
process(OutputStream os, ...)

@snowindy
Copy link
Owner

snowindy commented Apr 4, 2013

Yeah, it makes sense. It will be a utility wrapper around file API at first.

Thing I am aware of is output stream closing..
The other thing is caching input streams data (for example, you do not want to do a heavy preprocess every time the templater is invoked, it's better to have it caching some intermediate template results)

I will think it through.

@RushPVA
Copy link
Author

RushPVA commented Apr 9, 2013

About cache, normal practice is to use cache key or id...

@snowindy
Copy link
Owner

Streaming and caching features are implemented in version 0.7. Please check it out.

Note that the new version will appear at maven central as soon as sonatype sync happens. This may require a week or so.
If you need the new features ultimately, simply install project to local maven repo using mvn install.

@RushPVA
Copy link
Author

RushPVA commented May 15, 2013

Why is not available outputstream api for processed template?

@snowindy snowindy reopened this May 15, 2013
@snowindy
Copy link
Owner

Thanks for the note!
I completely lost that point, sorry.

Will add it ASAP.

@snowindy
Copy link
Owner

Now it's done: see processAndReturnInputStream method.

@RushPVA
Copy link
Author

RushPVA commented May 15, 2013

Why does method return InputStream? Why just not copy data to outstream like in example above? Because it is no deffirance copy data from file or from inputstream, if i need for example put data in response.

@snowindy
Copy link
Owner

Makes sence... Will add soon, in .0.7.2.

@snowindy snowindy reopened this May 15, 2013
@RushPVA
Copy link
Author

RushPVA commented May 15, 2013

P.S. It is very usefull library. Realy i didnt meet any another library, that works stable with docx templates. I hope you will impove this. Thank You!

@snowindy
Copy link
Owner

That's nice! If you see an option of library promotion I would be pleased to listen.

@snowindy
Copy link
Owner

OutputStream feature added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants