You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Daniel Sun <re...@hotmail.com> on 2016/12/14 12:29:53 UTC

SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? )

Hi all,

        SimpleHTTPServer has been implemented(http://bit.ly/2hsKm0V), it
supports serving files not only under directory but also in the zip file.
Here is the usage: "-lh <httpServerPort>         listen on a port and
provide http service", e.g.
*serve files under current directory*: groovy -lh 8000
*serve files under a specified directory*: groovy -lh 8000 d:\temp
*serve files in a zip file(we can view javadoc and groovydoc in the zip
files inspried by GroovyHelp)*: groovy -lh 8000 d:\apidoc.zip

         In addition, we can change the context root(/helloworld, default
context root is /) via passing complete arguments: groovy -lh 8000 d:\temp
helloworld,  its usage is: groovy -lh <httpServerPort> <base directory>
[context root]

         After the SimpleHTTPServer launched, we can access files via
visiting http://localhost:<httpServerPort>/<context root>/<path relative to
the base directory>

         Any thoughts?

Cheers,
Daniel.Sun



--
View this message in context: http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235.html
Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? )

Posted by Daniel Sun <re...@hotmail.com>.
Maybe we can use -m to specify the module instead of the convenient way -lh, e.g. groovy -m SimpleHTTPServer [base dir] [context root].

Thanks for your feedback.

Cheers,
Daniel.Sun



在 2016年12月15日 上午6:37,"Suderman Keith-3 [via Groovy]" <ml...@n5.nabble.com>写道:
<block
-1 as well.

While it is a cool feature, I have to agree that it feels more like a lib than something that belongs in the language itself.

On Dec 14, 2016, at 7:55 AM, Daniel Sun <[hidden email]</user/SendEmail.jtp?type=node&node=5737245&i=0>> wrote:

groovy -m com.sparkjava:spark-groovy -c "serve(port: 8080, path:
'd:\\temp')"
How many characters will we type... to be frank, I am not that patient to
type such a long command.

That is what shell scripts are for, it is not a reason to include something in the core language.

Cheers,
Keith

On Dec 14, 2016, at 12:46 PM, Marcin Erdmann <[hidden email]</user/SendEmail.jtp?type=node&node=5737245&i=1>> wrote:

-1 from me as well, fells more like a lib feature than a language feature. I agree with other folks that it is bloating the language for quite a narrow usecase.


On Wed, 14 Dec 2016 at 12:39, Sergei Egorov <[hidden email]</user/SendEmail.jtp?type=node&node=5737245&i=2>> wrote:
Hi Daniel,

To be honest, I don't like it, -1 from me.

Why? Because we already put more and more stuff into the groovy itself, but, i.e. in a case of python, SimpleHTTPServer it's just a module after all.

I would rather see something like:

groovy -m com.sparkjava:spark-groovy -c "serve(port: 8080, path: 'd:\\temp')"

On Wed, Dec 14, 2016 at 2:29 PM Daniel Sun <[hidden email]</user/SendEmail.jtp?type=node&node=5737245&i=3>> wrote:
Hi all,





        SimpleHTTPServer has been implemented(http://bit.ly/2hsKm0V), it


supports serving files not only under directory but also in the zip file.


Here is the usage: "-lh <httpServerPort>         listen on a port and


provide http service", e.g.


*serve files under current directory*: groovy -lh 8000


*serve files under a specified directory*: groovy -lh 8000 d:\temp


*serve files in a zip file(we can view javadoc and groovydoc in the zip


files inspried by GroovyHelp)*: groovy -lh 8000 d:\apidoc.zip





         In addition, we can change the context root(/helloworld, default


context root is /) via passing complete arguments: groovy -lh 8000 d:\temp


helloworld,  its usage is: groovy -lh <httpServerPort> <base directory>


[context root]





         After the SimpleHTTPServer launched, we can access files via


visiting http://localhost<http://localhost/>:<httpServerPort>/<context root>/<path relative to


the base directory>





         Any thoughts?





Cheers,


Daniel.Sun











--


View this message in context: http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235.html


Sent from the Groovy Dev mailing list archive at Nabble.com<http://Nabble.com>.







________________________________
If you reply to this email, your message will be added to the discussion below:
http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235p5737245.html
To unsubscribe from SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? ), click here<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5737235&code=cmVhbGJsdWVzdW5AaG90bWFpbC5jb218NTczNzIzNXwxMTQ2MjE4MjI1>.
NAML<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235p5737247.html
Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? )

Posted by Suderman Keith <su...@anc.org>.
-1 as well.

While it is a cool feature, I have to agree that it feels more like a lib than something that belongs in the language itself.  

> On Dec 14, 2016, at 7:55 AM, Daniel Sun <re...@hotmail.com> wrote:
> 
>> groovy -m com.sparkjava:spark-groovy -c "serve(port: 8080, path:
> 'd:\\temp')"
> How many characters will we type... to be frank, I am not that patient to
> type such a long command.

