Class ListCertificatesController
- java.lang.Object
-
- org.springframework.context.support.ApplicationObjectSupport
-
- org.springframework.web.context.support.WebApplicationObjectSupport
-
- org.springframework.web.servlet.support.WebContentGenerator
-
- org.springframework.web.servlet.mvc.AbstractController
-
- psiprobe.controllers.AbstractTomcatContainerController
-
- psiprobe.controllers.certificates.ListCertificatesController
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
,org.springframework.web.context.ServletContextAware
,org.springframework.web.servlet.mvc.Controller
@Controller public class ListCertificatesController extends AbstractTomcatContainerController
The Class ListCertificatesController.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
logger
The Constant logger.
-
Constructor Summary
Constructors Constructor Description ListCertificatesController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addToStore(List<Cert> certs, String alias, X509Certificate x509Cert)
Adds the to store.List<Cert>
getCertificates(String storeType, String storeFile, String storePassword)
Gets the certificates.private List<ConnectorInfo>
getConnectorInfos(List<org.apache.catalina.connector.Connector> connectors)
Gets the connector infos.private InputStream
getStoreInputStream(String path)
Tries to open a InputStream the same way as Tomcat ConfigFileLoadergetInputStream
.org.springframework.web.servlet.ModelAndView
handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected org.springframework.web.servlet.ModelAndView
handleRequestInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
void
setViewName(String viewName)
Sets the view name.private ConnectorInfo
toConnectorInfo(org.apache.coyote.http11.AbstractHttp11JsseProtocol<?> protocol)
To connector info.-
Methods inherited from class psiprobe.controllers.AbstractTomcatContainerController
getContainerWrapper, getViewName, setContainerWrapper
-
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController
isSynchronizeOnSession, setSynchronizeOnSession
-
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator
applyCacheControl, applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, prepareResponse, preventCaching, setAlwaysMustRevalidate, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader, setVaryByRequestHeaders
-
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
-
-
-
-
Method Detail
-
handleRequest
@RequestMapping(path="/certificates.htm") public org.springframework.web.servlet.ModelAndView handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
- Specified by:
handleRequest
in interfaceorg.springframework.web.servlet.mvc.Controller
- Overrides:
handleRequest
in classorg.springframework.web.servlet.mvc.AbstractController
- Throws:
Exception
-
handleRequestInternal
protected org.springframework.web.servlet.ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
- Specified by:
handleRequestInternal
in classorg.springframework.web.servlet.mvc.AbstractController
- Throws:
Exception
-
getCertificates
public List<Cert> getCertificates(String storeType, String storeFile, String storePassword) throws Exception
Gets the certificates.- Parameters:
storeType
- the store typestoreFile
- the store filestorePassword
- the store password- Returns:
- the certificates
- Throws:
Exception
- the exception
-
getConnectorInfos
private List<ConnectorInfo> getConnectorInfos(List<org.apache.catalina.connector.Connector> connectors) throws IllegalAccessException, InvocationTargetException
Gets the connector infos.- Parameters:
connectors
- the connectors- Returns:
- the connector infos
- Throws:
IllegalAccessException
- the illegal access exceptionInvocationTargetException
- the invocation target exception
-
getStoreInputStream
private InputStream getStoreInputStream(String path) throws IOException
Tries to open a InputStream the same way as Tomcat ConfigFileLoadergetInputStream
.- Parameters:
path
- the path of a store file (absolute or relative to CATALINA.BASE), or URI to store file (absolute or relative to CATALINA.BASE).- Returns:
- the input stream of the path file
- Throws:
IOException
- if path can not be resolved
-
toConnectorInfo
private ConnectorInfo toConnectorInfo(org.apache.coyote.http11.AbstractHttp11JsseProtocol<?> protocol) throws IllegalAccessException, InvocationTargetException
To connector info.- Parameters:
protocol
- the protocol- Returns:
- the connector info
- Throws:
IllegalAccessException
- the illegal access exceptionInvocationTargetException
- the invocation target exception
-
addToStore
private void addToStore(List<Cert> certs, String alias, X509Certificate x509Cert)
Adds the to store.- Parameters:
certs
- the certsalias
- the aliasx509Cert
- the x509 cert
-
setViewName
@Value("certificates") public void setViewName(String viewName)
Description copied from class:AbstractTomcatContainerController
Sets the view name.- Overrides:
setViewName
in classAbstractTomcatContainerController
- Parameters:
viewName
- the new view name
-
-