Accessing Tomcat context parameter in Camel REST dsl - spring

I am currently working on a set of REST resources that are deployed in a Tomcat servlet container. I have been using the Camel REST dsl (kickstarted by Spring) and it works very well. Now, I would like to get access to some parameters specified in the container's context.xml but havn't been able to figure out how to do that as I do not have access to the Servlet context in my route builder. Any suggestions?

Even though you are hosting your Spring-app on Tomcat, Camel is using a separate, internally loaded web server implementation for it's REST endpoints, e.g. Restlet or Spark-rest (for more infos check here). For that reason your Camel route is ignorant and entirely disconnected to your Tomcat let alone its Servlets contexts.

Related

spring boot with rest endpoints but also JSF

I am having trouble as I have a sample app working with spring-boot and primefaces but can't manage to build a rest endpoint. I know there must be a configuration thing to be done between DispatcherServlet and FacesServlet but I still can't discover it. Can someone provide an example ?. I understand I could set each servlet to start working on a different path but its like being a turkish in the fog...

tomcat webserver/servlet container/dispatcher servlet interaction in springboot

what is the flow diagram of interactions between tomcat web server/servlet container and dispatcher servlet . tomcat servlet container is separate from spring IOC container or applicationcontext ?
Tomcat is a web server. It "knows" how to deal with web applications according to the web applications specification.
This specification defines means of servlets declaration, their order, etc. It also defines additional notions like filters, listeners, etc. This specification has nothing to do with spring. Basically, you can use tomcat to host the application with servlets, filters, listeners without spring dependencies, so you won't even have an application context.
With this in mind, Spring MVC (to which the Dispatcher Servlet actually belongs) is just a third-party among many others from the Tomcat standpoint.
DispatcherServlet is an ordinary servlet that the spring team has developed. It is an entry point to all spring infrastructure in web applications managed by a web server, it's a "glue" that acts as a "driver" - it loads the application context (all the beans), handles all the requests coming to the controllers, etc.

Listing all deployed rest endpoints (spring-boot, tomcat)

I know there is a similar kind of question exist but if works only for glassfish server.
Listing all deployed rest endpoints (spring-boot, jersey)
Is it possible to list all my configured rest-endpoints with spring boot? The actuator lists all existing paths on startup, I want something similar for my custom services, so I can check on startup if all paths are configured correctly and use this info for client calls.
How do I do this? I use #Path/#GET annotations on my service beans and register them via ResourceConfig#registerClasses.
Is there a way to query the Config for all Paths?
Update2: I want to have something like
GET /rest/mycontroller/info
POST /res/mycontroller/update
...
In my opinion, you are already using the right tool (actuator) to answer to your request.
Actuator gives you all the rest method running and you can configure it on your own, by disabling/enabling specific endpoints
If you have a look on the documentationprobably it can help you.
In any case, the default configuration of actuator display the endpoints (built-in in Intellij for your development).

Spring Remote, configure httpinvoker and JAX on the same server

I have a server running on tomcat exposing Spring services using HttpInvoker.
I have exposed the methods of 5 services using HTTPInvoker.
This works very well.
The spring configuration is described in a file named remoting-servlet.xml; and the remoting servlet (DispatcherServlet) is described in the web.xml.
I now have an additional need to expose one additional service using JAX-WS this time (I will have C# clients).
I will use Spring support to JAX-WS.
I have the option to use the default deployment, or to use JAX-WS RI's to deploy this additional service to the same server as the remoting servlet.
I would prefer this last solution, because I would have only one server providing the remote services (whether they are web services or httpinvokers).
My question is: is this possible?
I think that I can I put the 2 servlets on the same port. But my issue is that it seems to me that I will have to provide 2 different application contexts. One for the DispatcherServlet, and one for the WSSpringServlet.
Is that correct?
Is it possible to put the WSSpringServlet context definition to the same file as the one for the httpinvokers (remoting-servlet.xml)?
Many thanks
Gilles

How can I register a servlet filter to catch all HTTP requests in an OSGi container?

I've got an OSGi container that hosts several CXF web services at /services/service_a; /services/service_b etc along with a couple of web apps deployed as bundles. I'm trying to SSO enable all the endpoints but am having trouble registering a servlet filter with the Jetty server so I can have Spring Security take over.
Using Pax-web whiteboard I was able to register a filter tied to a simple servlet. However, when I attempted to filter requests at /*, the filter no longer catches the requests. Is it possible to register a filter that will catch all requests either using pax-web or some Jetty-osgi magic?
Not sure it's possible with the http whiteboard.
However you should be able to achieve the same end result using pax-web with Jetty's standard SSO management, by creating a fragment bundle.
Some links:
http://docs.codehaus.org/display/JETTY/Single+Sign+On+-+Jetty+HashSSORealm
http://docs.codehaus.org/display/JETTY/SessionIds
http://team.ops4j.org/wiki/display/paxweb/Advanced+Jetty+Configuration

Resources