That is what shell scripts are for, it is not a reason to include something in the core language.

Cheers,
Keith

> On Dec 14, 2016, at 12:46 PM, Marcin Erdmann <ma...@proxerd.pl> wrote:
> 
> -1 from me as well, fells more like a lib feature than a language feature. I agree with other folks that it is bloating the language for quite a narrow usecase.
> 
> 
> On Wed, 14 Dec 2016 at 12:39, Sergei Egorov <bsideup@gmail.com <ma...@gmail.com>> wrote:
> Hi Daniel,
> 
> To be honest, I don't like it, -1 from me.
> 
> Why? Because we already put more and more stuff into the groovy itself, but, i.e. in a case of python, SimpleHTTPServer it's just a module after all.
> 
> I would rather see something like:
> 
> groovy -m com.sparkjava:spark-groovy -c "serve(port: 8080, path: 'd:\\temp')"
> 
> On Wed, Dec 14, 2016 at 2:29 PM Daniel Sun <realbluesun@hotmail.com <ma...@hotmail.com>> wrote:
> Hi all,
> 
> 
> 
> 
> 
>         SimpleHTTPServer has been implemented(http://bit.ly/2hsKm0V <http://bit.ly/2hsKm0V>), it
> 
> 
> supports serving files not only under directory but also in the zip file.
> 
> 
> Here is the usage: "-lh <httpServerPort>         listen on a port and
> 
> 
> provide http service", e.g.
> 
> 
> *serve files under current directory*: groovy -lh 8000
> 
> 
> *serve files under a specified directory*: groovy -lh 8000 d:\temp
> 
> 
> *serve files in a zip file(we can view javadoc and groovydoc in the zip
> 
> 
> files inspried by GroovyHelp)*: groovy -lh 8000 d:\apidoc.zip
> 
> 
> 
> 
> 
>          In addition, we can change the context root(/helloworld, default
> 
> 
> context root is /) via passing complete arguments: groovy -lh 8000 d:\temp
> 
> 
> helloworld,  its usage is: groovy -lh <httpServerPort> <base directory>
> 
> 
> [context root]
> 
> 
> 
> 
> 
>          After the SimpleHTTPServer launched, we can access files via
> 
> 
> visiting http://localhost <http://localhost/>:<httpServerPort>/<context root>/<path relative to
> 
> 
> the base directory>
> 
> 
> 
> 
> 
>          Any thoughts?
> 
> 
> 
> 
> 
> Cheers,
> 
> 
> Daniel.Sun
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> 
> 
> View this message in context: http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235.html <http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235.html>
> 
> 
> Sent from the Groovy Dev mailing list archive at Nabble.com.
> 
> 
> 
> 


Re: SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? )

Posted by Daniel Sun <re...@hotmail.com>.
     Actually you can think of -lh as an extention of existing -l, the latter launches socket server and the former launches http server. We should have hooked http server function to the existing socket server, but maintaining a http server need much time and HR, so I implement it based on JDK built-in http server(NO 3rd party library) and use a separate option -lh.
     It is a practical function for many developers(especially for web app developers).

Cheers,
Daniel.Sun






在 2016年12月15日 上午1:48,"Marcin Erdmann [via Groovy]" <ml...@n5.nabble.com>写道:
-1 from me as well, fells more like a lib feature than a language feature. I agree with other folks that it is bloating the language for quite a narrow usecase.


On Wed, 14 Dec 2016 at 12:39, Sergei Egorov <[hidden email]</user/SendEmail.jtp?type=node&node=5737243&i=0>> wrote:
Hi Daniel,

To be honest, I don't like it, -1 from me.

Why? Because we already put more and more stuff into the groovy itself, but, i.e. in a case of python, SimpleHTTPServer it's just a module after all.

I would rather see something like:

groovy -m com.sparkjava:spark-groovy -c "serve(port: 8080, path: 'd:\\temp')"

On Wed, Dec 14, 2016 at 2:29 PM Daniel Sun <[hidden email]</user/SendEmail.jtp?type=node&node=5737243&i=1>> wrote:
Hi all,





        SimpleHTTPServer has been implemented(http://bit.ly/2hsKm0V), it


supports serving files not only under directory but also in the zip file.


Here is the usage: "-lh <httpServerPort>         listen on a port and


provide http service", e.g.


*serve files under current directory*: groovy -lh 8000


*serve files under a specified directory*: groovy -lh 8000 d:\temp


*serve files in a zip file(we can view javadoc and groovydoc in the zip


files inspried by GroovyHelp)*: groovy -lh 8000 d:\apidoc.zip





         In addition, we can change the context root(/helloworld, default


context root is /) via passing complete arguments: groovy -lh 8000 d:\temp


helloworld,  its usage is: groovy -lh <httpServerPort> <base directory>


[context root]





         After the SimpleHTTPServer launched, we can access files via


visiting http://localhost:<httpServerPort>/<context root>/<path relative to


the base directory>





         Any thoughts?





Cheers,


Daniel.Sun











--


View this message in context: http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235.html


Sent from the Groovy Dev mailing list archive at Nabble.com.






________________________________
If you reply to this email, your message will be added to the discussion below:
http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235p5737243.html
To unsubscribe from SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? ), click here<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5737235&code=cmVhbGJsdWVzdW5AaG90bWFpbC5jb218NTczNzIzNXwxMTQ2MjE4MjI1>.
NAML<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235p5737246.html
Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? )

