Contributing to documentation and writing tests

496 views
Skip to first unread message

Vikas Pandya

unread,
Jun 19, 2013, 10:54:02 PM6/19/13
to spray...@googlegroups.com
Hello Mathias & team,

It's been only a few days since I started looking at Spray for one of the projects that I am working on. I have liked what I have seen so far. Great work.

Some missing API documentation and reference test code for better understanding APIs forced to dig deeper into spray codebase to gain more insight into API usage and stuff. I think I can help in this department for making future/fellow Sprayers life easier with more complete API documentation(filling in todos) and writing corresponding reference test code. Eventually having scalatest or specs2 test for every exposed API/feature. Let me know.

Thanks,

Mathias

unread,
Jun 20, 2013, 4:35:55 AM6/20/13
to spray...@googlegroups.com
Vikas,

filling in the gaps in the docs on spray.io as well as the scaladocs is one of the focus points of this last leg towards a 1.0/1.1/1.2 final release.
So, if you'd like to contribute anything we'd be more than happy to accept a pull-request!

Cheers,
Mathias

---
mat...@spray.io
http://spray.io
> --
> You received this message because you are subscribed to the Google Groups "spray-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to spray-user+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Michael Hamrah

unread,
Jun 22, 2013, 10:21:12 AM6/22/13
to spray...@googlegroups.com
Vikas, have you gotten started on documenting any of the directives?  I was going to start with documenting some of the spray-routing directives.  I also wrote up a post from my experience with building a spray-routing app:


Feedback appreciated.  

Ivan Topolnjak

unread,
Jun 22, 2013, 11:37:24 AM6/22/13
to spray...@googlegroups.com
I think a per directive example filling that huge list of TODOs would be a big step in easing the entrance to spray for newcomers, specially those who don't have a strong Scala + FP background. Trying to understand a directive that does some kind of extraction without an example makes the reader go through functions that produce other functions, hlists + understanding whatever the directive does. I guess that the spray team could provide a simple template for one directive documentation and let the community start adding more and more.. WDYT?


--
You received this message because you are subscribed to the Google Groups "spray-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spray-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

Ivan Topolnjak
Telefono: +54 11 5880-6560 | Skype: ivantopo

Michael Hamrah

unread,
Jun 23, 2013, 9:39:24 AM6/23/13
to spray...@googlegroups.com
Ivan, I was going to start with Entity directive and work from there (http://spray.io/documentation/1.1-M8/spray-routing/marshalling-directives/entity/#entity), following the same pattern of other pages: pull sample code out of other directories.


--
You received this message because you are subscribed to a topic in the Google Groups "spray-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spray-user/x2PJUYkn1Vs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spray-user+...@googlegroups.com.

Johannes Rudolph

unread,
Jun 23, 2013, 2:05:59 PM6/23/13
to spray...@googlegroups.com
Hi Michael,


On Sat, Jun 22, 2013 at 4:21 PM, Michael Hamrah <mha...@gmail.com> wrote:
I also wrote up a post from my experience with building a spray-routing app:


Feedback appreciated.  

great introductory post, thanks for sharing. A few things I wondered about (nothing serious):

(worker ? Create(json))
               .mapTo[Ok]
               .map(result => result)
               .recover { case _ ="error" }

 * `.map(result => result)` should have no effect. Is something missing in that line?
 * using `recover` the error will still be reported to the user with a 200 Ok HTTP message. You may want to think about using `reject` instead of `complete` in this case to report the error with a suitable status code. This will need some restructuring of the code so maybe it is out of scope for the article.
 * your sample code on github depends on dispatch fetching in all of its dependencies even if the sample doesn't make use of it
 * the only route you really implemented was the one using POST which makes it somewhat hard to try it out in the browser

But those are just little nitpicks. Thanks again.

Johannes

Johannes Rudolph

unread,
Jun 23, 2013, 2:15:34 PM6/23/13
to spray...@googlegroups.com
On Sat, Jun 22, 2013 at 5:37 PM, Ivan Topolnjak <ivan...@gmail.com> wrote:
I think a per directive example filling that huge list of TODOs would be a big step in easing the entrance to spray for newcomers, specially those who don't have a strong Scala + FP background. Trying to understand a directive that does some kind of extraction without an example makes the reader go through functions that produce other functions, hlists + understanding whatever the directive does. I guess that the spray team could provide a simple template for one directive documentation and let the community start adding more and more.. WDYT?

Absolutely, even if you are no beginner you can figure out things much faster if there are examples to start with.

Thanks a lot for offering to help with the documentation. I agree it makes sense to have a template/example documentation page to start with so that all directives are documented in a similar way. I'll try to come up with something tomorrow.
 
--
Johannes

-----------------------------------------------
Johannes Rudolph
http://virtual-void.net

Michael Hamrah

unread,
Jun 23, 2013, 11:02:00 PM6/23/13
to spray...@googlegroups.com
Johannes, thanks for the feedback!  I made the following changes:

- Added a string interpolation message to map(result) to beef it up a little.  
- I added some simple curl commands to test the requests.  I wanted to focus on Spray as an API.  The links are covered in Spray's example; and felt covering it here would be too much.  Curl seems like a balance.
- I removed dispatch; that was just a carryover library from my g8 template.

Finally, I agree the error case should return a 500 error or some other 5xx code.  I'll add that in soon.

Again, thanks for the feedback.  Greatly appreciated.  


Johannes Rudolph

unread,
Jun 24, 2013, 10:43:22 AM6/24/13
to spray...@googlegroups.com
Hi,

I posted a PR [1] with a suggested documentation format for directives. You may start your documentation work based on this PR or wait until Mathias has reviewed and merged it to be safe that this will be the accepted structure. I would suggest to start with the simpler directives. Maybe you can drop a note here on which section you are working so that no double work is done.

We decided the examples to be full tests. This way we can document both route code and test code side-by-side.

Maybe you have figured out but working on the documentation basically works like this:

 * Install sphinx: http://sphinx-doc.org/ (`apt-get install python-sphinx` in ubuntu)
 * set the SPHINX_PATH environment variable to point to the sphinx_build script (e.g. `/usr/bin/sphinx-build` in my ubuntu)
 * run sbt
 * `project site`
 * re-start
 * browse to `localhost:8080`
 * `~ products` to automatically rebuild the sphinx site when some source file has changed
 * change documentation
 * reload page
 * go 2 steps back

Examples in the documentation are all executable tests. See the PR on where to put example code. Before committing run `test` in the `docs` project to make sure the tests compile.

Thanks again,

Johannes





--
You received this message because you are subscribed to the Google Groups "spray-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spray-user+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ivan Topolnjak

unread,
Jun 25, 2013, 9:09:29 AM6/25/13
to spray...@googlegroups.com
Nice to see this Johannes, It is a very nice start! I saw the files in the PR and seems pretty obvious how to write them, even while I have never used sphinx before.. let's see what Mathias thinks about it and then I can start pushing some stuff, best regards!

Mathias

unread,
Jun 25, 2013, 4:06:48 PM6/25/13
to spray...@googlegroups.com
Ivan,

yes, this is an excellent starting point for the directive docs.
Johannes' PR just got merged into master, so the road is clear for contributions.

Thanks for helping!

Cheers,
Mathias

---
mat...@spray.io
http://spray.io

> *
> *
> *Ivan Topolnjak*
> *Telefono: +54 11 5880-6560 | Skype: ivantopo*

Birju Patel

unread,
Jun 28, 2013, 11:13:53 PM6/28/13
to spray...@googlegroups.com, johannes...@googlemail.com
Johannes,

I am trying to setup sphinx on Mac OS X. There isn't a brew install so I manually downloaded and set up SPHINX_PATH into .profile. 
1)sbt "project site" shell runs fine 
2) but while running re-start I keep getting following. permissions into SPHINX dir is chmod 777. seems like something stupid that I am missing.  Any idea?

