Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into keystore-perf
- Loading branch information
Showing
96 changed files
with
2,246 additions
and
1,040 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...min-gui/src/main/java/com/evolveum/midpoint/web/boot/EmbeddedTomcatAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Copyright (c) 2018 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.evolveum.midpoint.web.boot; | ||
|
||
import javax.servlet.Servlet; | ||
|
||
import org.apache.catalina.startup.Tomcat; | ||
import org.springframework.boot.autoconfigure.AutoConfigureOrder; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; | ||
import org.springframework.boot.autoconfigure.condition.SearchStrategy; | ||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration.BeanPostProcessorsRegistrar; | ||
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; | ||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.core.Ordered; | ||
|
||
import com.evolveum.midpoint.util.logging.Trace; | ||
import com.evolveum.midpoint.util.logging.TraceManager; | ||
|
||
/** | ||
* Custom configuration (factory) for embedded tomcat factory. | ||
* This is necessary, as the tomcat factory is hacking tomcat setup. | ||
* @see MidPointTomcatEmbeddedServletContainerFactory | ||
* | ||
* @author semancik | ||
*/ | ||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE) | ||
@Configuration | ||
@ConditionalOnWebApplication | ||
@Import(BeanPostProcessorsRegistrar.class) | ||
public class EmbeddedTomcatAutoConfiguration { | ||
|
||
private static final Trace LOGGER = TraceManager.getTrace(EmbeddedTomcatAutoConfiguration.class); | ||
|
||
@Configuration | ||
@ConditionalOnClass({ Servlet.class, Tomcat.class }) | ||
@ConditionalOnMissingBean(value = EmbeddedServletContainerFactory.class, search = SearchStrategy.CURRENT) | ||
public static class EmbeddedTomcat { | ||
|
||
@Bean | ||
public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() { | ||
return new MidPointTomcatEmbeddedServletContainerFactory(); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...in/java/com/evolveum/midpoint/web/boot/MidPointTomcatEmbeddedServletContainerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
11 * Copyright (c) 2018 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.evolveum.midpoint.web.boot; | ||
|
||
import org.apache.catalina.startup.Tomcat; | ||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer; | ||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; | ||
|
||
import com.evolveum.midpoint.util.logging.Trace; | ||
import com.evolveum.midpoint.util.logging.TraceManager; | ||
|
||
/** | ||
* Custom tomcat factory that used to hack embedded Tomcat setup. | ||
* There seem to be no cleaner way to get to actual configured Tomcat instance. | ||
* | ||
* @author semancik | ||
*/ | ||
public class MidPointTomcatEmbeddedServletContainerFactory extends TomcatEmbeddedServletContainerFactory { | ||
|
||
private static final Trace LOGGER = TraceManager.getTrace(MidPointTomcatEmbeddedServletContainerFactory.class); | ||
|
||
@Override | ||
protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(Tomcat tomcat) { | ||
|
||
// We are setting up fake context here. This context does not really do anything. | ||
// But it is "mapped" to the root URL (/ ... or rather "" in Tomcat parlance). | ||
// This fake context is necessary. If there is no context at all then | ||
// CoyoteAdapter will not execute any Valves and returns 404 immediately. | ||
// So without this the TomcatRootValve will not work. | ||
|
||
RootRootContext rootRootContext = new RootRootContext(); | ||
tomcat.getHost().addChild(rootRootContext); | ||
|
||
return super.getTomcatEmbeddedServletContainer(tomcat); | ||
} | ||
|
||
|
||
|
||
} |
45 changes: 45 additions & 0 deletions
45
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/boot/RootRootContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Copyright (c) 2018 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.evolveum.midpoint.web.boot; | ||
|
||
import org.apache.catalina.LifecycleException; | ||
import org.apache.catalina.core.StandardContext; | ||
|
||
/** | ||
* Fake root context. This context does not really do anything. | ||
* But it is "mapped" to the root URL (/ ... or rather "" in Tomcat parlance). | ||
* This fake context is necessary. If there is no context at all then | ||
* CoyoteAdapter will not execute any Valves and returns 404 immediately. | ||
* So without this the TomcatRootValve will not work. | ||
* | ||
* @author semancik | ||
*/ | ||
public class RootRootContext extends StandardContext { | ||
|
||
public RootRootContext() { | ||
super(); | ||
setPath(""); // this means "/" | ||
setDisplayName("RootRoot"); | ||
} | ||
|
||
// HAck | ||
@Override | ||
public void resourcesStart() throws LifecycleException { | ||
super.resourcesStart(); | ||
setConfigured(true); | ||
} | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/boot/TomcatRootValve.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) 2018 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.evolveum.midpoint.web.boot; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.servlet.ServletException; | ||
|
||
import org.apache.catalina.Context; | ||
import org.apache.catalina.connector.Request; | ||
import org.apache.catalina.connector.Response; | ||
import org.apache.catalina.valves.ValveBase; | ||
|
||
import com.evolveum.midpoint.util.logging.Trace; | ||
import com.evolveum.midpoint.util.logging.TraceManager; | ||
|
||
/** | ||
* Tomcat valve used to redirect root (/) URL to real application (/midpoint/). | ||
* This is needed in Spring boot deployment. Entire midPoint app is deployed | ||
* under http://.../midpoint/ URL root. But we want users to use http://.../ | ||
* as well to access the application. | ||
* | ||
* This could not be done with midPoint servlets or servlet filters. The entire | ||
* midPoint application is under /midpoint/, so the application won't even receive | ||
* requests to root URL. We need to use dirty Tomcat-specific tricks for this. | ||
* | ||
* @author semancik | ||
* | ||
*/ | ||
public class TomcatRootValve extends ValveBase { | ||
|
||
private static final Trace LOGGER = TraceManager.getTrace(TomcatRootValve.class); | ||
|
||
@Override | ||
public void invoke(Request request, Response response) throws IOException, ServletException { | ||
|
||
Context context = request.getContext(); | ||
if (context instanceof RootRootContext) { | ||
String uri = request.getDecodedRequestURI(); | ||
if (uri.endsWith("favicon.ico")) { | ||
LOGGER.trace("Redirecting favicon request to real application (URI={})", request.getDecodedRequestURI()); | ||
response.sendRedirect("/midpoint/favicon.ico"); | ||
return; | ||
} else { | ||
LOGGER.trace("Redirecting request to real application root (URI={})", request.getDecodedRequestURI()); | ||
response.sendRedirect("/midpoint/"); | ||
return; | ||
} | ||
} | ||
|
||
getNext().invoke(request, response); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/column/IconColumn.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.