I tried very simple Route:
restConfiguration()
.component("servlet");
rest().get("/hello")
.to("direct:hello");
from("direct:hello")
.log(LoggingLevel.INFO, "Hello World")
.transform().simple("Hello World");
And indeed, when lunching my spring boot application I can see that the route listens to it:
[enter image description here][1]
2021-04-14 15:03:31.759 INFO 25248 --- [ main] o.a.c.i.e.InternalRouteStartupManager : Route: route1 started and consuming from: direct://hello
2021-04-14 15:03:31.760 INFO 25248 --- [ main] o.a.c.i.e.InternalRouteStartupManager : Route: route2 started and consuming from: servlet:/hello
2021-04-14 15:03:31.768 INFO 25248 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Total 2 routes, of which 2 are started
2021-04-14 15:03:31.768 INFO 25248 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.7.1 (camel-1) started in 220ms
However, when I tried reaching this address, I get 404 error.
{
"timestamp": "2021-04-14T12:17:11.975+00:00",
"status": 404,
"error": "Not Found",
"message": "",
"path": "/hello"
}
and also in my console:
2021-04-14 15:17:11.973 WARN 25248 --- [nio-8080-exec-4] o.s.web.servlet.PageNotFound : No mapping for GET /hello
Any idea how to solve it?
I would say here that I googled this issue and solution like using "camel.component.servlet.mapping.context-path=/*
" or using "camel" prefix didn't work for me.
Thanks!
create a bean like that any configuration class
#SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
#Bean
public ServletRegistrationBean camelServletRegistrationBean() {
ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(), "/*");
registration.setName("CamelServlet");
return registration;
}}
for example camel rest and spring boot : https://github.com/erayerdem/camelrest
Related
I'm building a web-app and have chosen Spring for my backend and React for my frontend. I'm using Spring Security to provide authentication and authorisation:
#Configuration
#EnableWebSecurity
public class SecurityConfiguration {
#Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeHttpRequests((authz) -> authz
.antMatchers("/").permitAll()
.antMatchers("/register/**").permitAll()
.antMatchers("/aUrl/**").hasRole(aRole)
.antMatchers("/anotherUrl/**").hasRole(anotherRole)
.anyRequest().authenticated()
)
.formLogin((formLogin) ->
formLogin.permitAll().defaultSuccessUrl("/login/success")
)
.logout((logout) ->
logout.deleteCookies("remove")
.invalidateHttpSession(false)
.logoutSuccessUrl("/login")
);
return http.build();
}
#Bean
public PasswordEncoder passwordEncoder() {
return PasswordEncoderFactories.createDelegatingPasswordEncoder();
}
}
and I was trying to submit the POST request through the following component:
class LoginForm extends React.Component{
constructor() {
super();
this.state = {
username: "",
password: ""
}
}
handleSubmit = (e) => {
const formData = new FormData();
formData.append("username", this.state.username);
formData.append("password", this.state.password);
fetch('/login', {
method: 'POST',
body: formData
})
e.preventDefault();
}
handleFieldChange = (event) => {
this.setState({[event.target.id]: event.target.value});
}
render(){
return (
<form onSubmit = {this.handleSubmit}>
<Input type="text" placeholder="username" id="username" label="Username:" value={this.state.username} onChange={this.handleFieldChange}/>
<Input type="text" placeholder="password" id="password" label="Password:" value={this.state.password} onChange={this.handleFieldChange}/>
<SubmitButton text="Log in"/>
</form>
);
}
}
I am basically trying to mimic the POST request sent by the browser in the following scenario:
<form method="post" action="/login">
<label htmlFor="username" >Username</label>
<input type="text" id="username" name="username" placeholder="Username" required="" autoFocus="" />
<label htmlFor="password">Password</label>
<input type="password" id="password" name="password" placeholder="Password" required="" />
<button type="submit">Log in</button>
</form>
The problem is that the latter works, the former does not. Specifically, I get a CORS policy error message that does not show up in the latter case, despite both pages being on the same port (3000), which is separate from the one that hosts the backend (8080) (N.B: I have declared a proxy as per React's indications). I am guessing that the request is somehow built differently, but I cannot imagine there wouldn't be a way to integrate a programmatic POST with Spring Security: am I simply not supposed to use form-based authentication?
Thank you in advance!
EDIT:
Here is my Spring log:
2022-10-21 10:03:57.303 INFO 15260 --- [ main] edu.devs.SomeApplication : Starting SomeApplication using Java 17.0.2 on *** with PID 15260
2022-10-21 10:03:57.306 INFO 15260 --- [ main] edu.devs.SomeApplication : No active profile set, falling back to 1 default profile: "default"
2022-10-21 10:03:58.117 INFO 15260 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Neo4j repositories in DEFAULT mode.
2022-10-21 10:03:58.218 INFO 15260 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 85 ms. Found 4 Neo4j repository interfaces.
2022-10-21 10:03:59.397 INFO 15260 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-10-21 10:03:59.409 INFO 15260 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-10-21 10:03:59.410 INFO 15260 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-10-21 10:03:59.537 INFO 15260 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-10-21 10:03:59.538 INFO 15260 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2106 ms
2022-10-21 10:04:00.106 INFO 15260 --- [ main] org.neo4j.driver.internal.DriverFactory : Routing driver instance 1107789101 created for server address ***:7687
2022-10-21 10:04:00.803 INFO 15260 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter#c9b5a99, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#70be89ec, org.springframework.security.web.context.SecurityContextPersistenceFilter#3e43f049, org.springframework.security.web.header.HeaderWriterFilter#2017f6e6, org.springframework.security.web.authentication.logout.LogoutFilter#d25e878, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#5384ce66, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#336f49a1, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter#2aee0704, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#755a7218, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#58a7dc4, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#19a5b637, org.springframework.security.web.session.SessionManagementFilter#79ca7bea, org.springframework.security.web.access.ExceptionTranslationFilter#5627cb29, org.springframework.security.web.access.intercept.AuthorizationFilter#125f16b2]
2022-10-21 10:04:01.409 INFO 15260 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-10-21 10:04:01.433 INFO 15260 --- [ main] edu.devs.SomeApplication : Started SomeApplication in 4.607 seconds (JVM running for 5.145)
2022-10-21 10:04:03.901 WARN 15260 --- [ main] o.s.d.n.c.m.DefaultNeo4jIsNewStrategy : Instances of class edu.devs.domain.Student with an assigned id will always be treated as new without version property!
2022-10-21 10:04:04.059 WARN 15260 --- [ main] o.s.d.n.c.m.DefaultNeo4jIsNewStrategy : Instances of class edu.devs.security.UserAuthority with an assigned id will always be treated as new without version property!
2022-10-21 10:04:04.441 WARN 15260 --- [ main] o.s.d.n.c.m.DefaultNeo4jIsNewStrategy : Instances of class edu.devs.domain.Admin with an assigned id will always be treated as new without version property!
2022-10-21 10:04:05.052 WARN 15260 --- [ main] o.s.d.n.c.m.DefaultNeo4jIsNewStrategy : Instances of class edu.devs.domain.School with an assigned id will always be treated as new without version property!
2022-10-21 10:04:05.264 WARN 15260 --- [ main] o.s.d.n.c.m.DefaultNeo4jIsNewStrategy : Instances of class edu.devs.domain.Classroom with an assigned id will always be treated as new without version property!
2022-10-21 10:04:29.586 INFO 15260 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-10-21 10:04:29.587 INFO 15260 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-10-21 10:04:29.588 INFO 15260 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
and here is my browser console log:
Access to fetch at 'http://localhost:8080/login/success' (redirected from 'http://localhost:3000/login') from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
LoginForm.js:26 GET http://localhost:8080/login/success net::ERR_FAILED 302
all of which does not show up if I just use a declarative POST.
For good measure, I'm also including the request headers of both.
Here are those of the programmatically-sent request:
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7
Connection: keep-alive
Content-Length: 256
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryZva4mpEReAgtMlLA
Host: localhost:3000
Origin: http://localhost:3000
Referer: http://localhost:3000/login
sec-ch-ua: "Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
and here are those of the one handled by the browser (the one that works no problem):
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: it-IT,it;q=0.9
Cache-Control: max-age=0
Connection: keep-alive
Content-Length: 43
Content-Type: application/x-www-form-urlencoded
Host: localhost:3000
Origin: http://localhost:3000
Referer: http://localhost:3000/login
sec-ch-ua: "Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Obviously I can see that the issue with the former request is that the server redirects the browser to a resource located on a different port, thus triggering a CORS policy error. What I do not get is why this does not happen with the latter request, although I'm guessing it's got something to do with the request headers(?).
I have been working on Apache camel to connect https URLS' by providing TLS certificate via proxy but getting error org.apache.http.conn.UnsupportedSchemeException: http protocol is not supported
Below is the camel route and ssl context with proxy
public class HttpProxyRouter extends RouteBuilder {
#Override
public void configure() throws Exception {
configureSslForHttp4(getContext());
from("direct:httpproxy")
.log("Invoking dhttpproxy")
.setHeader("CamelHttpMethod")
.simple("GET").setHeader("Accept")
.simple(Constants.JSON_MEDIA_TYPE_VALUE)
.setHeader(Exchange.HTTP_PATH)
.simple("{{http.proxy.path}}")
.setHeader(Exchange.REST_HTTP_QUERY)
.simple("{{http.proxy.query.param}}")
.to("{{http.proxy.url}}")
.log("The Retrival of CCO subscription API response code is: ${header.CamelHttpResponseCode}, JSON Response ${body}")
.end();
}
private void configureSslForHttp4(CamelContext camelContext) {
KeyStore truststore = KeyStore.getInstance("JKS");
truststore.load(getClass().getClassLoader().getResourceAsStream("H:\config/AL/certpath/cert/keystore.jks"), "njfeijiiii".toCharArray());
TrustManagerFactory trustFactory = TrustManagerFactory.getInstance("SunX509");
trustFactory.init(truststore);
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, trustFactory.getTrustManagers(), null);
SSLSocketFactory factory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
SchemeRegistry registry = new SchemeRegistry();
final Scheme scheme = new Scheme("https4", 443, factory);
registry.register(scheme);
HttpComponent http4 = camelContext.getComponent("https4", HttpComponent.class);
http4.setHttpClientConfigurer(new HttpClientConfigurer() {
#Override
public void configureHttpClient(HttpClientBuilder builder) {
builder.setSSLSocketFactory(factory);
HttpHost proxy = new HttpHost("MYcompany.proxy",8080);
builder.setProxy(proxy);
builder.setRoutePlanner(new DefaultProxyRoutePlanner(proxy));
Registry registry = RegistryBuilder.create().register("https", factory).build();
HttpClientConnectionManager connectionManager = new BasicHttpClientConnectionManager(registry);
builder.setConnectionManager(connectionManager);
}});
}
}
Error being encountered
org.apache.catalina.core.ApplicationContext logINFO: Initializing Spring FrameworkServlet 'dispatcherServlet'43953 [http-nio-6723-exec-2] INFO org.springframework.web.servlet.DispatcherServlet -FrameworkServlet 'dispatcherServlet': initialization started44033 [http-nio-6723-exec-2] INFO org.springframework.web.servlet.DispatcherServlet -FrameworkServlet 'dispatcherServlet': initialization completed in 80 ms44126 [http-nio-6723-exec-2] INFO com.db.gtbb.adapter.controller.HttpProxyRestController -httpProxyHandler has been started!44152 [http-nio-6723-exec-2] INFO route1 -Invoking dhttpproxy
44291 [http-nio-6723-exec-2] INFO org.apache.http.impl.execchain.RetryExec -I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request to {tls}->http://mycompany.proxy:8080->https://mycompany.target:443: http protocol is not supported44293 [http-nio-6723-exec-2] INFO org.apache.http.impl.execchain.RetryExec -Retrying request to {tls}->http://mycompany.proxy:8080->https://mycompany.target:44344296 [http-nio-6723-exec-2] INFO org.apache.http.impl.execchain.RetryExec -I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request to {tls}->http://mycompany.proxy:8080->https://mycompany.target:443: http protocol is not supported44296 [http-nio-6723-exec-2] INFO org.apache.http.impl.execchain.RetryExec -Retrying request to {tls}->http://mycompany.proxy:8080->https://mycompany.target:44344296 [http-nio-6723-exec-2] INFO org.apache.http.impl.execchain.RetryExec -I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request to {tls}->http://mycompany.proxy:8080->https://mycompany.target:443: http protocol is not supported44296 [http-nio-6723-exec-2] INFO org.apache.http.impl.execchain.RetryExec -Retrying request to {tls}->http://mycompany.proxy:8080->https://mycompany.target:44344301 [http-nio-6723-exec-2] ERROR org.apache.camel.processor.DefaultErrorHandler -Failed delivery for (MessageId: ID-SGSINSD822483-57673-1614083753968-0-1on ExchangeId: ID-SGSINSD822483-57673-1614083753968-0-2). Exhausted after delivery attempt: 1 caught: org.apache.http.conn.UnsupportedSchemeException: http protocol is not supportedMessage History---------------------------------------------------------------------------------------------------------------------------------------RouteId ProcessorId Processor Elapsed (ms)[route1 ] [route1 ] [ ] [ 155][route1 ] [log1 ] [log ] [ 6][route1 ] [setHeader1 ] [setHeader[CamelHttpMethod] ] [ 3][route1 ] [setHeader2 ] [setHeader[Accept] ] [ 2][route1 ] [setHeader3 ] [setHeader[CamelHttpPath] ] [ 2][route1 ] [setHeader4 ] [setHeader[CamelRestHttpQuery] ] [ 16][route1 ] [to1 ] [{{http.proxy.url}} ] [ 118]Stacktrace---------------------------------------------------------------------------------------------------------------------------------------
org.apache.http.conn.UnsupportedSchemeException: http protocol is not supportedat org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:108)at org.apache.http.impl.conn.BasicHttpClientConnectionManager.connect(BasicHttpClientConnectionManager.java:338)at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:388)at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)at org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:306)at org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:178)at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:529)at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:497)at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:365)at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:497)at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:209)at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:139)at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:125)at com.db.gtbb.adapter.controller.HttpProxyRestController.httpProxyHandler(HttpProxyRestController.java:27)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Thread.java:748)44318 [http-nio-6723-exec-2] INFO
you need to add http protocol to registry:
SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslctxt, hnv);
Registry<ConnectionSocketFactory> lookup = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.INSTANCE)
.register("https", sslSocketFactory).build();
I want to test one Apache Camel route in a Spring Boot integration test, but the integration test doens't finish. ProducerTemplate#sendBody doesn't return.
Spring Boot application
#SpringBootApplication
public class TestApplication {
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
#Bean
public EndpointRouteBuilder routeBuilder() {
return new EndpointRouteBuilder() {
#Override
public void configure() throws Exception {
from(direct("in")).multicast().to(direct("route"), direct("request"));
from(direct("route")).setHeader("id", constant("1")).to(direct("aggregate"));
from(direct("response")).log("Response: ${body}").to(direct("aggregate"));
from(direct("aggregate"))
.log("Aggregation-In: ${body}")
.aggregate(header("id"), AggregationStrategies.useLatest())
.completionSize(2)
.log("Aggregation-out: ${body}")
.to(direct("out"));
}
};
}
}
Spring Boot integration test
#SpringBootTest
#CamelSpringBootTest
#MockEndpointsAndSkip("(direct:request|direct:out)")
class TextRouteBuilderIT {
#EndpointInject("mock:direct:out")
private MockEndpoint outRoute;
#EndpointInject("direct:response")
private Endpoint responseRoute;
#EndpointInject("mock:direct:request")
private MockEndpoint requestRoute;
#Autowired private ProducerTemplate template;
#Test
void test() throws CamelExecutionException, InterruptedException {
requestRoute.whenAnyExchangeReceived(
new Processor() {
#Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("Response");
exchange.getIn().setHeader("id", "1");
responseRoute.createProducer().process(exchange);
}
});
template.sendBody("direct:in", "test");
throw new RuntimeException();
}
}
Logs
o.a.c.t.s.j.CamelAnnotationsHandler : Enabling auto mocking and skipping of endpoints matching pattern [(direct:request|direct:out)] on CamelContext with name [camelContext].
c.t.s.j.CamelSpringBootExecutionListener : CamelSpringBootExecutionListener before: class test.TextRouteBuilderIT.test
c.t.s.j.CamelSpringBootExecutionListener : Initialized CamelSpringBootExecutionListener now ready to start CamelContext
o.a.c.t.s.j.CamelAnnotationsHandler : Starting CamelContext with name [camelContext].
.i.e.InterceptSendToMockEndpointStrategy : Adviced endpoint [direct://request] with mock endpoint [mock:direct:request]
.i.e.InterceptSendToMockEndpointStrategy : Adviced endpoint [direct://out] with mock endpoint [mock:direct:out]
o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.5.0 (camel-1) is starting
o.a.c.impl.engine.AbstractCamelContext : StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
o.a.c.impl.engine.AbstractCamelContext : Using HealthCheck: camel-spring-boot
o.a.c.p.aggregate.AggregateProcessor : Defaulting to MemoryAggregationRepository
o.a.c.i.e.InternalRouteStartupManager : Route: route1 started and consuming from: direct://in
o.a.c.i.e.InternalRouteStartupManager : Route: route2 started and consuming from: direct://route
o.a.c.i.e.InternalRouteStartupManager : Route: route3 started and consuming from: direct://response
o.a.c.i.e.InternalRouteStartupManager : Route: route4 started and consuming from: direct://aggregate
o.a.c.impl.engine.AbstractCamelContext : Total 4 routes, of which 4 are started
o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.5.0 (camel-1) started in 0.015 seconds
route4 : Aggregation-In: test
route3 : Response: Response
route4 : Aggregation-In: Response
route4 : Aggregation-out: Response
It looks like the last route is finished, but the Spring Boot integration test is still running. The RuntimeException is not thrown.
Research
I followed
Testing the JUnit 5 way
Annotation Type MockEndpointsAndSkip
What did I do wrong?
intercept the route that already has the response grouped, capture the exchange and return. I managed to make this return with the completeblefuture method complete
I have implemented Spring security using- The API Gateway Pattern: Angular JSand Spring Security (referred Angular JS and Spring Security successfully for my application).
In my application (divided into- Gateway + UI + Resource), I have created a .pdf file upload module in 'UI' application which is failing at Gateway application while it tries to redirect request to Resource application (even this file upload functionality was working fine before implementing this API Gateways pattern and Security).
The file upload javascript code from 'UI' application as below:
if(idProofFile.files.length == 0)
{
$scope.alerts = [
{ type: 'danger', msg: 'No File(s) selected, please Browse and Select ID Proof File(s) first.' },
];
return;
}
else{
// Upload user's files::
//create form data to send via POST
var formData = new FormData();
for(var i=0; i< idProofFile.files.length; i++){
if(idProofFile.files[i].size > 31457280) // check for each file size should not be more than 30 MB = 30*1024*1024 bytes
{
$scope.alerts = [
{ type: 'danger', msg: 'The size of file: '+ idProofFile.files[i].name +' is more than 30 MB. Max limit of a file size is 30 MB.'}
];
return;
}
else{
var extension = idProofFile.files[i].name.substr(idProofFile.files[i].name.lastIndexOf('.') + 1).toLowerCase();
//alert(extension);
if (idProofFile.files[i].name.length > 0)
{
if (allowedExtensions.indexOf(extension) === -1)
{
$scope.alerts = [
{ type: 'danger', msg: 'Only PDF files are allowed. Selected file:- '+ idProofFile.files[i].name +' is a .'+extension+' file.'}
];
return;
}
}
}
formData.append("idProof",idProofFile.files[i]);
}
var request = new XMLHttpRequest();
request.open('POST', 'resource/upload_id_proof/' +$rootScope.loggedInUserPrimaryKeyId+'/'+$rootScope.loggedInUserId, false);
request.send(formData);
The Spring security code fromm 'Gateway' application is as below:
#Override
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers("/update_new_user/**");
}
#Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic().and().authorizeRequests()
//.antMatchers("/index.html", "/", "/login", "/message", "/home")
//.antMatchers("/index.html", "/", "/login", "/message", "/home", "/css", "/font-awesome/**", "/fonts", "/img/**", "/js/**", "/less", "/mail").permitAll()
.antMatchers("/index.html", "/", "/css/**", "/font-awesome/**", "/fonts", "/img/**", "/js/**", "/less", "/mail").permitAll()
//.antMatchers("/ui/", "/ui/public/js/**", "/ui/js/**").permitAll()
.antMatchers("/ui/public/**").hasAnyAuthority("Admin", "SuperAdmin", "Owner", "Tenant")
.antMatchers("/ui/private/projectadmin/**").hasAuthority("Admin")
.antMatchers("/ui/private/superadmin/**").hasAuthority("SuperAdmin")
.antMatchers("/ui/private/owner/**").hasAuthority("Owner")
.antMatchers("/ui/private/tenant/**").hasAuthority("Tenant")
.anyRequest().authenticated()
.and()
.csrf()
.csrfTokenRepository(csrfTokenRepository()).and()
.addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
}
private Filter csrfHeaderFilter() {
return new OncePerRequestFilter() {
#Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
CsrfToken csrf = (CsrfToken) request.getAttribute(CsrfToken.class
.getName());
if (csrf != null) {
Cookie cookie = WebUtils.getCookie(request, "XSRF-TOKEN");
String token = csrf.getToken();
if (cookie == null || token != null
&& !token.equals(cookie.getValue())) {
cookie = new Cookie("XSRF-TOKEN", token);
cookie.setPath("/");
response.addCookie(cookie);
}
}
filterChain.doFilter(request, response);
}
};
}
private CsrfTokenRepository csrfTokenRepository() {
HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
repository.setHeaderName("X-XSRF-TOKEN");
return repository;
}
}
The controller code from 'Resource' application:
#RequestMapping(value="/upload_id_proof/{userPrimaryKeyId}/{userId}", method = RequestMethod.POST)
public #ResponseBody String uploadIdProof(
//#RequestParam(value = "infoClient") String infoClientString,
#RequestParam(value = "idProof") MultipartFile[] idProofFiles,
#PathVariable Long userPrimaryKeyId,
#PathVariable String userId) {
The request is failing at 'Gateway' application and not forwarded to 'Resource' application. The exception at 'Gateway' is as below:
**Invalid CSRF token found for localhost:8080/resource/upload_id_proof/40/11**
Detailed logs:
2016-04-29 10:00:05.797 DEBUG 6020 --- [nio-8080-exec-1] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/configprops.*']
2016-04-29 10:00:05.797 DEBUG 6020 --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/configprops.*'
2016-04-29 10:00:05.797 DEBUG 6020 --- [nio-8080-exec-1] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/configprops/']
2016-04-29 10:00:05.797 DEBUG 6020 --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/configprops/'
2016-04-29 10:00:05.797 DEBUG 6020 --- [nio-8080-exec-1] o.s.s.web.util.matcher.OrRequestMatcher : No matches found
2016-04-29 10:00:05.797 DEBUG 6020 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 1 of 13 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
2016-04-29 10:00:05.797 DEBUG 6020 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 2 of 13 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2016-04-29 10:00:05.800 DEBUG 6020 --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : Obtained a valid SecurityContext from SPRING_SECURITY_CONTEXT: 'org.springframework.security.core.context.SecurityContextImpl#493c907: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken#493c907: Principal: org.springframework.security.core.userdetails.User#620: Username: 11; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: Owner; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails#fffd3270: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: b6cd10df-a20e-49ae-9212-d32e7520db8f; Granted Authorities: Owner'
2016-04-29 10:00:05.800 DEBUG 6020 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 3 of 13 in additional filter chain; firing Filter: 'HeaderWriterFilter'
2016-04-29 10:00:05.800 DEBUG 6020 --- [nio-8080-exec-1] o.s.s.w.header.writers.HstsHeaderWriter : Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher#3439c41
2016-04-29 10:00:05.800 DEBUG 6020 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 4 of 13 in additional filter chain; firing Filter: 'CsrfFilter'
2016-04-29 10:00:05.800 DEBUG 6020 --- [nio-8080-exec-1] o.s.security.web.csrf.CsrfFilter : Invalid CSRF token found for http://localhost:8080/resource/upload_id_proof/40/11
2016-04-29 10:00:05.802 DEBUG 6020 --- [nio-8080-exec-1] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed
I have tried ignoring csrf by below code in Gateway app:
http.httpBasic().and()
.csrf().ignoringAntMatchers("/resource/upload_id_proof/**");
There is not any issue log this time but the request is not forwarded to controller in 'Resource' app and now the logs are something as below:
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/resource/upload_id_proof/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.web.util.matcher.OrRequestMatcher : matched
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.NegatedRequestMatcher : matches = false
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.util.matcher.AndRequestMatcher : Did not match
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 5 of 13 in additional filter chain; firing Filter: ''
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 6 of 13 in additional filter chain; firing Filter: 'LogoutFilter'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/logout'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 7 of 13 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 8 of 13 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 9 of 13 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 10 of 13 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.a.AnonymousAuthenticationFilter : SecurityContextHolder not populated with anonymous token, as it already contained: 'org.springframework.security.authentication.UsernamePasswordAuthenticationToken#fb6efb77: Principal: org.springframework.security.core.userdetails.User#620: Username: 11; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: Owner; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails#0: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 8902a97c-cd54-4c78-92e4-383270fd97c7; Granted Authorities: Owner'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 11 of 13 in additional filter chain; firing Filter: 'SessionManagementFilter'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 12 of 13 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 at position 13 of 13 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/index.html'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/css/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/font-awesome/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/fonts'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/img/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/js/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/less'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/mail'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/ui/public/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/ui/private/projectadmin/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/ui/private/superadmin/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/ui/private/owner/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/resource/upload_id_proof/40/11'; against '/ui/private/tenant/**'
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.a.i.FilterSecurityInterceptor : Secure object: FilterInvocation: URL: /resource/upload_id_proof/40/11; Attributes: [authenticated]
2016-04-29 10:56:32.165 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.a.i.FilterSecurityInterceptor : Previously Authenticated: org.springframework.security.authentication.UsernamePasswordAuthenticationToken#fb6efb77: Principal: org.springframework.security.core.userdetails.User#620: Username: 11; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: Owner; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails#0: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 8902a97c-cd54-4c78-92e4-383270fd97c7; Granted Authorities: Owner
2016-04-29 10:56:32.166 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.access.vote.AffirmativeBased : Voter: org.springframework.security.web.access.expression.WebExpressionVoter#442f6da3, returned: 1
2016-04-29 10:56:32.166 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.a.i.FilterSecurityInterceptor : Authorization successful
2016-04-29 10:56:32.166 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.a.i.FilterSecurityInterceptor : RunAsManager did not change Authentication object
2016-04-29 10:56:32.166 DEBUG 5912 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : /resource/upload_id_proof/40/11 reached end of additional filter chain; proceeding with original chain
2016-04-29 10:56:32.283 DEBUG 5912 --- [nio-8080-exec-4] tRepository$SaveToSessionResponseWrapper : Skip invoking on
2016-04-29 10:56:32.283 DEBUG 5912 --- [nio-8080-exec-4] tRepository$SaveToSessionResponseWrapper : Skip invoking on
2016-04-29 10:56:32.285 DEBUG 5912 --- [nio-8080-exec-4] o.s.s.w.a.ExceptionTranslationFilter : Chain processed normally
2016-04-29 10:56:32.285 DEBUG 5912 --- [nio-8080-exec-4] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed
Except this file upload functionality, all other modules are working fine in API Gateway pattern and I did not find much help on internet for this issue, please help me to proceed the request to the 'Resource' application.
I am trying to use the qooxdoo simulation-run job for this simple test (with changed class namespace of course):
qx.Class.define("twitter.simulation.Settings", {
extend : simulator.unit.TestCase,
members :
{
testChangeLanguage : function()
{
this.fail("Test not implemented!");
}
}
});
However, every time I try to run it, I get this very misterious error:
js: uncaught JavaScript runtime exception: TypeError: org.mozilla.javascript.Undefined#275b35 is not a function, it is org.mozilla.javascript.Undefined.
I am using Rhino 1.7R4 for the Javascript engine. The Selenium version is 2.25 and qooxdoo is at 2.0.2. Here is the simulation-run job config:
"simulation-run" :
{
"let" :
{
"SIMULATOR_CLASSPATH" :
[
"../selenium/selenium-java-2.25.0.jar",
"../selenium/libs/*",
"../rhino/js.jar"
]
},
"environment" :
{
"simulator.selServer" : "localhost",
"simulator.selPort" : 4444,
"simulator.testBrowser" : "*firefox",
"simulator.autHost" : "http://localhost:8080",
"simulator.autPath" : "/application/index.html"
}
}
You need to use the 1.x Selenium client drivers.