[trace] Stack trace suppressed: run last site/*:sphinx-compile for the full output.

[error] (site/*:sphinx-compile) java.io.IOException: Cannot run program "/Users/birjupat/birkenfeld-sphinx-e5ad8ce30a8a": error=13, Permission denied

Ivan Topolnjak

unread,
Jun 30, 2013, 8:27:49 PM6/30/13
to spray...@googlegroups.com
Birju, I just got this working on my mac and probably the easiest way to get all that is needed is through macports as pointed out in the sphinx site [1], then the SPHINX_PATH env variable should (counterintuitively) point to the sphinx-build script itself, not the path where it is placed which I think is the error you are seeing now.. hope it helps!

[1] http://sphinx-doc.org/latest/install.html#mac-os-x-install-sphinx-using-macports

Thomas Lockney

unread,
Jul 1, 2013, 12:03:02 AM7/1/13
to spray...@googlegroups.com, johannes...@googlemail.com
On Friday, June 28, 2013 8:13:53 PM UTC-7, Birju Patel wrote:
Johannes,

I am trying to setup sphinx on Mac OS X. There isn't a brew install so I manually downloaded and set up SPHINX_PATH into .profile.
 
There isn't a brew install because Sphinx is a Python library/module, which brew explicitly doesn't manage (see [1] for more on Python libs and Homebrew). Assuming you've already done `brew install python`, which you might want to do to use a more up-to-date and complete version of Python than what OSX ships, you can run 'pip install sphinx' to get it installed. You can probably get this working with the system installed version of Python, too, but it's going to be more painful. 

~thomas

Johannes Rudolph

unread,
Jul 1, 2013, 8:30:15 AM7/1/13
to spray...@googlegroups.com
Thanks Thomas for helping out. I'm running on Linux so no advice from me about how to proceed on Mac OS with this. Mathias is running on Mac OS so if you are still having problems getting this running please keep asking (and afterwards we should update developer documentation with the needed steps).

Johannes


--
You received this message because you are subscribed to the Google Groups "spray-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spray-user+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Birju Patel

unread,
Jul 1, 2013, 11:14:42 AM7/1/13
to spray...@googlegroups.com, johannes...@googlemail.com

Thomas thanks. I did do 'pip install sphinx' as you suggested. 

sbt "project site" shell continues working w/o error but now with 're-start' I get following. Any idea what could I be missing?

[error] Error: The Docutils library cannot be found. Did you install Sphinx and its dependencies correctly?
[trace] Stack trace suppressed: run last site/*:sphinx-compile for the full output.
[error] (site/*:sphinx-compile) Error compiling sphinx sources

Michael Hamrah

unread,
Jul 1, 2013, 5:08:39 PM7/1/13
to spray...@googlegroups.com, johannes...@googlemail.com
Johannes,

I was trying to make two changes to my sample project and have been having difficulty.  I'd like to:

1) If successful, set the response status code to spray.http.StatusCodes.Created
2) If a failure, log a message and return a spray.http.StatusCodes.InternalServerError

I can do each one of these individually but cannot string it together correctly in a future with the ask pattern.  Any suggestions?

Thanks,

Mike

Michael Hamrah

unread,
Jul 1, 2013, 5:30:01 PM7/1/13
to spray...@googlegroups.com, johannes...@googlemail.com
I found this thread which does the job; curious if there's a different approach:

Mathias

unread,
Jul 2, 2013, 7:24:33 AM7/2/13
to spray...@googlegroups.com
For the record, I replied in the thread you linked to.

Cheers,
Mathias

---
mat...@spray.io
http://spray.io

Mathias

unread,
Jul 3, 2013, 10:30:47 AM7/3/13
to spray...@googlegroups.com
Birju,

I installed python (currently version 2.7.5) via homebrew and then sphinx via pip.
With this in my dot file:

export SPHINX_PATH=/usr/local/share/python/sphinx-build

everything works nicely for me.

Can you properly run `sphinx-build` from your command line?
The error you are seeing suggest some borkedness of your python packages.
Or maybe the JVM forked off by revolver somehow runs a different python environment.

When I run `pip list` I see these packages (among others):

- docutils (0.10)
- Sphinx (1.2b1)
- Pygments (1.6)

HTH and cheers,

Birju Patel

unread,
Jul 10, 2013, 5:21:28 PM7/10/13
to spray...@googlegroups.com
Hi Mathias,

Sorry to be annoying here but this sphinx installation is driving me crazy. I have followed installation just like yours only diff is I see sphinx installed on a following python directory path 
/usr/local/lib/python2.7/site-packages

and in my .profile file I have manually added "export SPHINX_PATH=/usr/local/lib/python2.7/site-packages/sphinx" while running

sbt "project site" shell works w/o any errors but upon 
're-start' it throws 
error] (site/*:sphinx-compile) java.io.IOException: Cannot run program "/usr/local/lib/python2.7/site-packages/sphinx": error=13, Permission denied

I can say this isn't a permissioning issue since all directories and files have chmod 777 privileges. I think my SPHINX installation/SPHNIX_PATH is screwed up/or wrong somehow? I am running OS X 10.8.4. any help is appreciated.

Thanks

Mathias

unread,
Jul 11, 2013, 10:04:37 AM7/11/13
to spray...@googlegroups.com
Birju,

the `SPHINX_PATH` env variable needs to point to the `sphinx-build` script.
Try setting it like this:

export SPHINX_PATH=/usr/local/share/python/sphinx-build

Even though sphinx itself is installed in /usr/local/lib/python2.7/site-packages/sphinx the executables live in another directory.
What output do you get for `which sphinx-build`?
This is the path you need to set SPHINX_PATH to.

Cheers,
On 10.07.2013, at 23:21, Birju Patel <birj...@gmail.com> wrote:

> Hi Mathias,
>
> Sorry to be annoying here but this sphinx installation is driving me crazy.
> I have followed installation just like yours only diff is I see sphinx
> installed on a following python directory path
> /usr/local/lib/python2.7/site-packages
>
> and in my .profile file I have manually added "export
> SPHINX_PATH=/usr/local/lib/python2.7/site-packages/sphinx" while running
>
> sbt "project site" shell works w/o any errors but upon
> 're-start' it throws
> *error] (site/*:sphinx-compile) java.io.IOException: Cannot run program
> "/usr/local/lib/python2.7/site-packages/sphinx": error=13, Permission denied
> *
> *
> *
> I can say this isn't a permissioning issue since all directories and files
> have chmod 777 privileges. I think my SPHINX installation/SPHNIX_PATH is
> screwed up/or wrong somehow? I am running OS X 10.8.4. any help is
> appreciated.
>
> Thanks
> *
> *
> On Wednesday, July 3, 2013 10:30:47 AM UTC-4, Mathias wrote:
>>
>> Birju,
>>
>> I installed python (currently version 2.7.5) via homebrew and then sphinx
>> via pip.
>> With this in my dot file:
>>
>> export SPHINX_PATH=/usr/local/share/python/sphinx-build
>>
>> everything works nicely for me.
>>
>> Can you properly run `sphinx-build` from your command line?
>> The error you are seeing suggest some borkedness of your python packages.
>> Or maybe the JVM forked off by revolver somehow runs a different python
>> environment.
>>
>> When I run `pip list` I see these packages (among others):
>>
>> - docutils (0.10)
>> - Sphinx (1.2b1)
>> - Pygments (1.6)
>>
>> HTH and cheers,
>> Mathias
>>
>> ---
>> mat...@spray.io <javascript:>
>> http://spray.io
>>
>> On 01.07.2013, at 17:14, Birju Patel <birj...@gmail.com <javascript:>>
>> an email to spray-user+...@googlegroups.com <javascript:>.

Birju Patel

unread,
Jul 12, 2013, 2:40:54 PM7/12/13
to spray...@googlegroups.com
Hi Mathias,

I don't see anything when type in which `sphnix-build`. clearly my sphnix installation doesn't look right? 

Though it shows me following upon `pip list`. 
docutils (0.10)
Pygments (1.6)
Sphinx (1.2b1)

Any thoughts?

Thanks,

Birju Patel

unread,
Aug 4, 2013, 7:20:39 AM8/4/13
to spray...@googlegroups.com, johannes...@googlemail.com
Hello,

finally I was able to come back to this today and got sphinx setup up & running. http://localhost:8080/ shows me "Say hello to Spray-Can" with some defined Resources like "/ping", "stream", "server-stats" etc. how/where do I see and edit documentation? 

Thanks,


On Monday, June 24, 2013 10:43:22 AM UTC-4, Johannes Rudolph wrote:

Johannes Rudolph

unread,
Aug 4, 2013, 8:16:05 AM8/4/13
to Birju Patel, spray...@googlegroups.com
Hi Birju,

On Sun, Aug 4, 2013 at 1:20 PM, Birju Patel <birj...@gmail.com> wrote:
Hello,

finally I was able to come back to this today and got sphinx setup up & running. http://localhost:8080/ shows me "Say hello to Spray-Can" with some defined Resources like "/ping", "stream", "server-stats" etc. how/where do I see and edit documentation? 

seems you ran one of the examples instead of the documentation site. Use `project site` and then `re-start` to run the documentation site.

Age Mooij

unread,
Aug 4, 2013, 8:58:17 AM8/4/13
to spray...@googlegroups.com, Birju Patel
The actual documentation is in the "docs" folder in the form of reStructuredText files. The "site" project takes this as input and turns it into an intermediate form called fjson, which is then served as html by running the "site" project with sbt run.

Age


Birju Patel

unread,
Aug 4, 2013, 5:09:26 PM8/4/13
to spray...@googlegroups.com, Birju Patel, johannes...@googlemail.com
Hi Johannes,

Sorry to sound lame but i am not sbt expert so may be I am doing something wrong here in starting the project? when I run sbt `project site` i see

-bash: project: command not found
[info] Loading project definition from /Users/birjupat/spray/project
[info] Set current project to root (in build file:/Users/birjupat/spray/)
root > 

re-start shows me following log. not sure why 'site' isn't started. you can  see that log message below. Any idea please?

[info] Recompiling Sphinx sources...

[info] /usr/local/bin/sphinx-build -b json -d /Users/birjupat/spray/site/target/scala-2.10/resource_managed/main/sphinx/doctrees -D version=1.1-SNAPSHOT -D release=1.1-SNAPSHOT /Users/birjupat/spray/docs /Users/birjupat/spray/site/target/scala-2.10/resource_managed/main/sphinx/json

[info] Stopping application echo-server (by killing the forked JVM) ...

[info] Stopping application server-benchmark (by killing the forked JVM) ...

[info] Stopping application simple-http-server (by killing the forked JVM) ...

[info] Running Sphinx v1.1.3

[info] Stopping application simple-routing-app (by killing the forked JVM) ...

[info] Stopping application on-spray-can (by killing the forked JVM) ...

[info] loading pickled environment... done

[info] building [json]: targets for 0 source files that are out of date

[info] updating environment: 0 added, 0 changed, 0 removed

[info] looking for now-outdated files... none found

[info] no targets are out of date.

[info] Starting application echo-server in the background ...

echo-server Starting spray.examples.Main.main()

echo-server ... finished with exit code 143

server-benchmark ... finished with exit code 143

[info] Starting application server-benchmark in the background ...

server-benchmark Starting spray.examples.Main.main()

simple-http-server ... finished with exit code 143

[info] Starting application simple-http-server in the background ...

simple-http-server Starting spray.examples.Main.main()

[info] Starting application simple-routing-app in the background ...

simple-routing-app ... finished with exit code 143

simple-routing-app Starting spray.examples.Main.main()

[info] Starting application on-spray-can in the background ...

on-spray-can ... finished with exit code 143

on-spray-can Starting spray.examples.Boot.main()

server-benchmark     178   1       java.lang.String::hashCode (64 bytes)

server-benchmark     244   2       java.lang.String::charAt (33 bytes)

server-benchmark     246   3       sun.nio.cs.UTF_8$Encoder::encodeArrayLoop (490 bytes)

server-benchmark     269   4       java.util.Properties$LineReader::readLine (452 bytes)

[info] Stopping application site (by killing the forked JVM) ...

server-benchmark     311   5       sun.nio.cs.UTF_8$Decoder::decodeArrayLoop (553 bytes)

server-benchmark     322   6       java.math.BigInteger::mulAdd (81 bytes)

server-benchmark     326   7       java.math.BigInteger::multiplyToLen (219 bytes)

server-benchmark     333   8       java.math.BigInteger::addOne (77 bytes)

server-benchmark     336   9       java.math.BigInteger::squareToLen (172 bytes)

server-benchmark     346  10       java.math.BigInteger::primitiveLeftShift (79 bytes)

server-benchmark     349  11       java.math.BigInteger::montReduce (99 bytes)

server-benchmark     370  12       sun.security.provider.SHA::implCompress (491 bytes)

server-benchmark     408  13       java.lang.Object::<init> (1 bytes)

server-benchmark     461  14       java.io.UnixFileSystem::normalize (75 bytes)

server-benchmark     469  15       java.lang.String::lastIndexOf (156 bytes)

server-benchmark     497  16       java.util.regex.Pattern$Start::match (109 bytes)

server-benchmark     498  17       java.util.regex.Pattern$BmpCharProperty::match (50 bytes)

server-benchmark     500  18       java.util.regex.Pattern$Single::isSatisfiedBy (14 bytes)

server-benchmark     506  19       java.lang.String::indexOf (151 bytes)

server-benchmark     507  20       java.lang.CharacterDataLatin1::getProperties (11 bytes)

server-benchmark     508  21       java.lang.String::equals (88 bytes)

server-benchmark     526  22       java.lang.Math::max (11 bytes)

server-benchmark     526  23       java.util.jar.JarFile::hasClassPathAttribute (168 bytes)

server-benchmark     533  24       java.util.jar.Manifest$FastInputStream::readLine (167 bytes)

server-benchmark     576  25       java.util.regex.Matcher::search (109 bytes)

server-benchmark     588  26       java.lang.String::indexOf (7 bytes)

server-benchmark     589  27       java.net.URI$Parser::charAt (9 bytes)

server-benchmark     591  28       java.net.URI::match (50 bytes)

server-benchmark     591  29       java.lang.AbstractStringBuilder::append (40 bytes)

server-benchmark     592  30       java.lang.StringBuilder::append (8 bytes)

server-benchmark     595  31  !    sun.net.www.ParseUtil::decode (194 bytes)

server-benchmark     602  32       java.math.BigInteger::subN (46 bytes)

server-benchmark     605  33       java.math.MutableBigInteger::mulsub (110 bytes)

server-benchmark ---   n   java.lang.System::arraycopy (static)

server-benchmark     612  34       java.lang.String::indexOf (166 bytes)

server-benchmark     620  35       java.lang.String::startsWith (78 bytes)

site ... finished with exit code 143

[info] Starting application site in the background ...

site Starting spray.site.Main.main()

server-benchmark     644  36       sun.net.www.ParseUtil::encodePath (336 bytes)

server-benchmark     652  37       java.lang.String::lastIndexOf (151 bytes)

server-benchmark     672  38       java.lang.Math::min (11 bytes)

[success] Total time: 2 s, completed Aug 4, 2013 4:58:39 PM

server-benchmark     766  39       java.lang.AbstractStringBuilder::append (60 bytes)

server-benchmark     771  40       java.lang.String::replace (142 bytes)

root > server-benchmark     799  41       java.util.AbstractCollection::isEmpty (13 bytes)

server-benchmark     800  42       java.io.BufferedReader::ensureOpen (18 bytes)

server-benchmark     801  43  !    com.typesafe.config.impl.Tokenizer$TokenIterator::nextCharRaw (70 bytes)

server-benchmark     801  44  !    java.io.BufferedReader::read (104 bytes)

server-benchmark     805  45       java.lang.StringBuilder::appendCodePoint (8 bytes)

server-benchmark     806  46       java.lang.AbstractStringBuilder::appendCodePoint (97 bytes)

server-benchmark     809  47       java.lang.Character::isValidCodePoint (16 bytes)

server-benchmark     809  48       com.typesafe.config.impl.Tokenizer$TokenIterator::pullComment (77 bytes)

server-benchmark     826  49       java.lang.StringBuilder::append (8 bytes)

server-benchmark     827  41      made not entrant  java.util.AbstractCollection::isEmpty (13 bytes)

server-benchmark     855  50       java.util.HashMap::indexFor (6 bytes)

server-benchmark     875  16      made not entrant  java.util.regex.Pattern$Start::match (109 bytes)

server-benchmark     875  17      made not entrant  java.util.regex.Pattern$BmpCharProperty::match (50 bytes)

server-benchmark     875  25      made not entrant  java.util.regex.Matcher::search (109 bytes)

server-benchmark     875  51       java.lang.Character::toLowerCase (162 bytes)

server-benchmark     878  52       java.lang.CharacterDataLatin1::toLowerCase (36 bytes)

server-benchmark     883  53       java.util.HashMap::hash (23 bytes)

server-benchmark     891  43  !   made not entrant  com.typesafe.config.impl.Tokenizer$TokenIterator::nextCharRaw (70 bytes)

server-benchmark     906  54       com.typesafe.config.impl.ConfigImplUtil::isWhitespace (59 bytes)

server-benchmark     914  55       java.nio.Buffer::position (43 bytes)

server-benchmark     916  56       java.util.HashMap::get (79 bytes)

server-benchmark     916  57       java.lang.String::substring (83 bytes)

server-benchmark     926  58       java.nio.charset.CoderResult::isUnderflow (13 bytes)

server-benchmark     929  59       java.util.ArrayList::RangeCheck (48 bytes)

server-benchmark     959  60       java.util.ArrayList::get (12 bytes)

server-benchmark    1032  61  !    java.net.URL::<init> (531 bytes)

server-benchmark    1035  62       java.util.Arrays::copyOfRange (63 bytes)

server-benchmark    1070  63       java.lang.String::getChars (66 bytes)

server-benchmark    1076  64 s!    sun.misc.URLClassPath::getLoader (145 bytes)

server-benchmark    1096  65       java.util.HashMap$HashIterator::nextEntry (99 bytes)

server-benchmark    1113  66       sun.misc.URLClassPath::getResource (74 bytes)

server-benchmark    1118  67       java.lang.String::<init> (72 bytes)

server-benchmark ---   n   java.util.zip.ZipFile::getEntry (static)

server-benchmark [GC 17024K->1275K(83008K), 0.0081465 secs]

server-benchmark    1152  68       java.util.zip.ZipFile::ensureOpen (37 bytes)

server-benchmark    1173  69  !    sun.misc.URLClassPath$JarLoader::ensureOpen (32 bytes)

server-benchmark    1176  70       java.util.jar.JarFile::getEntry (22 bytes)

server-benchmark    1180  41      made zombie  java.util.AbstractCollection::isEmpty (13 bytes)

server-benchmark    1180  71  !    java.util.zip.ZipFile::getEntry (82 bytes)

server-benchmark    1184  72       java.util.jar.JarFile::getJarEntry (9 bytes)

server-benchmark    1200  73  !    sun.misc.URLClassPath$JarLoader::getResource (91 bytes)

server-benchmark    1233  74       java.lang.String::startsWith (7 bytes)

server-benchmark    1259  75       java.lang.String::indexOf (29 bytes)

server-benchmark    1259  76       java.lang.String::endsWith (15 bytes)

server-benchmark    1267  77       java.lang.AbstractStringBuilder::<init> (12 bytes)

server-benchmark    1269  78       java.lang.StringBuilder::toString (17 bytes)

server-benchmark    1300  79       scala.concurrent.forkjoin.ForkJoinPool::scan (801 bytes)

server-benchmark    1377  21      made not entrant  java.lang.String::equals (88 bytes)

server-benchmark    1382  80       java.lang.String::lastIndexOf (12 bytes)

server-benchmark    1386  81       java.lang.String::equals (88 bytes)

server-benchmark    1395  66      made not entrant  sun.misc.URLClassPath::getResource (74 bytes)

server-benchmark    1400  82       java.lang.StringBuilder::<init> (7 bytes)

echo-server 08/04 16:58:40.002 INFO [lt-dispatcher-2] a.e.s.Slf4jEventHandler - Slf4jEventHandler started

server-benchmark    1460  83       java.util.Arrays::fill (28 bytes)

server-benchmark    1474  84       java.util.regex.Matcher::reset (83 bytes)

server-benchmark    1486  85       java.lang.String::toLowerCase (436 bytes)

server-benchmark    1521   1%      sun.misc.URLClassPath::getResource @ 39 (74 bytes)

server-benchmark    1549  86       sun.misc.URLClassPath::getResource (74 bytes)

server-benchmark    1584  87       java.lang.String::indexOf (7 bytes)

echo-server 

echo-server Bound echo-server to /127.0.0.1:23456

echo-server Run `telnet localhost 23456`, type something and press RETURN. Type `STOP` to exit...

echo-server 

server-benchmark    1594  88       java.nio.Buffer::limit (62 bytes)

server-benchmark    1596  89       java.nio.Buffer::<init> (68 bytes)

server-benchmark    1634  90       java.lang.Character::toUpperCase (162 bytes)

server-benchmark    1635  91       java.lang.CharacterDataLatin1::toUpperCase (50 bytes)

server-benchmark 08/04 16:58:40.197 INFO [lt-dispatcher-4] a.e.s.Slf4jEventHandler - Slf4jEventHandler started

simple-http-server 08/04 16:58:40.217 INFO [lt-dispatcher-2] a.e.s.Slf4jEventHandler - Slf4jEventHandler started

server-benchmark [GC 18299K->2458K(83008K), 0.0131367 secs]

server-benchmark    1717  92       sun.security.util.ManifestDigester::findSection (180 bytes)

server-benchmark    1719  16      made zombie  java.util.regex.Pattern$Start::match (109 bytes)

server-benchmark    1720  17      made zombie  java.util.regex.Pattern$BmpCharProperty::match (50 bytes)

server-benchmark    1729  93       java.lang.Integer::reverseBytes (26 bytes)

server-benchmark    1729  25      made zombie  java.util.regex.Matcher::search (109 bytes)

server-benchmark ---   n   sun.misc.Unsafe::getInt

server-benchmark    1762  94       sun.security.util.Cache$EqualByteArray::hashCode (57 bytes)

server-benchmark    1766  43  !   made zombie  com.typesafe.config.impl.Tokenizer$TokenIterator::nextCharRaw (70 bytes)

server-benchmark    1792  95 s     java.io.ByteArrayInputStream::read (36 bytes)

server-benchmark    1797  96 s     java.io.ByteArrayInputStream::available (10 bytes)

server-benchmark    1798  97       java.math.BigInteger::stripLeadingZeroBytes (132 bytes)

server-benchmark    1806  98  !    java.util.jar.Attributes::read (410 bytes)

server-benchmark    1808  99       java.util.jar.Attributes$Name::isValid (45 bytes)

server-benchmark    1812 100       sun.misc.ASCIICaseInsensitiveComparator::lowerCaseHashCode (36 bytes)

server-benchmark    1817 101       java.lang.String::<init> (111 bytes)

server-benchmark    1827 102       java.lang.String::toUpperCase (442 bytes)

server-benchmark    1853 103       java.lang.Character::toUpperCaseEx (178 bytes)

server-benchmark    1855 104       java.lang.CharacterDataLatin1::toUpperCaseEx (67 bytes)

server-benchmark    1855 105       java.util.HashMap::put (126 bytes)

server-benchmark    1856 106       java.math.BigInteger::destructiveMulAdd (150 bytes)

server-benchmark    1860 107       java.lang.Character::digit (6 bytes)

server-benchmark    1862 108       java.lang.Character::digit (168 bytes)

server-benchmark    1862 109       java.lang.CharacterDataLatin1::digit (85 bytes)

server-benchmark    1863 110       java.lang.Integer::parseInt (269 bytes)

server-benchmark    1872 111       sun.security.util.DerInputStream::available (8 bytes)

server-benchmark    1880 112       java.util.AbstractCollection::<init> (5 bytes)

server-benchmark    1882 113       sun.reflect.ClassFileAssembler::emitByte (11 bytes)

server-benchmark    1882 114       sun.reflect.ByteVectorImpl::add (38 bytes)

server-benchmark    1886 115       java.io.ByteArrayInputStream::mark (9 bytes)

server-benchmark    1902 116       sun.security.util.DerInputStream::getLength (111 bytes)

server-benchmark    1907 117       sun.security.util.ObjectIdentifier::checkValidOid (115 bytes)

server-benchmark    1910 118       sun.security.util.DerInputStream::getByte (12 bytes)

server-benchmark    1922 119       sun.security.util.ObjectIdentifier::initFromEncoding (206 bytes)

server-benchmark    1922 120       java.util.Arrays::copyOf (19 bytes)

server-benchmark ---   n   java.lang.Object::clone

on-spray-can 08/04 16:58:40 INFO [on-spray-can-akka.actor.default-dispatcher-5] a.e.s.Slf4jEventHandler - Slf4jEventHandler started

server-benchmark    1941 121       sun.security.util.ObjectIdentifier::getComponent (73 bytes)

server-benchmark    1946 122       sun.security.util.ObjectIdentifier::hashCode (35 bytes)

server-benchmark    1948 123       sun.security.util.ObjectIdentifier::equals (69 bytes)

server-benchmark    1949 124       sun.security.util.DerInputStream::<init> (19 bytes)

server-benchmark    1963 125 s     java.io.ByteArrayInputStream::skip (49 bytes)

server-benchmark    1970 126  !    sun.security.util.DerInputBuffer::dup (29 bytes)

server-benchmark    1971 127       sun.security.util.DerInputBuffer::truncate (29 bytes)

server-benchmark    1975 128       sun.security.util.DerValue::<init> (250 bytes)

server-benchmark    1976 129       java.net.URI$Parser::scan (73 bytes)

server-benchmark    1983 130 s     java.io.ByteArrayOutputStream::write (55 bytes)

server-benchmark    1986 131       java.net.URI$Parser::scan (50 bytes)

server-benchmark    1991 132  !    java.security.cert.Certificate::hashCode (34 bytes)

server-benchmark    2023 133       java.lang.System::getSecurityManager (4 bytes)

server-benchmark    2030 134       java.lang.StringBuilder::length (5 bytes)

server-benchmark    2033  98  !   made not entrant  java.util.jar.Attributes::read (410 bytes)

server-benchmark    2088 135       java.lang.Class$MethodArray::removeByNameAndSignature (71 bytes)

server-benchmark    2092 136       java.util.regex.Matcher::search (109 bytes)

server-benchmark    2117 137       java.net.URLStreamHandler::setURL (40 bytes)

server-benchmark    2118 138  !    java.net.URL::set (114 bytes)

server-benchmark    2119 139       java.lang.String::lastIndexOf (29 bytes)

server-benchmark    2120 140       java.lang.String::lastIndexOf (10 bytes)

server-benchmark    2135 141       java.util.BitSet::checkInvariants (111 bytes)

server-benchmark    2147 142  !    sun.misc.URLClassPath$JarLoader::getResource (353 bytes)

server-benchmark    2147 143       sun.misc.JarIndex::get (49 bytes)

server-benchmark    2190 144       java.lang.ref.SoftReference::get (29 bytes)

server-benchmark ---   n   java.lang.Thread::currentThread (static)

server-benchmark    2200 145       java.net.URLStreamHandler::parseURL (1158 bytes)

server-benchmark [GC 19482K->3559K(83008K), 0.0101255 secs]

server-benchmark    2285 146       java.nio.ByteBuffer::arrayOffset (35 bytes)

server-benchmark    2286  21      made zombie  java.lang.String::equals (88 bytes)

server-benchmark    2296 147       java.nio.CharBuffer::arrayOffset (35 bytes)

server-benchmark    2329 148       java.lang.String::<init> (20 bytes)

server-benchmark    2330  66      made zombie  sun.misc.URLClassPath::getResource (74 bytes)

server-benchmark    2384 149       java.util.Vector::ensureCapacityHelper (60 bytes)

server-benchmark    2405 150       java.lang.ThreadLocal::get (34 bytes)

server-benchmark    2407 151       java.lang.ThreadLocal$ThreadLocalMap::access$000 (6 bytes)

server-benchmark    2408 152       java.lang.ThreadLocal$ThreadLocalMap::getEntry (42 bytes)

server-benchmark    2410 153       java.lang.ThreadLocal::getMap (5 bytes)

server-benchmark    2410 154 s     java.lang.Throwable::getOurStackTrace (49 bytes)

server-benchmark ---   n   java.lang.Throwable::getStackTraceElement

server-benchmark    2460 155       java.nio.Buffer::hasRemaining (17 bytes)

server-benchmark    2462 156       java.nio.ByteBuffer::hasArray (20 bytes)

server-benchmark    2463 157       java.nio.CharBuffer::hasArray (20 bytes)

server-benchmark    2463 158       java.nio.charset.CoderResult::isOverflow (14 bytes)

server-benchmark    2470 159       java.nio.CharBuffer::<init> (22 bytes)

server-benchmark    2472 160  !    java.nio.CharBuffer::wrap (20 bytes)

server-benchmark    2472 161       java.nio.HeapCharBuffer::<init> (14 bytes)

server-benchmark    2475 162  !    java.nio.Bits::byteOrder (119 bytes)

server-benchmark    2476 163       java.nio.ByteBuffer::<init> (45 bytes)

server-benchmark    2480 164  !    java.nio.ByteBuffer::wrap (20 bytes)

server-benchmark    2482 165       java.nio.HeapByteBuffer::<init> (14 bytes)

server-benchmark    2482 166       java.lang.StringCoding::access$000 (6 bytes)

server-benchmark    2483 167       java.lang.StringCoding::scale (7 bytes)

server-benchmark    2483 168       java.lang.StringCoding::deref (19 bytes)

server-benchmark    2484 169       sun.nio.cs.UTF_8::updatePositions (23 bytes)

server-benchmark    2557 170       java.lang.String::substring (10 bytes)

server-benchmark    2559 171       java.util.AbstractCollection::isEmpty (13 bytes)

simple-http-server 08/04 16:58:41.182 INFO [lt-dispatcher-3] akka://default/user/IO-HTTP/listener-0 - Bound to localhost/127.0.0.1:8080

server-benchmark    2658 172       sun.misc.ASCIICaseInsensitiveComparator::toLower (16 bytes)

server-benchmark    2658 173       sun.misc.ASCIICaseInsensitiveComparator::isUpper (18 bytes)

server-benchmark    2661 174       sun.misc.ASCIICaseInsensitiveComparator::compare (143 bytes)

site 08/04 16:58:41 INFO [lt-dispatcher-2] akka.event.slf4j.Slf4jEventHandler - Slf4jEventHandler started

server-benchmark    2666 175       java.util.TreeMap::parentOf (13 bytes)

server-benchmark    2669 176       scala.collection.AbstractIterable::<init> (17 bytes)

server-benchmark    2669 177       scala.collection.AbstractTraversable::<init> (33 bytes)

server-benchmark    2673 178       java.util.TreeMap::put (240 bytes)

server-benchmark    2673 179       java.util.TreeMap::getEntryUsingComparator (74 bytes)

site 08/04 16:58:41 DEBUG[lt-dispatcher-2] akka.event.EventStream - logger log1-Slf4jEventHandler started

site 08/04 16:58:41 DEBUG[lt-dispatcher-2] akka.event.EventStream - Default Loggers started

site 08/04 16:58:41 INFO [lt-dispatcher-2] spray.site.Main$ - Loading sphinx content root...

server-benchmark    2710 180       java.nio.ByteBuffer::array (35 bytes)

server-benchmark    2713 181  !    com.typesafe.config.impl.Tokenizer$TokenIterator::nextCharRaw (70 bytes)

server-benchmark    2718 182       java.nio.CharBuffer::array (35 bytes)

server-benchmark    2722 183 s     java.util.Vector::size (5 bytes)

server-benchmark [GC 20583K->5301K(83008K), 0.0089622 secs]

server-benchmark    2779 184       java.nio.ByteBuffer::wrap (8 bytes)

server-benchmark    2779 185  !    java.lang.StringCoding::encode (120 bytes)

server-benchmark    2781 186  !    java.lang.StringCoding$StringEncoder::encode (130 bytes)

server-benchmark 08/04 16:58:41.325 WARN [lt-dispatcher-4] akka://default/user/IO-HTTP/listener-0 - Bind to localhost/127.0.0.1:8080 failed

server-benchmark    2812 187       java.nio.charset.CharsetEncoder::maxBytesPerChar (5 bytes)

server-benchmark    2812  98  !   made zombie  java.util.jar.Attributes::read (410 bytes)

server-benchmark    2812 188       java.lang.String::getBytes (29 bytes)

server-benchmark    2820 189       java.nio.charset.CharsetEncoder::reset (11 bytes)

server-benchmark    2820 190  !    java.nio.charset.CharsetEncoder::encode (285 bytes)

server-benchmark    2820 191       java.nio.charset.CharsetEncoder::flush (49 bytes)

server-benchmark    2821 192       java.nio.charset.CharsetEncoder::implFlush (4 bytes)

server-benchmark    2821 193       java.lang.StringCoding::access$300 (7 bytes)

server-benchmark    2824 194       java.lang.StringCoding::safeTrim (30 bytes)

simple-routing-app [WARN] [08/04/2013 16:58:41.378] [simple-routing-app-akka.actor.default-dispatcher-3] [akka://simple-routing-app/user/IO-HTTP/listener-0] Bind to localhost/127.0.0.1:8080 failed

on-spray-can 08/04 16:58:41 WARN [on-spray-can-akka.actor.default-dispatcher-2] akka://on-spray-can/user/IO-HTTP/listener-0 - Bind to localhost/127.0.0.1:8080 failed

site 08/04 16:58:41 INFO [lt-dispatcher-2] spray.site.Main$ - Starting service actor and HTTP server...

site 08/04 16:58:42 WARN [lt-dispatcher-3] site.user.IO-HTTP.listener-0 - Bind to localhost/127.0.0.1:8080 failed

server-benchmark    5072 185  !   made not entrant  java.lang.StringCoding::encode (120 bytes)

Age Mooij

unread,
Aug 4, 2013, 6:54:00 PM8/4/13
to spray...@googlegroups.com
Hi Birju, you seem to be running with an older sbt script that doesn't support quoted arguments. 

What happens when you run the re-start command from the root sbt project is that the sbt-revolver plugin tries to start all apps in all individual sub-projects. These will severely clash with each other because they all use the same port and were never meant to all be run at the same time.

The workaround is to start the sbt shell and then type "project site" (without the quotes) so SBT moves into the site subproject. Now that the site sub-project is your active project you can run the server using either the "run" or "re-start" commands.

Hope this helps,
Age

PS
The SBT version that comes with Homebrew does have the extra fancy features, which were probably inspired by sbt-extras: https://github.com/paulp/sbt-extras


Johannes Rudolph

unread,
Aug 5, 2013, 3:21:34 AM8/5/13
to Birju Patel, spray...@googlegroups.com
Hi Birju,

I'm sorry for being too terse, I often wrongly assume everyone knows our build tools. Just keep asking. And thanks, Age, for providing the longer form explanations.

Johannes

Birju Patel

unread,
Aug 5, 2013, 7:46:29 AM8/5/13
to spray...@googlegroups.com
Hi Age,

Thank you so much for your response. It was really helpful. Now I am able to see the 'site'  from http://localhost:8080 . Hopefully this would be a last question : how to I add new documentations for directives that I would like to contribute? from http://localhost:8080 everything looks readonly? do I need yet another(html editor) setup, hope not? 

Once again thanks a lot to you guys for putting up with me in answering every little/stupid question here. Hope to get up & running in producing new docs after your response.

Thanks,

Martin Grigorov

unread,
Aug 5, 2013, 7:50:05 AM8/5/13
to spray...@googlegroups.com
Hi Birju,


On Mon, Aug 5, 2013 at 1:46 PM, Birju Patel <birj...@gmail.com> wrote:
Hi Age,

Thank you so much for your response. It was really helpful. Now I am able to see the 'site'  from http://localhost:8080 . Hopefully this would be a last question : how to I add new documentations for directives that I would like to contribute? from http://localhost:8080 everything looks readonly? do I need yet another(html editor) setup, hope not? 

Better read carefully the documentation of http://sphinx-doc.org/.
You need to edit reStructuredText files, the ones with extension .rt, then run Sphinx to re-generate the .html and preview it in your browser.

Age Mooij

unread,
Aug 5, 2013, 7:53:06 AM8/5/13
to spray...@googlegroups.com

Each directive is described in its own RST file in the "docs" project. Theare can all be found under this directory:

https://github.com/spray/spray/tree/master/docs/documentation/spray-routing

Here's the one for "extract" as an example:


When you change these files, the site project will transform and include them automatically on each build/run and AFAIK ~re-start will detect changes too but I haven't tested that yet.

Age

Johannes Rudolph

unread,
Aug 5, 2013, 8:46:39 AM8/5/13
to spray...@googlegroups.com
Thanks Birju for pointing out the missing bits and Age for explaining them.

I tried to put together a basic guide how to setup yourself for contributing documentation. Can you have a look over it and see if something is missing?


Johannes

Michael Hamrah

unread,
Sep 5, 2013, 5:52:29 PM9/5/13
to spray...@googlegroups.com, johannes...@googlemail.com
Do you have to be on a branch to view changes?  I'm noticing docs getting checked into master, but for the life of me I can't get them to show up in localhost.  For instance,  how would one view this locally:


I was going to start working on some directives.

Thanks,

Mike

Michael Hamrah

unread,
Sep 5, 2013, 5:53:39 PM9/5/13
to spray...@googlegroups.com, johannes...@googlemail.com
TO be a little more specific it appears I must have some sort of version:

http://localhost:8080/documentation/1.1-SNAPSHOT/spray-routing/encoding-directives/encodeResponse/#encoderesponse

but no version shows the master version.  I know I'm missing something simple.

Mike

Age Mooij

unread,
Sep 5, 2013, 6:11:24 PM9/5/13
to spray...@googlegroups.com, johannes...@googlemail.com
The master branch is indeed linked to the generated 1.1-SNAPSHOT docs.

What I do to write Spray docs is:

- start sbt shell
- project site
- re-start
- write some docs
- re-start

That works for me and shows me both new/updated docs and error messages if I make mistakes in the rst files.

Hope this helps
Age

PS
I recently added a bunch of new encoding directives plus documentation for those (merged to master already) but I left out the "original" encoding directives. They should be a lot easier to document now that the basics are there.


Michael Hamrah

unread,
Sep 5, 2013, 8:50:03 PM9/5/13
to spray...@googlegroups.com, johannes...@googlemail.com
Age, thanks for the info.  Everything works well; I did not associate 1.1-SNAPSHOT with the latest.  I noticed your recent changes as well and will use that as a model

I am going to start with the marshaling directives following your recent changes and Johannes' template.   I will submit a PR when ready.

Thanks again,

Mike


--
You received this message because you are subscribed to a topic in the Google Groups "spray-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spray-user/x2PJUYkn1Vs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spray-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages