Does PdfReader, and the other itext classes which involve streams and/or have a close() method, implement the (auto)closeable interface?
In the API Doc I didn't find any reference saying that.
Just to know if I can use try with resources or not.
As Bruno said, it doesn't implement Closeable...
Related
I recently discovered the convenience of using Refit, but after reading through its documentation I was unable to find a way to replace/override an implementation of an interface method that RestService would normally generate.
Does Refit provide a way to do this? Or is there a way to solve such a problem without getting too hacky?
I'm just worried about using Refit all over the place and then half way into a project realizing I can't modify the implementation of a method. It's inevitable that I'll have to break coding standards to meet a requirement and I'd like to know what would be the solution if a situation like this occurs?
Its not exectly what you want, but you can create extension where you call Refit implementation, but before and after call you can add any customization you want.
For example, I have use it to reformat response.
I am implementing facebook chat client using DART. As far as i figured out, i need to use XMPP protocol.
Is there a XMPP api for dart?
If yes, can you lead me to source?
If no, is there any good (for a complete stranger to protocol) source, so that i can implement one.
I don't know of anything in Dart, especially since it's such a new language, but there's a list of libraries on the XMPP page. Perhaps you can find one that you like?
This question points out some good libraries in Javascript: XMPP library for facebook chat
For protocol specifications, see here. Even if you find a good library to convert, you'll probably want to take a look at the specification anyway to really understand how it works.
One of the key points of building a RESTful API is HATEOAS. Now, Jersey offers a linking ability which is quite good (see this link). But I have seen the draft of the HAL Specification and it seems to be a well thought piece of work.
I am interested if there is some lib that makes it easy to adhere to HAL in Jersey. I have seen the references mentioned in the draft like https://github.com/HalBuilder. But I am using direct POJO marshalling and I do not know how to mix that with Halbuilder.
So, is there already some lib that incorporates HAL into Jersey? Or maybe I can use some kind of filter to enhance the generated POJOs manually? If yes, can someone give me a clue where to look next to accomplish this?
I can't find any direct support for this in Jersey, but there should be ways to customize the marshaller that Jersey uses to convert your POJO's to JSON. (either by using HalBuilder, or create some HAL-compatible code of your own)
If you use Jerseys JAXB based JSON support, take a look at BootstrapTypeConverterTest in the jettison source code which demonstrates how a converter can be used to cusomize JSON output. Unit-testing conversions to/from JSON should be a simple task and jettison-project has good examples to look at.
If you use Jerseys "POJO Support"-method, take a look at JacksonHowToCustomSerializers for a similar example on how to create your custom serializers.
(If JAXB is involved, you can also do cool things like processing custom annotations.)
You probably have a pretty good idea of how your objects (input) looks like and what JSON code (output) you expect, so creating unit tests for these conversions should be a relatively simple task.
Even if this is not really an answer, I had not enough characters to put it in a comment :)
If you're really new to REST, I think you're beginning probably in the wrong way. I don't know exactly your requirements, but if you only want to learn, begin with an easy REST service, use Web API from .net or something similar in Java (a simple servlet would be enough) and try to implement a service which only uses the tools delivered by http (the verbs, the request header and payload, the response message). REST API design rulebook from Marc Massé could be a good reference to learn. Create your own communication protocol with POJOs or POCOs and once you really what you can do REST and how it works, you can use a framework to ease your work.
If you begin with a framework you may miss the essence of the concept...
I hope it helps!
It's very little that's required to adhere to HAL. I suggest you roll your own mini-library where you wrap your POJOs in HAL-objects. This way you get the code the way you like it and it will be way simpler than HalBuilder.
Is there any easy way to use a pojo as a request factory proxy and not an interface? The case is that I would like to reuse the actual value object as is without creating an interface describing it.
I do not that this can not be done out of the box. GWT fails to compile with an error regarding non getter/setter methods insite the "proxy" class.
This not possible, by design. See this previous StackOverflow answer.
So intead of using ExportMetadata attribute, why not just extend the interface instead?
if you import Lazy<> stuff via MEF you can look into the metadata without instantiate your object.
Good question. I think that extending the interface is the correct thing to do whenever you have the option. It much better communicates intent.
However, we may need more fine-grained control over interfaces that we don't own. In those cases we can use ExportMetadata as a substitute.
In my opinion you should only use ExportMetadata when there is no other option available to you.