Hi,
great, thank you so much for the help!
Best regards,
Matteo
On 29/03/19 17:22, Kevin Risden wrote:
Should be able to use the default http client that is included in
Knox. Should be accessible with getHttpClient() from
AbstractGatewayDispatch.
Kevin Risden
On Fri, Mar 29, 2019 at 11:22 AM Matteo Alessandroni
mailto:skylar...@apache.org>> wrote:
Hi,
Phil the "SubjectUtils.getCurrentEffectivePrincipalName()" method
did the trick, thanks!
Does anybody of you guys know how I could use a CXF REST client
from my Dispatch class (that extends "DefaultDispatch") to call an
external link?
I tried to make a ".jar" that also includes the following dependencies
org.apache.cxf
cxf-rt-frontend-jaxrs
org.apache.cxf
cxf-rt-rs-client
org.apache.cxf
cxf-rt-transports-http
org.apache.cxf
cxf-rt-transports-http-jetty
in order to execute:
MyRequest request = new MyRequest();
Client client = ClientBuilder.newBuilder().newClient();
WebTarget target = client.target(MYURL);
Invocation.Builder builder =
target.request(MediaType.APPLICATION_JSON_TYPE);
MyResponse response =
builder.post(Entity.json(request.toString()),
MyResponse.class);
from the "executeRequest()" method:
@Override
protected void *executeRequest*(
HttpUriRequest outboundRequest,
HttpServletRequest inboundRequest,
HttpServletResponse outboundResponse) throws IOException {
but it does not work and it says:
javax.ws.rs.ProcessingException: org.apache.cxf.BusException: No
conduit initiator was found for the namespace
http://cxf.apache.org/transports/http.
at
org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:638)
at
org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:614)
at
org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1115)
at
org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1052)
at
org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:897)
at
org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:866)
at
org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:431)
at
org.apache.cxf.jaxrs.client.SyncInvokerImpl.method(SyncInvokerImpl.java:150)
at
org.apache.cxf.jaxrs.client.SyncInvokerImpl.post(SyncInvokerImpl.java:90)
at
org.apache.cxf.jaxrs.client.spec.InvocationBuilderImpl.post(InvocationBuilderImpl.java:158)
is there something built-in I can use? Or maybe I'm doing
something wrong with the CXF client?
Thanks
On 18/03/19 09:03, Matteo Alessandroni wrote:
Hi Phil,
thank you for the help!
I'll check that class and will let you know.
Thanks again!
Regards,
Matteo
On 15/03/19 17:05, Phil Zampino wrote:
I was going to suggest that you might be experiencing a docker
issue because the ext folder works; You beat me to it.
I'm not sure if this is what you're after, but
org.apache.knox.gateway.security.SubjectUtils might be of use to
you for identifying the currently logged-in principal.
On Fri, Mar 15, 2019 at 11:53 AM Matteo Alessandroni
mailto:skylar...@apache.org>> wrote:
Ok I think I found the issue:
I had to restart the full Docker container to actually
restart Knox.
So I did that and it seems it's getting my class in "ext/" now.
The error I get now is:
Caused by:
org.apache.knox.gateway.config.ConfigurationException:
Failed to find configuration for provider as provider of
org.apache.knox.gateway.dispatch.MyCustomDispatch via
org.apache.knox.gateway.config.FilterConfigurationAdapter
so I guess it's a problem with my class code.
Is there a very simple code snippetI could use for my custom
dispatch in order to access the "request" object in order to
get the name of the user that is currently logged?
Regards,
Matteo
On 15/03/19 15:49, Matteo Alessandroni wrote:
Thanks!
I checked that too, my ".jar" has the same permissions of
the other files in "lib/" folder (e.g.
"gateway-shell-1.2.0.jar").
I see your point about the script [1], but I also see that
the original gateway.sh (for Knox v1.2.0) [2] is not doing
anything special for the "ext/" folder, or am I wrong?
Regards,
Matteo
[1]
https://github.com/moresandeep/knox-dev-docker/blob/master/build/gateway.sh
[2]
https://github.com/apache/knox/blob/v1.2.0/gateway-release/home/bin/gateway.sh
On 15/03/19 15:27, Sandeep Moré wrote:
Ah, i missed the