Thomas Sundberg

November 1, 2012

A RESTFul Web Service

This post is available at http://www.thinkcode.se/blog/2012/11/01/a-restful-web-service

Advertisements

5 Comments »

  1. Hi Thomas,
    Have you published source code of your Cucumber posts anywhere ? If so, please pass on that Location.

    Comment by Ram — June 28, 2013 @ 15:19

    • Hi

      I haven’t published the source code anywhere. I think that you will learn more by typing the code yourself or by copying the code from the blog compared with getting the source from a zip or github. That is the reason why this code isn’t available anywhere.

      /Thomas

      Comment by Thomas Sundberg — July 1, 2013 @ 22:14

      • Great idea about the “typing the code yourself” strategy. It’s true.

        On another note, I just started reading your blog for the first time. Excellent content, keep it up.

        – Paul

        Comment by Paul — January 3, 2014 @ 18:14

  2. Hi,

    I’ve been working my way thru your Cucumber tutorial series, they have been a great help!
    I asked a question on the “a jsf web application” regarding tomcat zip.
    I found a way to download the binary from maven repo (see bottom for details):

    I still have a couple of questions/issues with my setup:

    1) What maven command should I be running to start tomcat and run the integration tests

    ../rest-ws>mvn integration-test (tomcat is not starting for me, the same thing happened for the zip install)

    ——————————————————-
    T E S T S
    ——————————————————-
    Running se.waymark.rentit.RunCukesIT
    HTTP/1.1 404 Not Found

    If I start tomcat
    ../rest-ws>mvn tomcat:run (see output below)

    then run the Rent.feature via a cucumber-plugin inside eclipse, it works fine

    do you have any suggestions on what I am doing wrong and how I can correct it?

    2) Do you have any ideas on how to get jersey to log requests/responses?

    I did update my com.jayway.restassured dependency to 2.3.2
    and changed the RentACarSupport to use the new API.

    post(path).then().log().all().assertThat().statusCode(201);

    this gives me logging at the client, but I am still wondering if there is some logging
    i can do in Jersey.

    Thanks,
    Tim

    <<mvn tomcat:run >>>
    [INFO] Nothing to compile – all classes are up to date
    [INFO]
    [INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) < compile @ rest-main <<<
    [INFO]
    [INFO] — tomcat-maven-plugin:1.1:run (default-cli) @ rest-main —
    [INFO] Running war on http://localhost:8080/rest-main
    [INFO] Using existing Tomcat server configuration at C:\Users\timr\.gitlablocal\workspaces\rest-ws\rest-main\target\tomcat
    Jul 11, 2014 2:33:56 PM org.apache.catalina.startup.Embedded start
    INFO: Starting tomcat server
    Jul 11, 2014 2:33:56 PM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
    Jul 11, 2014 2:33:57 PM com.sun.jersey.api.core.PackagesResourceConfig init
    INFO: Scanning for root resource and provider classes in the packages:
    se.waymark.rentit.rest
    Jul 11, 2014 2:33:57 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
    INFO: Root resource classes found:
    class se.waymark.rentit.rest.RentCar
    Jul 11, 2014 2:33:57 PM com.sun.jersey.api.core.ScanningResourceConfig init
    INFO: No provider classes found.
    Jul 11, 2014 2:33:57 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
    INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
    Jul 11, 2014 2:33:58 PM org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    Jul 11, 2014 2:33:58 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080

    Tomcat binary from Maven Repo:

    tomcat7x

    org.apache.tomcat
    tomcat
    7.0.53

    <!–

    http://www.apache.org/dist/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.zip

    –>
    ${project.build.directory}/tomcat-logs/container.log
    false
    ${project.build.directory}/tomcat-logs/cargo.log

    Comment by Tim — July 12, 2014 @ 02:34

    • Hi!

      To start Tomcat and run the integrations tests, do
      mvn integration-test

      I can’t really say that I know how you should enable logging request/response in Jersey. I would probably add log statements in my own methods and be happy to see them being called.

      HTH
      Thomas

      Comment by Thomas Sundberg — July 12, 2014 @ 23:46


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: