Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xta-test-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
lib
xta-test-server
Commits
a0610580
Commit
a0610580
authored
7 months ago
by
Lukas Malte Monnerjahn
Browse files
Options
Downloads
Patches
Plain Diff
remove obsolete webservice config
parent
c5c3f8ce
Branches
OZG-7303
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/ozgcloud/xta/test/app/config/WebServiceConfig.java
+0
-93
0 additions, 93 deletions
...ava/de/ozgcloud/xta/test/app/config/WebServiceConfig.java
with
0 additions
and
93 deletions
src/main/java/de/ozgcloud/xta/test/app/config/WebServiceConfig.java
deleted
100644 → 0
+
0
−
93
View file @
c5c3f8ce
/*
* @formatter:off
*
* Copyright 2021-2022 Koordinierungsstelle für IT-Standards (KoSIT)
*
* Licensed under the European Public License, Version 1.2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/EUPL-1.2
*
* 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.
* @formatter:on
*/
package
de.ozgcloud.xta.test.app.config
;
import
org.apache.catalina.Context
;
import
org.apache.catalina.connector.Connector
;
import
org.apache.tomcat.util.descriptor.web.SecurityCollection
;
import
org.apache.tomcat.util.descriptor.web.SecurityConstraint
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
lombok.Getter
;
@Configuration
public
class
WebServiceConfig
{
@Value
(
"${server.port}"
)
@Getter
private
int
serverPort
;
@Value
(
"${app.server.http-port}"
)
@Getter
private
int
serverHttpPort
;
@Value
(
"${app.server.redirect-to-https:false}"
)
private
boolean
redirectToHttps
;
@Bean
public
ServletWebServerFactory
servletContainer
()
{
if
(
redirectToHttps
)
{
return
servletContainerRedirectToHttps
();
}
return
servletContainerStandardHttp
();
}
public
ServletWebServerFactory
servletContainerStandardHttp
()
{
TomcatServletWebServerFactory
tomcat
=
new
TomcatServletWebServerFactory
();
tomcat
.
addAdditionalTomcatConnectors
(
createStandardConnector
());
return
tomcat
;
}
private
Connector
createStandardConnector
()
{
Connector
connector
=
new
Connector
(
"org.apache.coyote.http11.Http11NioProtocol"
);
connector
.
setPort
(
serverHttpPort
);
return
connector
;
}
private
ServletWebServerFactory
servletContainerRedirectToHttps
()
{
// redirect Http to Https
TomcatServletWebServerFactory
tomcat
=
new
TomcatServletWebServerFactory
()
{
@Override
protected
void
postProcessContext
(
final
Context
context
)
{
var
securityConstraint
=
new
SecurityConstraint
();
securityConstraint
.
setUserConstraint
(
"CONFIDENTIAL"
);
var
collection
=
new
SecurityCollection
();
collection
.
addPattern
(
"/*"
);
securityConstraint
.
addCollection
(
collection
);
context
.
addConstraint
(
securityConstraint
);
}
};
tomcat
.
addAdditionalTomcatConnectors
(
getHttpConnector
());
return
tomcat
;
}
private
Connector
getHttpConnector
()
{
var
connector
=
new
Connector
(
TomcatServletWebServerFactory
.
DEFAULT_PROTOCOL
);
connector
.
setScheme
(
"http"
);
connector
.
setPort
(
serverHttpPort
);
connector
.
setSecure
(
false
);
connector
.
setRedirectPort
(
serverPort
);
return
connector
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment