Can I use intermediate dynamic path segments? - spring-mvc

With spring web(flux), how can I make an endpoint for intermediate dynamic path segments?
#RequestMapping(path = "/some/prefixed/{variable}/.../{path}/.../{segments}/some/postfixed")
How can I do that? Can I do that?
I mean the /{variable}/.../{path}/.../{segments} is whatever the client requests.

Related

What is the difference between a HTTP Request and a HTTP GET/POST request?

For start - I understand the difference between GET and POST.
What I don't understand is how does a request that doesn't mention either of them work, when and why would I want to use it?
Here's an example from ASP.NET Docs:
Map method
MapGet method
MapPost method
HTTP requests always have an HTTP method associated with them. GET and POST are two such methods, but there are others (see here).
When you call the MapGet, MapPost, or Map methods, you are creating "rules" that ASP.NET will use to route incoming requests to different parts of your application code, depending on which rules are matched.
Part of each rule is the route pattern itself, but you can also require a specific HTTP method in order for a rule to be matched. That's what MapGet and MapPost are doing - when you use them, they will only match requests that also have the appropriate HTTP method (GET and POST, respectively). In contrast, Map will match any incoming request (that also matches the route pattern), regardless of the HTTP method of the request.
This can be an easy way to get your application to behave differently depending on the HTTP method that is used. For example, you could use MapGet to route GET requests to a method that will return something, while using MapPost to route POST requests to a method that will create a new record. If you want your application to behave the same way for all requests (or you want to programmatically check the request method), you could just use Map.

How to get Http header values in Apache Camel- Jersey Rest API

I have an application which uses Apache Camel to build an API. It basically uses blueprint.xml to define routes and processing is done by a bean(please note its not any processor bean. Just a plain Java bean). It uses Jersey client to invoke the backend system Rest API.
My requirement is to get the http headers in the code to be able to send them to our custom logging system.
a) I tried #httpHeaders annotation but this does not inject the headers on my code.
b) Since its not using any BeanProcessor i dont have an Exchange object from where i can get the header values.
Please help with a way to get header values on the code.
Add the request context to your class
#Context
private HttpServletRequest request;
and get the headers in your endpoint using request.getHeader
Returns the value of the specified request header as a String.

Interrogate the URL hash fragment on inbound Mule HTTP endpoint

I've setup a Mule ESB flow, with an inbound HTTP endpoint; to which I'm posting:
GET http://myserver/myurl#blah=xxx
However, i can't find the blah=xxx referenced in any inbound properties. Does Mule support this notation? And how do i get reference to this fragment?
All Inbound properties i've seen don't have the hash fragment.
What I know, using hash is to identify a portion in a document, however what you're trying to do is more similar to using query parameters
GET http://myserver/myurl?blah=xxx
Then reference it in mule using MEL expression:
#[message.inboundProperties.'http.query.params'.blah]
Cheers

Symfony2 Routes only for sub-requests

I am creating an advanced app that uses websocket instead of ajax for dynamic interaction. My WebSocket messages are handled like HTTP Requests, they contain a json-encoded array of path and parameters, which will be converted to a Request. Now the HttpKernel handles this request like every other HTTP request (as sub-request). The only problem is, that the routes for websocket messages are public avaible.
Has anyone an idea how to allow only internal access for a route in this situation?
This answer explains why the firewall configuration can't be used to block routes by name as it uses the RequestMatcher which allows only path regexes and not route names.

API Endpoint Semantics

Is an API endpoint the 'method', like https://api.foursquare.com/v2/venues/ or the full URL including non-query-string parameters like https://api.foursquare.com/v2/venues/5104
In other words, are these two separate endpoints or considered the same endpoint?
http://myapi.com/somemodel/1
http://myapi.com/somemodel/2
According to this Wikipedia article, the endpoint is a web service, defined by a WSDL file, and
does nothing more than define the
address or connection point to a web
service. It is typically represented
by a simple HTTP URL string.
Microsoft uses the term endpoint in various contexts, but they all amount to the same thing: the endpoint is the entire interface, not one particular method.
In the context of a REST endpoint, the endpoint would contain the requisite GET, PUT, POST and DELETE methods (as applicable).

Resources