Hi,

Currently I am learning how to use Apache Camel Rest and I would like to ask
some questions about it. I would greatly appreciate any answer.
 
I have a rest camel route which is packed in a jar. This jar locates in an
ear file and deployed on GlassFish app. server.
*Q1:* I am not able to figure out how I can start/bootstrap this route.

I want to use localhost:port/api/user/generate url for my route. It
generates a simple json answer based on my java pojo with getters/setters.
*Q2:* How to configure the base url of my route OR figure out the correct
path of my deployed route?
*Q3:* How I can send back a json response based on a java object (object is
automatically convert to json by camel on the fly)? Is my code correct (i am
not able to test my code till it is not bootstrapped)?

My ear is deployed on server, stateless ejb service and web application are
working but my camel rest api is not available.

*Structure of my ear:*
*.EAR
 |-lib/
 |  |- dependencies, ex.: camel jars
 |  |- my-common.jar
 |  |- my-camel-restapi.jar <- it contains my camel rest route
 |
 |- my-web-ui.war
 |- my-stateless-ejb.jar


*Camel route java:*
public class UserServiceRouteBuilder extends RouteBuilder {
    private static final String APPLICATION_JSON_UTF_8 =
"application/json;charset=UTF-8";

    @Override
    public void configure() throws Exception {
        restConfiguration().component("jetty")
                .bindingMode(RestBindingMode.json)
                .dataFormatProperty("prettyPrint", "true");

        User user = new User();
        user.setEmail("a...@gmail.com");
        user.setFirstName("John");
        user.setLastName("Connor");

        rest("/user")
                .description("user rest service")
                .produces(APPLICATION_JSON_UTF_8)
               
.get("/generate").route().routeId("GET@/generate").transform().constant(user).endRest();
    }
}





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-rest-route-tp5777992.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to