Posted by Marcin Erdmann <ma...@proxerd.pl>.
-1 from me as well, fells more like a lib feature than a language feature.
I agree with other folks that it is bloating the language for quite a
narrow usecase.


On Wed, 14 Dec 2016 at 12:39, Sergei Egorov <bs...@gmail.com> wrote:

> Hi Daniel,
>
> To be honest, I don't like it, -1 from me.
>
> Why? Because we already put more and more stuff into the groovy itself,
> but, i.e. in a case of python, SimpleHTTPServer it's just a module after
> all.
>
> I would rather see something like:
>
> groovy -m com.sparkjava:spark-groovy -c "serve(port: 8080, path:
> 'd:\\temp')"
>
> On Wed, Dec 14, 2016 at 2:29 PM Daniel Sun <re...@hotmail.com>
> wrote:
>
> Hi all,
>
>
>
>
>
>         SimpleHTTPServer has been implemented(http://bit.ly/2hsKm0V), it
>
>
> supports serving files not only under directory but also in the zip file.
>
>
> Here is the usage: "-lh <httpServerPort>         listen on a port and
>
>
> provide http service", e.g.
>
>
> *serve files under current directory*: groovy -lh 8000
>
>
> *serve files under a specified directory*: groovy -lh 8000 d:\temp
>
>
> *serve files in a zip file(we can view javadoc and groovydoc in the zip
>
>
> files inspried by GroovyHelp)*: groovy -lh 8000 d:\apidoc.zip
>
>
>
>
>
>          In addition, we can change the context root(/helloworld, default
>
>
> context root is /) via passing complete arguments: groovy -lh 8000 d:\temp
>
>
> helloworld,  its usage is: groovy -lh <httpServerPort> <base directory>
>
>
> [context root]
>
>
>
>
>
>          After the SimpleHTTPServer launched, we can access files via
>
>
> visiting http://localhost:<httpServerPort>/<context root>/<path relative
> to
>
>
> the base directory>
>
>
>
>
>
>          Any thoughts?
>
>
>
>
>
> Cheers,
>
>
> Daniel.Sun
>
>
>
>
>
>
>
>
>
>
>
> --
>
>
> View this message in context:
> http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235.html
>
>
> Sent from the Groovy Dev mailing list archive at Nabble.com.
>
>
>
>
>

Re: SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? )

Posted by Daniel Sun <re...@hotmail.com>.
> groovy -m com.sparkjava:spark-groovy -c "serve(port: 8080, path:
'd:\\temp')"
How many characters will we type... to be frank, I am not that patient to
type such a long command.

Cheers,
Daniel.Sun



--
View this message in context: http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235p5737238.html
Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: SimpleHTTPServer for Groovy 3( Maybe Groovy 2.5.0? )

Posted by Sergei Egorov <bs...@gmail.com>.
Hi Daniel,

To be honest, I don't like it, -1 from me.

Why? Because we already put more and more stuff into the groovy itself,
but, i.e. in a case of python, SimpleHTTPServer it's just a module after
all.

I would rather see something like:

groovy -m com.sparkjava:spark-groovy -c "serve(port: 8080, path:
'd:\\temp')"

On Wed, Dec 14, 2016 at 2:29 PM Daniel Sun <re...@hotmail.com> wrote:

> Hi all,
>
>         SimpleHTTPServer has been implemented(http://bit.ly/2hsKm0V), it
> supports serving files not only under directory but also in the zip file.
> Here is the usage: "-lh <httpServerPort>         listen on a port and
> provide http service", e.g.
> *serve files under current directory*: groovy -lh 8000
> *serve files under a specified directory*: groovy -lh 8000 d:\temp
> *serve files in a zip file(we can view javadoc and groovydoc in the zip
> files inspried by GroovyHelp)*: groovy -lh 8000 d:\apidoc.zip
>
>          In addition, we can change the context root(/helloworld, default
> context root is /) via passing complete arguments: groovy -lh 8000 d:\temp
> helloworld,  its usage is: groovy -lh <httpServerPort> <base directory>
> [context root]
>
>          After the SimpleHTTPServer launched, we can access files via
> visiting http://localhost:<httpServerPort>/<context root>/<path relative
> to
> the base directory>
>
>          Any thoughts?
>
> Cheers,
> Daniel.Sun
>
>
>
> --
> View this message in context:
> http://groovy.329449.n5.nabble.com/SimpleHTTPServer-for-Groovy-3-Maybe-Groovy-2-5-0-tp5737235.html
> Sent from the Groovy Dev mailing list archive at Nabble.com.
>