openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danilo Cominotti Marques <dcominot...@gmail.com>
Subject Re: Maven quickstart and sample for Meecrowave
Date Mon, 10 Apr 2017 18:43:22 GMT
Hello Romain,

Thanks for the quick and detailed response as usual. I think you have
covered all my doubts. Really appreciate your help and the Meecrowave
project.

Kind regards,

Danilo


On Fri, Apr 7, 2017 at 4:24 AM, Romain Manni-Bucau <rmannibucau@gmail.com>
wrote:

> Hello Danilo,
>
> very interesting feedback in a not that long mail!
>
> Let me try to tackle all points:
>
> 0. for the setter point: I tried to use plain setters to ensure to be
> compatible with most "factory frameworks" (like spring, xbren-reflect etc).
> Makes some times (since the class was created to be honest) I wonder if we
> add builders or not. Personally I use that pattern:
>
> new Builder() {{ randomHttpPort(); setTomcatScanning(false);
> setTomcatAutoSetup(false); setRealm(new JAASRealm()); }}
>
> so it is not needed but it creates a child class.
>
> 1. "I still need to provide a custom server.xml in order to use the Nio2
> connector"
>
> This is an option but not the only one. However server.xml is intended to
> be a *file*, not a resource. A resource would be useless cause doesn't
> enable to customize it from outside the app (except hacking the classpath
> just for that) so was not implemented. Said otherwise this is for the case
> you have an ops team choosing the server.xml at deploy time and not dev
> time.
>
> The alternative - dev time configuration - you can still customize tomcat
> using getTomcat() and 0.3.1 will get an InstanceCustomizer or
> Consumer<Tomcat> to do it before the server is started. For 0.3.0 you can
> start bypassing the connectors and then set the custom one and deploy:
>
> public void run1() {
>     try (Meecrowave meecrowave = new Meecrowave(new Meecrowave.Builder() {{
>         setSkipHttp(true);
>     }})) {
>         meecrowave.start();
>
>         final Connector connector = new Connector(Http11Nio2Protocol.class.getName());
>         connector.setPort(8080);
>         meecrowave.getTomcat().getService().addConnector(connector);
>
>         meecrowave.deployClasspath().await();
>     }
> }
>
>
> Really no server.xml is needed anytime.
>
> 2. In term of main you never need to write your own, if you add
> commons-cli in the classpath then org.apache.meecrowave.runner.Cli is
> ready to use and wires most of options, even connectors:
>
> java -jar meecrowave-core.jar:common-cli.jar:yourapp
> org.apache.meecrowave.runner.Cli --connector org.apache.coyote.
> http11.Http11Nio2Protocol:port=8080[;attribute=xxx]
>
> Also note that you can put most of these options in the classpath in
> meecrowave.properties as well (without the --), here the connector has the
> limitation to only be able to set attributes and not the protocol but since
> you can customize it and Nio2 is not yet mainstream I guess it is ok.
>
>
> 3. fixed the sample in the doc
>
> 4. here the sample http://svn.apache.org/repos/asf/openwebbeans/meecrowa
> ve/trunk/sample/
>
> Hope it helps
>
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2017-04-06 23:53 GMT+02:00 Danilo Cominotti Marques <dcominottim@gmail.com
> >:
>
>> Hello Mark/Romain,
>>
>> Thanks for the tips!
>>
>> I managed to launch the project with a custom Main, but I still need to
>> provide a custom server.xml in order to use the Nio2 connector from Tomcat.
>> I suppose the custom Main should look like
>>
>> try (final Meecrowave meecrowave = new Meecrowave()) {
>>     meecrowave.getConfiguration().setServerXml("server.xml");
>>     meecrowave.bake().await();
>> }
>>
>>
>> but I don't know for sure where the server.xml file should be placed (it
>> doesn't seem to work when it is in the resources folder, in WEB-INF or in
>> the same package as the class that implements Main).
>>
>> As for a good quickstart, I suppose that a HelloWorld with Maven, a
>> custom Main, and a dummy/sample server.xml would be very explanatory and
>> serve most use cases.
>>
>> Additionally, the configuration sample from http://openwebbeans.apach
>> e.org/meecrowave/meecrowave-core/configuration.html
>>
>> new Meecrowave(new Builder() .randomHttpPort() .setTomcatScanning(false)
>> .setTomcatAutoSetup(false) .setRealm(new JAASRealm()) .user("admin",
>> "secret")) .bake() .await();
>>
>> doesn't even compile, because the setters (using version 0.3.0) don't
>> return a Builder reference.
>>
>> On Thu, Apr 6, 2017 at 2:59 AM, Romain Manni-Bucau <rmannibucau@gmail.com
>> > wrote:
>>
>>> Hi Danilo,
>>>
>>> basically it is a plain tomcat/jaxrs/cdi API in term of java code.
>>>
>>> In term of maven setup https://github.com/rmannibucau/myfolder/ uses it
>>> and angular (versions surely need to be adjusted to 0.3.0). Another nice
>>> thing of this sample is it integrates with meecrowave CLI options.
>>>
>>> You can also use a plain custom Main (http://openwebbeans.apache.or
>>> g/meecrowave/meecrowave-core/configuration.html) or the existing one
>>> directly (http://openwebbeans.apache.org/meecrowave/meecrowave-core/c
>>> li.html)
>>>
>>> what would be a good quickstart for you? an hello world with meecrowave
>>> plugin setup? with a main?
>>>
>>>
>>>
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>> <https://blog-rmannibucau.rhcloud.com> | Old Blog
>>> <http://rmannibucau.wordpress.com> | Github
>>> <https://github.com/rmannibucau> | LinkedIn
>>> <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
>>> <https://javaeefactory-rmannibucau.rhcloud.com>
>>>
>>> 2017-04-06 5:08 GMT+02:00 Mark Struberg <struberg@yahoo.de>:
>>>
>>>> Hi Danilo!
>>>>
>>>> Seems the start is still a bit rockier than it is supposed to be :/
>>>>
>>>> What I did was as easy as just creating a plain WAR project in maven
>>>> and use
>>>>
>>>> $> mvn meecrowave:run
>>>> to start it up
>>>>
>>>> Use
>>>> $> mvndebug meecrowave:run
>>>> to debug your project.
>>>>
>>>> LieGrue,
>>>> strub
>>>>
>>>>
>>>> > Am 06.04.2017 um 00:05 schrieb Danilo Cominotti Marques <
>>>> dcominottim@gmail.com>:
>>>> >
>>>> > Hello there,
>>>> >
>>>> > Could someone please add a Maven quickstart to Meecrowave's website?
>>>> No matter what I did, I couldn't get a Meecrowave sample up and running
>>>> with Maven. A code sample in the repository would be great, too.
>>>> >
>>>> > Regards,
>>>> >
>>>> > Danilo
>>>> >
>>>>
>>>>
>>>
>>
>

Mime
View raw message