[direct-certificate-discovery-tool] 6 new revisions pushed by michal.kotelba@esacinc.com on 2014-05-03 03:41 GMT

1 view
Skip to first unread message

direct-certifica...@googlecode.com

unread,
May 2, 2014, 11:41:33 PM5/2/14
to dcdt...@googlegroups.com
6 new revisions:

Revision: baff731eb3be
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 03:12:01 2014 UTC
Log: - Fixes DCDT-218....
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=baff731eb3be

Revision: 2c698eae3c3f
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 03:14:10 2014 UTC
Log: - Further supports DCDT-218....
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=2c698eae3c3f

Revision: 6acff096ebe7
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 05:07:20 2014 UTC
Log: - Supports DCDT-210....
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=6acff096ebe7

Revision: ccfec54b04f7
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 09:19:08 2014 UTC
Log: - Supports DCDT-210....
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=ccfec54b04f7

Revision: 70aeeba5fcde
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 09:55:20 2014 UTC
Log: - Fixes DCDT-219....
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=70aeeba5fcde

Revision: e794909a8663
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 21:53:01 2014 UTC
Log: - Further supports DCDT-210....
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=e794909a8663

==============================================================================
Revision: baff731eb3be
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 03:12:01 2014 UTC
Log: - Fixes DCDT-218.
- Fixed property overriding by using a custom composite PropertySource.
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=baff731eb3be

Added:

/dcdt-core/src/test/java/gov/hhs/onc/dcdt/context/ToolPropertySourcesPlaceholderConfigurerUnitTests.java
Modified:

/dcdt-core/src/main/java/gov/hhs/onc/dcdt/context/impl/ToolPropertySourcesPlaceholderConfigurer.java
/dcdt-core/src/main/resources/META-INF/core/core.properties
/dcdt-core/src/test/resources/META-INF/core/core-test.properties

=======================================
--- /dev/null
+++
/dcdt-core/src/test/java/gov/hhs/onc/dcdt/context/ToolPropertySourcesPlaceholderConfigurerUnitTests.java
Fri May 2 03:12:01 2014 UTC
@@ -0,0 +1,28 @@
+package gov.hhs.onc.dcdt.context;
+
+import gov.hhs.onc.dcdt.test.impl.AbstractToolUnitTests;
+import org.springframework.beans.factory.annotation.Value;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+@Test(groups =
{ "dcdt.test.unit.context.all", "dcdt.test.unit.context.props" })
+public class ToolPropertySourcesPlaceholderConfigurerUnitTests extends
AbstractToolUnitTests {
+ @Value("${dcdt.test.prop.1}")
+ private String testProp1Value;
+
+ @Value("${dcdt.test.prop.1.override}")
+ private String testProp1ValueOverride;
+
+ @Value("${dcdt.test.prop.2}")
+ private String testProp2Value;
+
+ static {
+
System.setProperty("dcdt.test.prop.2", "${dcdt.test.prop.1}${dcdt.test.prop.1.override}");
+ }
+
+ @Test
+ public void testProcessProperties() {
+ Assert
+ .assertEquals(this.testProp2Value, (this.testProp1Value +
this.testProp1ValueOverride), "Property value not overridden by system
property value.");
+ }
+}
=======================================
---
/dcdt-core/src/main/java/gov/hhs/onc/dcdt/context/impl/ToolPropertySourcesPlaceholderConfigurer.java
Thu Jan 23 15:39:04 2014 UTC
+++
/dcdt-core/src/main/java/gov/hhs/onc/dcdt/context/impl/ToolPropertySourcesPlaceholderConfigurer.java
Fri May 2 03:12:01 2014 UTC
@@ -1,25 +1,76 @@
package gov.hhs.onc.dcdt.context.impl;

+import gov.hhs.onc.dcdt.utils.ToolCollectionUtils;
import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
+import javax.annotation.Nullable;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanInitializationException;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import
org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MutablePropertySources;
-import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
+import org.springframework.core.env.PropertySources;
+import org.springframework.core.env.PropertySourcesPropertyResolver;
+import org.springframework.util.Assert;

public class ToolPropertySourcesPlaceholderConfigurer extends
PropertySourcesPlaceholderConfigurer {
- private Environment env;
+ private class CompositePropertySource extends
EnumerablePropertySource<Map<String, Object>> {
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public CompositePropertySource(String name, Properties source) {
+ super(name, ((Map) source));
+ }
+
+ @Nullable
+ @Override
+ public Object getProperty(String propName) {
+ return this.getSource().get(propName);
+ }
+
+ @Override
+ public String[] getPropertyNames() {
+ return ToolCollectionUtils.toArray(this.getSource().keySet(),
String.class);
+ }
+
+ @Override
+ public Map<String, Object> getSource() {
+ Map<String, Object> source;
+
+ if (ToolPropertySourcesPlaceholderConfigurer.this.env != null)
{
+ source = new LinkedHashMap<>();
+
+ if
(!ToolPropertySourcesPlaceholderConfigurer.this.envOverride) {
+
source.putAll(ToolPropertySourcesPlaceholderConfigurer.this.env.getSystemProperties());
+ }
+
+ source.putAll(super.getSource());
+
+ if
(ToolPropertySourcesPlaceholderConfigurer.this.envOverride) {
+
source.putAll(ToolPropertySourcesPlaceholderConfigurer.this.env.getSystemProperties());
+ }
+ } else {
+ source = super.getSource();
+ }
+
+ return source;
+ }
+ }
+
+ private ConfigurableEnvironment env;
private boolean envOverride;
+ private PropertySources appliedPropSources;

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory
beanFactory) throws BeansException {
MutablePropertySources propSources = new MutablePropertySources();

try {
- PropertySource<?> localPropSource = new
PropertiesPropertySource(LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME,
this.mergeProperties());
+ PropertySource<?> localPropSource = new
CompositePropertySource(LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME,
this.mergeProperties());

if (this.localOverride) {
propSources.addFirst(localPropSource);
@@ -30,29 +81,23 @@
throw new BeanInitializationException("Unable to load
properties.", e);
}

- if (this.env != null) {
- PropertySource<Environment> envPropSource = new
PropertySource<Environment>(ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME,
this.env) {
- @Override
- public Object getProperty(String propName) {
- return this.source.getProperty(propName);
- }
- };
+ this.setPropertySources(propSources);
+
+ this.processProperties(beanFactory, new
PropertySourcesPropertyResolver(propSources));

- if (this.envOverride) {
- propSources.addFirst(envPropSource);
- } else {
- propSources.addLast(envPropSource);
- }
- }
+ this.appliedPropSources = propSources;
+ }

- this.setPropertySources(propSources);
+ @Override
+ public PropertySources getAppliedPropertySources() throws
IllegalStateException {
+ Assert.state((this.appliedPropSources != null), "Property sources
have not been applied yet.");

- super.postProcessBeanFactory(beanFactory);
+ return this.appliedPropSources;
}

@Override
public void setEnvironment(Environment env) {
- this.env = env;
+ this.env = ((ConfigurableEnvironment) env);

super.setEnvironment(env);
}
=======================================
--- /dcdt-core/src/main/resources/META-INF/core/core.properties Wed Apr 16
19:04:56 2014 UTC
+++ /dcdt-core/src/main/resources/META-INF/core/core.properties Fri May 2
03:12:01 2014 UTC
@@ -7,6 +7,7 @@
# INSTANCE

#====================================================================================================
dcdt.instance.dir=${dcdt.data.dir}/instance
+#dcdt.instance.dir=${dcdt.data.dir:${user.dir}/data}/instance


#====================================================================================================
# INSTANCE DATABASE
=======================================
--- /dcdt-core/src/test/resources/META-INF/core/core-test.properties Tue
Apr 29 05:33:14 2014 UTC
+++ /dcdt-core/src/test/resources/META-INF/core/core-test.properties Fri
May 2 03:12:01 2014 UTC
@@ -1,3 +1,10 @@
+#====================================================================================================
+# PROPERTIES
+#====================================================================================================
+dcdt.test.prop.1=prop1value1
+dcdt.test.prop.1.override=override
+dcdt.test.prop.2=${dcdt.test.prop.1}
+

#====================================================================================================
# INSTANCE

#====================================================================================================

==============================================================================
Revision: 2c698eae3c3f
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 03:14:10 2014 UTC
Log: - Further supports DCDT-218.
- Removed obsolete + commented out data directory property definition.
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=2c698eae3c3f

Modified:
/dcdt-core/src/main/resources/META-INF/core/core.properties

=======================================
--- /dcdt-core/src/main/resources/META-INF/core/core.properties Fri May 2
03:12:01 2014 UTC
+++ /dcdt-core/src/main/resources/META-INF/core/core.properties Fri May 2
03:14:10 2014 UTC
@@ -7,7 +7,6 @@
# INSTANCE

#====================================================================================================
dcdt.instance.dir=${dcdt.data.dir}/instance
-#dcdt.instance.dir=${dcdt.data.dir:${user.dir}/data}/instance


#====================================================================================================
# INSTANCE DATABASE

==============================================================================
Revision: 6acff096ebe7
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 05:07:20 2014 UTC
Log: - Supports DCDT-210.
- Implemented content processing filter wrappers.
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=6acff096ebe7

Added:
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/ContentFilter.java

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/AbstractContentFilter.java
Deleted:
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/WebContentFilter.java
Modified:

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolCharacterEncodingFilter.java

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolJTidyFilter.java

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/media/utils/ToolMediaTypeUtils.java
/dcdt-web/src/main/resources/META-INF/spring/spring-web-filter.xml
/dcdt-web/src/main/webapp/WEB-INF/web.xml

=======================================
--- /dev/null
+++ /dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/ContentFilter.java
Fri May 2 05:07:20 2014 UTC
@@ -0,0 +1,11 @@
+package gov.hhs.onc.dcdt.web.filter;
+
+import java.util.Set;
+import javax.servlet.Filter;
+import org.springframework.http.MediaType;
+
+public interface ContentFilter<T extends Filter> extends Filter {
+ public Set<MediaType> getContentTypes();
+
+ public void setContentTypes(Set<MediaType> contentTypes);
+}
=======================================
--- /dev/null
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/AbstractContentFilter.java
Fri May 2 05:07:20 2014 UTC
@@ -0,0 +1,108 @@
+package gov.hhs.onc.dcdt.web.filter.impl;
+
+import gov.hhs.onc.dcdt.utils.ToolClassUtils;
+import gov.hhs.onc.dcdt.utils.ToolStringUtils;
+import gov.hhs.onc.dcdt.web.filter.ContentFilter;
+import gov.hhs.onc.dcdt.web.media.utils.ToolMediaTypeUtils;
+import java.io.IOException;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.MediaType;
+
+public abstract class AbstractContentFilter<T extends Filter> implements
ContentFilter<T> {
+ protected T filter;
+ protected Set<MediaType> contentTypes = new
TreeSet<>(MediaType.SPECIFICITY_COMPARATOR);
+ protected MutableFilterConfig filterConfig;
+
+ private final static Logger LOGGER =
LoggerFactory.getLogger(AbstractContentFilter.class);
+
+ protected AbstractContentFilter(T filter) {
+ this.filter = filter;
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletReq, ServletResponse
servletResp, FilterChain filterChain) throws IOException, ServletException {
+ this.doFilterInternal(((HttpServletRequest) servletReq),
((HttpServletResponse) servletResp), filterChain);
+ }
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ this.filter.init(this.initInternal((this.filterConfig = new
MutableFilterConfig(filterConfig))));
+
+ LOGGER.debug(String.format("Initialized filter (name=%s): {%s}",
this.filterConfig.getFilterName(),
+
ToolStringUtils.joinDelimit(this.filterConfig.getInitParameters().entrySet(), "; ")));
+ }
+
+ @Override
+ public void destroy() {
+ this.filter.destroy();
+
+ LOGGER.debug(String.format("Destroyed filter (name=%s).",
this.filterConfig.getFilterName()));
+ }
+
+ protected void doFilterInternal(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException,
+ ServletException {
+ if (this.canPreFilter(servletReq, servletResp, filterChain)) {
+ this.doPreFilter(servletReq, servletResp, filterChain);
+
+ LOGGER.trace(String.format("Pre-filtered (name=%s, class=%s)
servlet request (uri=%s) and response (contentType={%s}).",
+ this.filterConfig.getFilterName(),
ToolClassUtils.getName(this), servletReq.getRequestURI(),
servletResp.getContentType()));
+ }
+
+ filterChain.doFilter(servletReq, servletResp);
+
+ if (this.canPostFilter(servletReq, servletResp, filterChain)) {
+ this.doPostFilter(servletReq, servletResp, filterChain);
+
+ LOGGER.trace(String.format("Post-filtered (name=%s, class=%s)
servlet request (uri=%s) and response (contentType={%s}).",
+ this.filterConfig.getFilterName(),
ToolClassUtils.getName(this), servletReq.getRequestURI(),
servletResp.getContentType()));
+ }
+ }
+
+ protected void doPostFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException, ServletException {
+ this.filter.doFilter(servletReq, servletResp, filterChain);
+ }
+
+ protected void doPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException, ServletException {
+ this.filter.doFilter(servletReq, servletResp, filterChain);
+ }
+
+ protected boolean canPostFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
+ return this.isContentTypeIncluded(servletReq, servletResp);
+ }
+
+ protected boolean canPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
+ return false;
+ }
+
+ protected boolean isContentTypeIncluded(HttpServletRequest servletReq,
HttpServletResponse servletResp) {
+ String contentTypeStr = servletResp.getContentType();
+
+ return ((contentTypeStr != null) &&
ToolMediaTypeUtils.isIncluded(this.contentTypes, new
MediaType(MediaType.parseMediaType(contentTypeStr), null)));
+ }
+
+ protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
+ return filterConfig;
+ }
+
+ @Override
+ public Set<MediaType> getContentTypes() {
+ return this.contentTypes;
+ }
+
+ @Override
+ public void setContentTypes(Set<MediaType> contentTypes) {
+ this.contentTypes.clear();
+ this.contentTypes.addAll(contentTypes);
+ }
+}
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/WebContentFilter.java
Wed Apr 23 18:24:11 2014 UTC
+++ /dev/null
@@ -1,11 +0,0 @@
-package gov.hhs.onc.dcdt.web.filter;
-
-import java.util.Set;
-import javax.servlet.Filter;
-import org.springframework.http.MediaType;
-
-public interface WebContentFilter extends Filter {
- public Set<MediaType> getContentTypes();
-
- public void setContentTypes(Set<MediaType> contentTypes);
-}
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolCharacterEncodingFilter.java
Wed Apr 23 18:24:11 2014 UTC
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolCharacterEncodingFilter.java
Fri May 2 05:07:20 2014 UTC
@@ -1,75 +1,26 @@
package gov.hhs.onc.dcdt.web.filter.impl;

-
-import gov.hhs.onc.dcdt.web.filter.WebContentFilter;
-import java.io.IOException;
import java.nio.charset.Charset;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.servlet.FilterChain;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.web.accept.ContentNegotiationManager;
-import org.springframework.web.filter.OncePerRequestFilter;
+import org.springframework.web.filter.CharacterEncodingFilter;

-public class ToolCharacterEncodingFilter extends OncePerRequestFilter
implements WebContentFilter {
- private final static Logger LOGGER =
LoggerFactory.getLogger(ToolCharacterEncodingFilter.class);
-
- @Autowired
- @SuppressWarnings({ "SpringJavaAutowiringInspection" })
- private ContentNegotiationManager contentNegotiationManager;
-
+public class ToolCharacterEncodingFilter extends
AbstractContentFilter<CharacterEncodingFilter> {
private Charset enc;
- private Set<MediaType> contentTypes = new
TreeSet<>(MediaType.SPECIFICITY_COMPARATOR);

- @Override
- protected void doFilterInternal(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
ServletException,
- IOException {
+ public ToolCharacterEncodingFilter(Charset enc) {
+ super(new CharacterEncodingFilter());

- // @formatter:off
- /*
- String servletRespContentTypeStr = servletResp.getContentType();
- MediaType servletRespContentType;
-
- if (((servletRespContentType =
- ToolMediaTypeUtils.findIncluded(
- this.contentTypes,
- ((servletRespContentTypeStr != null)
- ?
ToolArrayUtils.asSet(MediaType.parseMediaType(servletRespContentTypeStr)) :
this.contentNegotiationManager
- .resolveMediaTypes(new
ServletWebRequest(servletReq))))) != null)
- && servletRespContentType.isConcrete()) {
- super.doFilter(servletReq, servletResp, filterChain);
-
- LOGGER.trace(String.format("Servlet request (uri=%s) content
(contentType={%s}) filtered using character encoding (enc=%s).",
- servletReq.getRequestURI(), servletRespContentType,
this.enc.name()));
- } else {
- filterChain.doFilter(servletReq, servletResp);
- }
- */
- // @formatter:on
+ this.enc = enc;
}

@Override
- public Set<MediaType> getContentTypes() {
- return this.contentTypes;
- }
+ protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
+ this.filter.setEncoding(this.enc.name());

- @Override
- public void setContentTypes(Set<MediaType> contentTypes) {
- this.contentTypes.clear();
- this.contentTypes.addAll(contentTypes);
+ return super.initInternal(filterConfig);
}

public Charset getEncoding() {
return enc;
}
-
- public void setEncoding(Charset enc) {
- this.enc = enc;
- }
}
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolJTidyFilter.java
Wed Apr 23 18:24:11 2014 UTC
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolJTidyFilter.java
Fri May 2 05:07:20 2014 UTC
@@ -1,47 +1,25 @@
package gov.hhs.onc.dcdt.web.filter.impl;

-import gov.hhs.onc.dcdt.utils.ToolArrayUtils;
-import gov.hhs.onc.dcdt.utils.ToolStringUtils;
import gov.hhs.onc.dcdt.utils.ToolStringUtils.ToolStrBuilder;
-import gov.hhs.onc.dcdt.web.filter.WebContentFilter;
-import gov.hhs.onc.dcdt.web.media.utils.ToolMediaTypeUtils;
-import java.io.IOException;
-import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
-import java.util.Set;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.web.accept.ContentNegotiationManager;
-import org.springframework.web.context.request.ServletWebRequest;
import org.w3c.tidy.servlet.filter.JTidyFilter;

-public class ToolJTidyFilter extends JTidyFilter implements
WebContentFilter {
+public class ToolJTidyFilter extends AbstractContentFilter<JTidyFilter> {
private final static String DELIM_CONFIG_ENTRY = "; ";
private final static String DELIM_CONFIG_ENTRY_PAIR = ": ";

- private final static Logger LOGGER =
LoggerFactory.getLogger(ToolJTidyFilter.class);
-
- @Autowired
- @SuppressWarnings({ "SpringJavaAutowiringInspection" })
- private ContentNegotiationManager contentNegotiationManager;
-
private Map<String, Object> config = new LinkedHashMap<>();
- private Set<MediaType> contentTypes = new HashSet<>();
+
+ public ToolJTidyFilter() {
+ super(new JTidyFilter());
+ }

@Override
- public void init(FilterConfig filterConfig) {
- MutableFilterConfig mutableFilterConfig = new
MutableFilterConfig(filterConfig);
+ protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
ToolStrBuilder configStrBuilder = new ToolStrBuilder();

for (String configPropName : this.config.keySet()) {
@@ -51,41 +29,9 @@

configStrBuilder.append(Objects.toString(this.config.get(configPropName),
StringUtils.EMPTY));
}

- mutableFilterConfig.getInitParameters().put(CONFIG_CONFIG,
configStrBuilder.build());
+ filterConfig.getInitParameters().put(JTidyFilter.CONFIG_CONFIG,
configStrBuilder.build());

- super.init(mutableFilterConfig);
-
- LOGGER.debug(String.format("Initialized Spring JTidy servlet
filter (name=%s): {%s}", mutableFilterConfig.getFilterName(),
-
ToolStringUtils.joinDelimit(mutableFilterConfig.getInitParameters().entrySet(), ", ")));
- }
-
- @Override
- public void destroy() {
- super.destroy();
-
- LOGGER.debug("Destroyed Spring JTidy servlet filter.");
- }
-
- @Override
- public void doFilter(ServletRequest servletReq, ServletResponse
servletResp, FilterChain filterChain) throws IOException, ServletException {
- HttpServletRequest httpServletReq = ((HttpServletRequest)
servletReq);
- String servletRespContentTypeStr = servletResp.getContentType();
- MediaType servletRespContentType;
-
- if (((servletRespContentType =
- ToolMediaTypeUtils.findIncluded(
- this.contentTypes,
- ((servletRespContentTypeStr != null)
- ?
ToolArrayUtils.asSet(MediaType.parseMediaType(servletRespContentTypeStr)) :
this.contentNegotiationManager
- .resolveMediaTypes(new
ServletWebRequest(httpServletReq))))) != null)
- && servletRespContentType.isConcrete()) {
- super.doFilter(servletReq, servletResp, filterChain);
-
- LOGGER.trace(String.format("Servlet request (uri=%s) content
(contentType={%s}) filtered using Spring JTidy formatting.",
- httpServletReq.getRequestURI(), servletRespContentType));
- } else {
- filterChain.doFilter(servletReq, servletResp);
- }
+ return super.initInternal(filterConfig);
}

public Map<String, Object> getConfig() {
@@ -96,15 +42,4 @@
this.config.clear();
this.config.putAll(config);
}
-
- @Override
- public Set<MediaType> getContentTypes() {
- return this.contentTypes;
- }
-
- @Override
- public void setContentTypes(Set<MediaType> contentTypes) {
- this.contentTypes.clear();
- this.contentTypes.addAll(contentTypes);
- }
}
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/media/utils/ToolMediaTypeUtils.java
Wed Apr 23 18:24:11 2014 UTC
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/media/utils/ToolMediaTypeUtils.java
Fri May 2 05:07:20 2014 UTC
@@ -28,6 +28,14 @@
return false;
}
}
+
+ public static boolean isIncluded(Iterable<MediaType> mediaTypes,
MediaType ... mediaTypesEval) {
+ return isIncluded(mediaTypes,
ToolArrayUtils.asList(mediaTypesEval));
+ }
+
+ public static boolean isIncluded(Iterable<MediaType> mediaTypes,
Iterable<MediaType> mediaTypesEval) {
+ return CollectionUtils.exists(mediaTypesEval, new
IncludesMediaTypePredicate(mediaTypes));
+ }

@Nullable
public static MediaType findIncluded(Iterable<MediaType> mediaTypes,
MediaType ... mediaTypesEval) {
=======================================
--- /dcdt-web/src/main/resources/META-INF/spring/spring-web-filter.xml Wed
Apr 23 18:24:11 2014 UTC
+++ /dcdt-web/src/main/resources/META-INF/spring/spring-web-filter.xml Fri
May 2 05:07:20 2014 UTC
@@ -15,13 +15,23 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">

- <beans:bean id="urlRewriteFilter"
class="gov.hhs.onc.dcdt.web.filter.impl.ToolUrlRewriteFilter"
+
<!--====================================================================================================
+ = FILTERS
+
=====================================================================================================-->
+ <beans:bean id="filter" class="javax.servlet.Filter" abstract="true"/>
+
+ <beans:bean id="filterUrlRewrite"
class="gov.hhs.onc.dcdt.web.filter.impl.ToolUrlRewriteFilter"
p:confPath="/WEB-INF/urlrewrite/urlrewrite-web.xml"
p:confReloadCheckInterval="30"
p:statusPath="/urlrewrite/status"/>

- <beans:bean id="charEncFilter"
class="gov.hhs.onc.dcdt.web.filter.impl.ToolCharacterEncodingFilter"
- p:encoding-ref="charsetUtf8">
+
<!--====================================================================================================
+ = CONTENT FILTERS
+
=====================================================================================================-->
+ <beans:bean id="filterContent"
class="gov.hhs.onc.dcdt.web.filter.ContentFilter" parent="filter"
abstract="true"/>
+
+ <beans:bean id="filterContentCharEnc"
class="gov.hhs.onc.dcdt.web.filter.impl.ToolCharacterEncodingFilter"
parent="filterContent"
+ c:enc-ref="charsetUtf8">
<beans:property name="contentTypes">
<util:set>
<beans:value>#{
T(gov.hhs.onc.dcdt.web.media.WebContentTypes).APP_JAVASCRIPT }</beans:value>
@@ -37,7 +47,7 @@
</beans:property>
</beans:bean>

- <beans:bean id="jTidyFilter"
class="gov.hhs.onc.dcdt.web.filter.impl.ToolJTidyFilter">
+ <beans:bean id="filterContentJTidy"
class="gov.hhs.onc.dcdt.web.filter.impl.ToolJTidyFilter"
parent="filterContent">
<beans:property name="config">
<util:map>
<beans:entry key="char-encoding" value="#{
charsetUtf8.name() }"/>
=======================================
--- /dcdt-web/src/main/webapp/WEB-INF/web.xml Wed Apr 23 18:24:11 2014 UTC
+++ /dcdt-web/src/main/webapp/WEB-INF/web.xml Fri May 2 05:07:20 2014 UTC
@@ -99,7 +99,7 @@
= FILTERS

=====================================================================================================-->
<filter>
- <filter-name>urlRewriteFilter</filter-name>
+ <filter-name>filterUrlRewrite</filter-name>

<filter-class>gov.hhs.onc.dcdt.web.filter.impl.DispatcherServletFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
@@ -107,35 +107,36 @@
</init-param>
</filter>
<filter-mapping>
- <filter-name>urlRewriteFilter</filter-name>
+ <filter-name>filterUrlRewrite</filter-name>
<servlet-name>dispatcherServlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>

- <!--
<filter>
- <filter-name>charEncFilter</filter-name>
+ <filter-name>springSecurityFilterChain</filter-name>

<filter-class>gov.hhs.onc.dcdt.web.filter.impl.DispatcherServletFilterProxy</filter-class>
</filter>
<filter-mapping>
- <filter-name>charEncFilter</filter-name>
+ <filter-name>springSecurityFilterChain</filter-name>
<servlet-name>dispatcherServlet</servlet-name>
</filter-mapping>
- -->

<filter>
- <filter-name>springSecurityFilterChain</filter-name>
+ <filter-name>filterContentCharEnc</filter-name>

<filter-class>gov.hhs.onc.dcdt.web.filter.impl.DispatcherServletFilterProxy</filter-class>
+ <init-param>
+ <param-name>targetFilterLifecycle</param-name>
+ <param-value>true</param-value>
+ </init-param>
</filter>
<filter-mapping>
- <filter-name>springSecurityFilterChain</filter-name>
+ <filter-name>filterContentCharEnc</filter-name>
<servlet-name>dispatcherServlet</servlet-name>
</filter-mapping>

- <!--
<filter>
- <filter-name>jTidyFilter</filter-name>
+ <filter-name>filterContentJTidy</filter-name>

<filter-class>gov.hhs.onc.dcdt.web.filter.impl.DispatcherServletFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
@@ -143,8 +144,7 @@
</init-param>
</filter>
<filter-mapping>
- <filter-name>jTidyFilter</filter-name>
+ <filter-name>filterContentJTidy</filter-name>
<servlet-name>dispatcherServlet</servlet-name>
</filter-mapping>
- -->
</web-app>

==============================================================================
Revision: ccfec54b04f7
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 09:19:08 2014 UTC
Log: - Supports DCDT-210.
- Fixed web content filter logging and activation.
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=ccfec54b04f7

Modified:
/dcdt-service-core/src/main/resources/META-INF/logback/logback-service.xml

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/AbstractContentFilter.java

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolCharacterEncodingFilter.java

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolJTidyFilter.java
/dcdt-web/src/main/resources/META-INF/logback/logback-web-include.xml
/dcdt-web/src/main/resources/META-INF/logback/logback-web.xml

=======================================
---
/dcdt-service-core/src/main/resources/META-INF/logback/logback-service.xml
Thu Nov 7 01:42:51 2013 UTC
+++
/dcdt-service-core/src/main/resources/META-INF/logback/logback-service.xml
Fri May 2 09:19:08 2014 UTC
@@ -9,9 +9,6 @@


<contextName>${dcdt.log.context.name:-%{project.artifactId}}</contextName>

- <include resource="logback/logback-service-include-test.xml"
optional="true"/>
- <include resource="logback/logback-service-include.xml"
optional="true"/>
-
<if condition='!isDefined("dcdt.log.console.term") &amp;&amp;

org.tanukisoftware.wrapper.WrapperManager.isControlledByNativeWrapper()
&amp;&amp;
!org.tanukisoftware.wrapper.WrapperManager.isLaunchedAsService()'>
@@ -22,4 +19,7 @@

<include resource="logback/logback-core-include-test.xml"
optional="true"/>
<include resource="logback/logback-core-include.xml" optional="true"/>
+
+ <include resource="logback/logback-service-include-test.xml"
optional="true"/>
+ <include resource="logback/logback-service-include.xml"
optional="true"/>
</configuration>
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/AbstractContentFilter.java
Fri May 2 05:07:20 2014 UTC
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/AbstractContentFilter.java
Fri May 2 09:19:08 2014 UTC
@@ -3,10 +3,10 @@
import gov.hhs.onc.dcdt.utils.ToolClassUtils;
import gov.hhs.onc.dcdt.utils.ToolStringUtils;
import gov.hhs.onc.dcdt.web.filter.ContentFilter;
-import gov.hhs.onc.dcdt.web.media.utils.ToolMediaTypeUtils;
import java.io.IOException;
+import java.util.LinkedHashSet;
import java.util.Set;
-import java.util.TreeSet;
+import javax.annotation.Nullable;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -21,7 +21,7 @@

public abstract class AbstractContentFilter<T extends Filter> implements
ContentFilter<T> {
protected T filter;
- protected Set<MediaType> contentTypes = new
TreeSet<>(MediaType.SPECIFICITY_COMPARATOR);
+ protected Set<MediaType> contentTypes = new LinkedHashSet<>();
protected MutableFilterConfig filterConfig;

private final static Logger LOGGER =
LoggerFactory.getLogger(AbstractContentFilter.class);
@@ -32,14 +32,14 @@

@Override
public void doFilter(ServletRequest servletReq, ServletResponse
servletResp, FilterChain filterChain) throws IOException, ServletException {
- this.doFilterInternal(((HttpServletRequest) servletReq),
((HttpServletResponse) servletResp), filterChain);
+ this.doFilterInternal(((HttpServletRequest)servletReq),
((HttpServletResponse)servletResp), filterChain);
}

@Override
public void init(FilterConfig filterConfig) throws ServletException {
this.filter.init(this.initInternal((this.filterConfig = new
MutableFilterConfig(filterConfig))));

- LOGGER.debug(String.format("Initialized filter (name=%s): {%s}",
this.filterConfig.getFilterName(),
+ LOGGER.debug(String.format("Initialized filter (name=%s,
class=%s): {%s}", this.filterConfig.getFilterName(),
ToolClassUtils.getName(this),

ToolStringUtils.joinDelimit(this.filterConfig.getInitParameters().entrySet(), "; ")));
}

@@ -47,7 +47,7 @@
public void destroy() {
this.filter.destroy();

- LOGGER.debug(String.format("Destroyed filter (name=%s).",
this.filterConfig.getFilterName()));
+ LOGGER.debug(String.format("Destroyed filter (name=%s,
class=%s).", this.filterConfig.getFilterName(),
ToolClassUtils.getName(this)));
}

protected void doFilterInternal(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException,
@@ -78,17 +78,15 @@
}

protected boolean canPostFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
- return this.isContentTypeIncluded(servletReq, servletResp);
+ return false;
}

protected boolean canPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
return false;
}
-
- protected boolean isContentTypeIncluded(HttpServletRequest servletReq,
HttpServletResponse servletResp) {
- String contentTypeStr = servletResp.getContentType();
-
- return ((contentTypeStr != null) &&
ToolMediaTypeUtils.isIncluded(this.contentTypes, new
MediaType(MediaType.parseMediaType(contentTypeStr), null)));
+
+ protected boolean isContentTypeIncluded(@Nullable String
contentTypeStr) {
+ return ((contentTypeStr != null) && this.contentTypes.contains(new
MediaType(MediaType.parseMediaType(contentTypeStr), null)));
}

protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolCharacterEncodingFilter.java
Fri May 2 05:07:20 2014 UTC
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolCharacterEncodingFilter.java
Fri May 2 09:19:08 2014 UTC
@@ -1,7 +1,10 @@
package gov.hhs.onc.dcdt.web.filter.impl;

import java.nio.charset.Charset;
+import javax.servlet.FilterChain;
import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.web.filter.CharacterEncodingFilter;

public class ToolCharacterEncodingFilter extends
AbstractContentFilter<CharacterEncodingFilter> {
@@ -12,6 +15,11 @@

this.enc = enc;
}
+
+ @Override
+ protected boolean canPostFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
+ return this.isContentTypeIncluded(servletResp.getContentType());
+ }

@Override
protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolJTidyFilter.java
Fri May 2 05:07:20 2014 UTC
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolJTidyFilter.java
Fri May 2 09:19:08 2014 UTC
@@ -1,14 +1,56 @@
package gov.hhs.onc.dcdt.web.filter.impl;

import gov.hhs.onc.dcdt.utils.ToolStringUtils.ToolStrBuilder;
+import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
+import javax.servlet.FilterChain;
import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
import org.apache.commons.lang3.StringUtils;
+import org.w3c.tidy.servlet.Consts;
+import org.w3c.tidy.servlet.filter.BufferedServletOutputStream;
+import org.w3c.tidy.servlet.filter.BufferedServletResponse;
import org.w3c.tidy.servlet.filter.JTidyFilter;

public class ToolJTidyFilter extends AbstractContentFilter<JTidyFilter> {
+ private class JTidyFilterChain implements FilterChain {
+ private FilterChain filterChain;
+
+ public JTidyFilterChain(FilterChain filterChain) {
+ this.filterChain = filterChain;
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletReq, ServletResponse
servletResp) throws IOException, ServletException {
+ this.filterChain.doFilter(servletReq, new
HttpServletResponseWrapper(((HttpServletResponse) servletResp)) {
+ @Override
+ public void setContentType(String contentTypeStr) {
+ if
(ToolJTidyFilter.this.isContentTypeIncluded(contentTypeStr)) {
+ super.setContentType(contentTypeStr);
+ } else {
+ BufferedServletResponse bufferedServletResp =
((BufferedServletResponse) this.getResponse());
+
bufferedServletResp.getResponse().setContentType(contentTypeStr);
+
+ try {
+ ((BufferedServletOutputStream)
bufferedServletResp.getOutputStream()).setBinary(true);
+ } catch (IOException ignored) {
+ }
+ }
+ }
+ });
+
+ if
(!ToolJTidyFilter.this.isContentTypeIncluded(servletResp.getContentType()))
{
+ servletReq.setAttribute(Consts.ATTRIBUTE_IGNORE, true);
+ }
+ }
+ }
+
private final static String DELIM_CONFIG_ENTRY = "; ";
private final static String DELIM_CONFIG_ENTRY_PAIR = ": ";

@@ -17,6 +59,16 @@
public ToolJTidyFilter() {
super(new JTidyFilter());
}
+
+ @Override
+ protected void doPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException, ServletException {
+ super.doPreFilter(servletReq, servletResp, new
JTidyFilterChain(filterChain));
+ }
+
+ @Override
+ protected boolean canPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
+ return true;
+ }

@Override
protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
=======================================
--- /dcdt-web/src/main/resources/META-INF/logback/logback-web-include.xml
Thu Feb 6 11:41:47 2014 UTC
+++ /dcdt-web/src/main/resources/META-INF/logback/logback-web-include.xml
Fri May 2 09:19:08 2014 UTC
@@ -5,17 +5,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="ch.qos.logback /META-INF/logback/logback.xsd">

- <if condition='!isDefined("dcdt.log.dir") &amp;&amp;
isDefined("catalina.base")'>
- <then>
- <property name="dcdt.log.dir" value="${catalina.base}/logs"
scope="context"/>
- </then>
- </if>
- <if condition='!isDefined("dcdt.log.dir") &amp;&amp;
isDefined("jetty.logs")'>
- <then>
- <property name="dcdt.log.dir" value="${jetty.logs}"
scope="context"/>
- </then>
- </if>
-
<logger name="gov.hhs.onc.dcdt.web.filter" level="debug"
additivity="false">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
=======================================
--- /dcdt-web/src/main/resources/META-INF/logback/logback-web.xml Thu Nov
7 01:42:51 2013 UTC
+++ /dcdt-web/src/main/resources/META-INF/logback/logback-web.xml Fri May
2 09:19:08 2014 UTC
@@ -9,12 +9,23 @@


<contextName>${dcdt.log.context.name:-%{project.artifactId}}</contextName>

- <include resource="logback/logback-web-include-test.xml"
optional="true"/>
- <include resource="logback/logback-web-include.xml" optional="true"/>
+ <if condition='!isDefined("dcdt.log.dir") &amp;&amp;
isDefined("catalina.base")'>
+ <then>
+ <property name="dcdt.log.dir" value="${catalina.base}/logs"
scope="context"/>
+ </then>
+ </if>
+ <if condition='!isDefined("dcdt.log.dir") &amp;&amp;
isDefined("jetty.logs")'>
+ <then>
+ <property name="dcdt.log.dir" value="${jetty.logs}"
scope="context"/>
+ </then>
+ </if>
+
+ <include resource="logback/logback-core-include-test.xml"
optional="true"/>
+ <include resource="logback/logback-core-include.xml" optional="true"/>

<include resource="logback/logback-service-include-test.xml"
optional="true"/>
<include resource="logback/logback-service-include.xml"
optional="true"/>

- <include resource="logback/logback-core-include-test.xml"
optional="true"/>
- <include resource="logback/logback-core-include.xml" optional="true"/>
+ <include resource="logback/logback-web-include-test.xml"
optional="true"/>
+ <include resource="logback/logback-web-include.xml" optional="true"/>
</configuration>

==============================================================================
Revision: 70aeeba5fcde
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 09:55:20 2014 UTC
Log: - Fixes DCDT-219.
- Implemented overrideable admin console admin user details.
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=70aeeba5fcde

Modified:
/dcdt-web/src/main/resources/META-INF/spring/spring-web-security.xml
/dcdt-web/src/main/resources/META-INF/spring/spring-web.xml
/dcdt-web/src/main/resources/META-INF/web/web-users.properties

=======================================
--- /dcdt-web/src/main/resources/META-INF/spring/spring-web-security.xml
Wed Apr 16 19:04:56 2014 UTC
+++ /dcdt-web/src/main/resources/META-INF/spring/spring-web-security.xml
Fri May 2 09:55:20 2014 UTC
@@ -22,8 +22,9 @@

<sec:authentication-manager id="toolAuthManager">
<sec:authentication-provider>
- <!--suppress SpringModelInspection -->
- <sec:user-service id="toolUserService"
properties="/WEB-INF/classes/web/web-users.properties"/>
+ <sec:user-service id="toolUserService">
+ <sec:user name="${dcdt.web.user.admin.name}"
authorities="ROLE_ADMIN" password="${dcdt.web.user.admin.secret}"/>
+ </sec:user-service>
</sec:authentication-provider>
<sec:authentication-provider ref="anonAuthProvider"/>
</sec:authentication-manager>
=======================================
--- /dcdt-web/src/main/resources/META-INF/spring/spring-web.xml Wed Apr 23
18:24:11 2014 UTC
+++ /dcdt-web/src/main/resources/META-INF/spring/spring-web.xml Fri May 2
09:55:20 2014 UTC
@@ -30,7 +30,7 @@
<!--suppress SpringModelInspection -->
<beans:value>classpath*:web/web.properties</beans:value>
<!--suppress SpringModelInspection -->
- <beans:value>classpath*:web/web*.properties</beans:value>
+ <beans:value>classpath*:web/web-*.properties</beans:value>
</beans:array>
</beans:property>
</beans:bean>
=======================================
--- /dcdt-web/src/main/resources/META-INF/web/web-users.properties Mon Nov
25 21:16:03 2013 UTC
+++ /dcdt-web/src/main/resources/META-INF/web/web-users.properties Fri May
2 09:55:20 2014 UTC
@@ -1,1 +1,2 @@
-admin=adminpass,ROLE_ADMIN
+dcdt.web.user.admin.name=admin
+dcdt.web.user.admin.secret=adminpass

==============================================================================
Revision: e794909a8663
Branch: default
Author: Michal Kotelba <michal....@esacinc.com>
Date: Fri May 2 21:53:01 2014 UTC
Log: - Further supports DCDT-210.
- Switched from JTidy (invoked via a filter) to HtmlCleaner (invoked via a
JSP tag).
- Removed all web content filters.
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=e794909a8663

Added:
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/impl/HtmlCleanerTag.java
/dcdt-web/src/main/resources/META-INF/spring/spring-web-tags.xml
Deleted:
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/ContentFilter.java

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/AbstractContentFilter.java

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolCharacterEncodingFilter.java

/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolJTidyFilter.java
Modified:
/dcdt-parent/pom.xml
/dcdt-web/pom.xml
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/ToolTag.java
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/impl/AbstractToolTag.java
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/impl/JsonTag.java
/dcdt-web/src/main/resources/META-INF/logback/logback-web-include.xml
/dcdt-web/src/main/resources/META-INF/spring/spring-web-filter.xml
/dcdt-web/src/main/webapp/META-INF/tags/tags-dcdt.tld
/dcdt-web/src/main/webapp/WEB-INF/views/layout.jsp
/dcdt-web/src/main/webapp/WEB-INF/web.xml

=======================================
--- /dev/null
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/impl/HtmlCleanerTag.java
Fri May 2 21:53:01 2014 UTC
@@ -0,0 +1,34 @@
+package gov.hhs.onc.dcdt.web.tags.impl;
+
+import gov.hhs.onc.dcdt.beans.utils.ToolBeanFactoryUtils;
+import org.htmlcleaner.CleanerProperties;
+import org.htmlcleaner.HtmlCleaner;
+import org.htmlcleaner.Serializer;
+import org.htmlcleaner.TagNode;
+
+@SuppressWarnings({ "serial" })
+public class HtmlCleanerTag extends AbstractToolTag {
+ private CleanerProperties cleanerProps;
+ private HtmlCleaner cleaner;
+ private Serializer cleanerSerializer;
+
+ @Override
+ protected int doAfterBodyInternal() throws Exception {
+ TagNode bodyNode =
this.cleaner.clean(this.bodyContent.getReader());
+
+ this.bodyContent.clearBody();
+
this.bodyContent.write(this.cleanerSerializer.getAsString(bodyNode,
cleanerProps.getCharset()));
+ this.bodyContent.writeOut(this.bodyContent.getEnclosingWriter());
+
+ return super.doAfterBodyInternal();
+ }
+
+ @Override
+ protected int doStartTagInternalWrapped() throws Exception {
+ this.cleanerProps =
ToolBeanFactoryUtils.getBeanOfType(this.appContext,
CleanerProperties.class);
+ this.cleaner = ToolBeanFactoryUtils.getBeanOfType(this.appContext,
HtmlCleaner.class);
+ this.cleanerSerializer =
ToolBeanFactoryUtils.getBeanOfType(this.appContext, Serializer.class);
+
+ return super.doStartTagInternalWrapped();
+ }
+}
=======================================
--- /dev/null
+++ /dcdt-web/src/main/resources/META-INF/spring/spring-web-tags.xml Fri
May 2 21:53:01 2014 UTC
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xmlns:c="http://www.springframework.org/schema/c"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:dcdt="http://direct-test.com/spring/schema/spring-dcdt"
+ xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://direct-test.com/spring/schema/spring-dcdt
http://direct-test.com/spring/schema/spring-dcdt.xsd
+ http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
+
+
<!--====================================================================================================
+ = HTMLCLEANER PROPERTIES
+
=====================================================================================================-->
+ <beans:bean id="cleanerProps" class="org.htmlcleaner.CleanerProperties"
+ p:charset="#{ charsetUtf8.name() }"
+ p:keepWhitespaceAndCommentsInHead="false"
+ p:omitCdataOutsideScriptAndStyle="true"
+ p:omitComments="true"
+ p:omitXmlDeclaration="true"
+ p:translateSpecialEntities="false"
+ p:useEmptyElementTags="false"/>
+
+
<!--====================================================================================================
+ = HTMLCLEANER
+
=====================================================================================================-->
+ <beans:bean id="cleaner" class="org.htmlcleaner.HtmlCleaner"
+ c:properties-ref="cleanerProps"/>
+
+
<!--====================================================================================================
+ = HTMLCLEANER SERIALIZER
+
=====================================================================================================-->
+ <beans:bean id="cleanerSerializer"
class="org.htmlcleaner.PrettyHtmlSerializer"
+ c:indentString="#{
T(org.apache.commons.lang3.StringUtils).repeat(T(org.apache.commons.lang3.StringUtils).SPACE,
4) }"
+ c:props-ref="cleanerProps"/>
+</beans:beans>
=======================================
--- /dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/ContentFilter.java
Fri May 2 05:07:20 2014 UTC
+++ /dev/null
@@ -1,11 +0,0 @@
-package gov.hhs.onc.dcdt.web.filter;
-
-import java.util.Set;
-import javax.servlet.Filter;
-import org.springframework.http.MediaType;
-
-public interface ContentFilter<T extends Filter> extends Filter {
- public Set<MediaType> getContentTypes();
-
- public void setContentTypes(Set<MediaType> contentTypes);
-}
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/AbstractContentFilter.java
Fri May 2 09:19:08 2014 UTC
+++ /dev/null
@@ -1,106 +0,0 @@
-package gov.hhs.onc.dcdt.web.filter.impl;
-
-import gov.hhs.onc.dcdt.utils.ToolClassUtils;
-import gov.hhs.onc.dcdt.utils.ToolStringUtils;
-import gov.hhs.onc.dcdt.web.filter.ContentFilter;
-import java.io.IOException;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import javax.annotation.Nullable;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
-
-public abstract class AbstractContentFilter<T extends Filter> implements
ContentFilter<T> {
- protected T filter;
- protected Set<MediaType> contentTypes = new LinkedHashSet<>();
- protected MutableFilterConfig filterConfig;
-
- private final static Logger LOGGER =
LoggerFactory.getLogger(AbstractContentFilter.class);
-
- protected AbstractContentFilter(T filter) {
- this.filter = filter;
- }
-
- @Override
- public void doFilter(ServletRequest servletReq, ServletResponse
servletResp, FilterChain filterChain) throws IOException, ServletException {
- this.doFilterInternal(((HttpServletRequest)servletReq),
((HttpServletResponse)servletResp), filterChain);
- }
-
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
- this.filter.init(this.initInternal((this.filterConfig = new
MutableFilterConfig(filterConfig))));
-
- LOGGER.debug(String.format("Initialized filter (name=%s,
class=%s): {%s}", this.filterConfig.getFilterName(),
ToolClassUtils.getName(this),
-
ToolStringUtils.joinDelimit(this.filterConfig.getInitParameters().entrySet(), "; ")));
- }
-
- @Override
- public void destroy() {
- this.filter.destroy();
-
- LOGGER.debug(String.format("Destroyed filter (name=%s,
class=%s).", this.filterConfig.getFilterName(),
ToolClassUtils.getName(this)));
- }
-
- protected void doFilterInternal(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException,
- ServletException {
- if (this.canPreFilter(servletReq, servletResp, filterChain)) {
- this.doPreFilter(servletReq, servletResp, filterChain);
-
- LOGGER.trace(String.format("Pre-filtered (name=%s, class=%s)
servlet request (uri=%s) and response (contentType={%s}).",
- this.filterConfig.getFilterName(),
ToolClassUtils.getName(this), servletReq.getRequestURI(),
servletResp.getContentType()));
- }
-
- filterChain.doFilter(servletReq, servletResp);
-
- if (this.canPostFilter(servletReq, servletResp, filterChain)) {
- this.doPostFilter(servletReq, servletResp, filterChain);
-
- LOGGER.trace(String.format("Post-filtered (name=%s, class=%s)
servlet request (uri=%s) and response (contentType={%s}).",
- this.filterConfig.getFilterName(),
ToolClassUtils.getName(this), servletReq.getRequestURI(),
servletResp.getContentType()));
- }
- }
-
- protected void doPostFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException, ServletException {
- this.filter.doFilter(servletReq, servletResp, filterChain);
- }
-
- protected void doPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException, ServletException {
- this.filter.doFilter(servletReq, servletResp, filterChain);
- }
-
- protected boolean canPostFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
- return false;
- }
-
- protected boolean canPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
- return false;
- }
-
- protected boolean isContentTypeIncluded(@Nullable String
contentTypeStr) {
- return ((contentTypeStr != null) && this.contentTypes.contains(new
MediaType(MediaType.parseMediaType(contentTypeStr), null)));
- }
-
- protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
- return filterConfig;
- }
-
- @Override
- public Set<MediaType> getContentTypes() {
- return this.contentTypes;
- }
-
- @Override
- public void setContentTypes(Set<MediaType> contentTypes) {
- this.contentTypes.clear();
- this.contentTypes.addAll(contentTypes);
- }
-}
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolCharacterEncodingFilter.java
Fri May 2 09:19:08 2014 UTC
+++ /dev/null
@@ -1,34 +0,0 @@
-package gov.hhs.onc.dcdt.web.filter.impl;
-
-import java.nio.charset.Charset;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.web.filter.CharacterEncodingFilter;
-
-public class ToolCharacterEncodingFilter extends
AbstractContentFilter<CharacterEncodingFilter> {
- private Charset enc;
-
- public ToolCharacterEncodingFilter(Charset enc) {
- super(new CharacterEncodingFilter());
-
- this.enc = enc;
- }
-
- @Override
- protected boolean canPostFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
- return this.isContentTypeIncluded(servletResp.getContentType());
- }
-
- @Override
- protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
- this.filter.setEncoding(this.enc.name());
-
- return super.initInternal(filterConfig);
- }
-
- public Charset getEncoding() {
- return enc;
- }
-}
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/filter/impl/ToolJTidyFilter.java
Fri May 2 09:19:08 2014 UTC
+++ /dev/null
@@ -1,97 +0,0 @@
-package gov.hhs.onc.dcdt.web.filter.impl;
-
-import gov.hhs.onc.dcdt.utils.ToolStringUtils.ToolStrBuilder;
-import java.io.IOException;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Objects;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-import org.apache.commons.lang3.StringUtils;
-import org.w3c.tidy.servlet.Consts;
-import org.w3c.tidy.servlet.filter.BufferedServletOutputStream;
-import org.w3c.tidy.servlet.filter.BufferedServletResponse;
-import org.w3c.tidy.servlet.filter.JTidyFilter;
-
-public class ToolJTidyFilter extends AbstractContentFilter<JTidyFilter> {
- private class JTidyFilterChain implements FilterChain {
- private FilterChain filterChain;
-
- public JTidyFilterChain(FilterChain filterChain) {
- this.filterChain = filterChain;
- }
-
- @Override
- public void doFilter(ServletRequest servletReq, ServletResponse
servletResp) throws IOException, ServletException {
- this.filterChain.doFilter(servletReq, new
HttpServletResponseWrapper(((HttpServletResponse) servletResp)) {
- @Override
- public void setContentType(String contentTypeStr) {
- if
(ToolJTidyFilter.this.isContentTypeIncluded(contentTypeStr)) {
- super.setContentType(contentTypeStr);
- } else {
- BufferedServletResponse bufferedServletResp =
((BufferedServletResponse) this.getResponse());
-
bufferedServletResp.getResponse().setContentType(contentTypeStr);
-
- try {
- ((BufferedServletOutputStream)
bufferedServletResp.getOutputStream()).setBinary(true);
- } catch (IOException ignored) {
- }
- }
- }
- });
-
- if
(!ToolJTidyFilter.this.isContentTypeIncluded(servletResp.getContentType()))
{
- servletReq.setAttribute(Consts.ATTRIBUTE_IGNORE, true);
- }
- }
- }
-
- private final static String DELIM_CONFIG_ENTRY = "; ";
- private final static String DELIM_CONFIG_ENTRY_PAIR = ": ";
-
- private Map<String, Object> config = new LinkedHashMap<>();
-
- public ToolJTidyFilter() {
- super(new JTidyFilter());
- }
-
- @Override
- protected void doPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) throws
IOException, ServletException {
- super.doPreFilter(servletReq, servletResp, new
JTidyFilterChain(filterChain));
- }
-
- @Override
- protected boolean canPreFilter(HttpServletRequest servletReq,
HttpServletResponse servletResp, FilterChain filterChain) {
- return true;
- }
-
- @Override
- protected MutableFilterConfig initInternal(MutableFilterConfig
filterConfig) throws ServletException {
- ToolStrBuilder configStrBuilder = new ToolStrBuilder();
-
- for (String configPropName : this.config.keySet()) {
- configStrBuilder.appendDelimiter(DELIM_CONFIG_ENTRY);
- configStrBuilder.append(configPropName);
- configStrBuilder.appendDelimiter(DELIM_CONFIG_ENTRY_PAIR);
-
configStrBuilder.append(Objects.toString(this.config.get(configPropName),
StringUtils.EMPTY));
- }
-
- filterConfig.getInitParameters().put(JTidyFilter.CONFIG_CONFIG,
configStrBuilder.build());
-
- return super.initInternal(filterConfig);
- }
-
- public Map<String, Object> getConfig() {
- return this.config;
- }
-
- public void setConfig(Map<String, Object> config) {
- this.config.clear();
- this.config.putAll(config);
- }
-}
=======================================
--- /dcdt-parent/pom.xml Wed Apr 30 19:02:53 2014 UTC
+++ /dcdt-parent/pom.xml Fri May 2 21:53:01 2014 UTC
@@ -288,14 +288,9 @@
<version>1.1.0.Final</version>
</dependency>
<dependency>
- <groupId>net.sf.jtidy</groupId>
- <artifactId>jtidy</artifactId>
- <version>r938</version>
- </dependency>
- <dependency>
- <groupId>net.sf.jtidy</groupId>
- <artifactId>jtidyservlet</artifactId>
- <version>8.0-SNAPSHOT</version>
+ <groupId>net.sourceforge.htmlcleaner</groupId>
+ <artifactId>htmlcleaner</artifactId>
+ <version>2.8</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
=======================================
--- /dcdt-web/pom.xml Wed Apr 30 19:02:53 2014 UTC
+++ /dcdt-web/pom.xml Fri May 2 21:53:01 2014 UTC
@@ -163,12 +163,8 @@
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
- <groupId>net.sf.jtidy</groupId>
- <artifactId>jtidy</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.jtidy</groupId>
- <artifactId>jtidyservlet</artifactId>
+ <groupId>net.sourceforge.htmlcleaner</groupId>
+ <artifactId>htmlcleaner</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
=======================================
--- /dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/ToolTag.java Wed Jan
22 18:53:11 2014 UTC
+++ /dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/ToolTag.java Fri May
2 21:53:01 2014 UTC
@@ -1,8 +1,7 @@
package gov.hhs.onc.dcdt.web.tags;

import java.io.Serializable;
-import javax.servlet.jsp.tagext.DynamicAttributes;
-import javax.servlet.jsp.tagext.IterationTag;
+import javax.servlet.jsp.tagext.BodyTag;

-public interface ToolTag extends DynamicAttributes, IterationTag,
Serializable {
+public interface ToolTag extends BodyTag, Serializable {
}
=======================================
---
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/impl/AbstractToolTag.java
Wed Jan 22 18:53:11 2014 UTC
+++
/dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/impl/AbstractToolTag.java
Fri May 2 21:53:01 2014 UTC
@@ -1,17 +1,72 @@
package gov.hhs.onc.dcdt.web.tags.impl;

+import gov.hhs.onc.dcdt.utils.ToolClassUtils;
import gov.hhs.onc.dcdt.web.tags.ToolTag;
import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyContent;
+import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.web.servlet.tags.RequestContextAwareTag;

+@SuppressWarnings({ "serial" })
public abstract class AbstractToolTag extends RequestContextAwareTag
implements ToolTag {
+ protected AbstractApplicationContext appContext;
+ protected BodyContent bodyContent;
+
+ @Override
+ public int doEndTag() throws JspException {
+ try {
+ return this.doEndTagInternal();
+ } catch (Exception e) {
+ throw new JspException(String.format("Unable to end JSP tag
(class=%s).", ToolClassUtils.getName(this)), e);
+ }
+ }
+
+ @Override
+ public int doAfterBody() throws JspException {
+ try {
+ return this.doAfterBodyInternal();
+ } catch (Exception e) {
+ throw new JspException(String.format("Unable to post-process
JSP tag (class=%s) body.", ToolClassUtils.getName(this)), e);
+ }
+ }
+
+ @Override
+ public void doInitBody() throws JspException {
+ try {
+ this.doInitBodyInternal();
+ } catch (Exception e) {
+ throw new JspException(String.format("Unable to initialize JSP
tag (class=%s) body.", ToolClassUtils.getName(this)), e);
+ }
+ }
+
+ protected int doEndTagInternal() throws Exception {
+ return EVAL_PAGE;
+ }
+
+ protected int doAfterBodyInternal() throws Exception {
+ return SKIP_BODY;
+ }
+
+ protected void doInitBodyInternal() throws Exception {
+ }
+
@Override
protected int doStartTagInternal() throws Exception {
- return EVAL_BODY_INCLUDE;
+ this.appContext = ((AbstractApplicationContext)
this.getRequestContext().getWebApplicationContext());
+
+ try {
+ return this.doStartTagInternalWrapped();
+ } catch (Exception e) {
+ throw new JspException(String.format("Unable to start JSP tag
(class=%s).", ToolClassUtils.getName(this)), e);
+ }
+ }
+
+ protected int doStartTagInternalWrapped() throws Exception {
+ return EVAL_BODY_BUFFERED;
}

@Override
- public void setDynamicAttribute(String uri, String localName, Object
value) throws JspException {
- // TODO: implement
+ public void setBodyContent(BodyContent bodyContent) {
+ this.bodyContent = bodyContent;
}
}
=======================================
--- /dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/impl/JsonTag.java Sat
Feb 8 02:16:05 2014 UTC
+++ /dcdt-web/src/main/java/gov/hhs/onc/dcdt/web/tags/impl/JsonTag.java Fri
May 2 21:53:01 2014 UTC
@@ -1,12 +1,8 @@
package gov.hhs.onc.dcdt.web.tags.impl;

import com.fasterxml.jackson.databind.ObjectMapper;
-import gov.hhs.onc.dcdt.json.ToolJsonException;
+import gov.hhs.onc.dcdt.beans.utils.ToolBeanFactoryUtils;
import gov.hhs.onc.dcdt.json.utils.ToolJsonUtils;
-import gov.hhs.onc.dcdt.beans.utils.ToolBeanFactoryUtils;
-import gov.hhs.onc.dcdt.utils.ToolClassUtils;
-import java.io.IOException;
-import javax.servlet.jsp.JspException;

@SuppressWarnings({ "serial" })
public class JsonTag extends AbstractToolTag {
@@ -14,21 +10,17 @@
private Object target;

@Override
- public int doEndTag() throws JspException {
- try {
-
this.pageContext.getOut().println(ToolJsonUtils.toJson(this.objMapper,
this.target));
- } catch (IOException | ToolJsonException e) {
- throw new JspException(String.format("Unable to write target
(class=%s) JSON.", ToolClassUtils.getName(this.target)), e);
- }
+ protected int doEndTagInternal() throws Exception {
+
this.pageContext.getOut().println(ToolJsonUtils.toJson(this.objMapper,
this.target));

- return super.doEndTag();
+ return super.doEndTagInternal();
}

@Override
- protected int doStartTagInternal() throws Exception {
- this.objMapper =
ToolBeanFactoryUtils.getBeanOfType(this.getRequestContext().getWebApplicationContext(),
ObjectMapper.class);
+ protected int doStartTagInternalWrapped() throws Exception {
+ this.objMapper =
ToolBeanFactoryUtils.getBeanOfType(this.appContext, ObjectMapper.class);

- return super.doStartTagInternal();
+ return super.doStartTagInternalWrapped();
}

public void setTarget(Object target) {
=======================================
--- /dcdt-web/src/main/resources/META-INF/logback/logback-web-include.xml
Fri May 2 09:19:08 2014 UTC
+++ /dcdt-web/src/main/resources/META-INF/logback/logback-web-include.xml
Fri May 2 21:53:01 2014 UTC
@@ -5,8 +5,4 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="ch.qos.logback /META-INF/logback/logback.xsd">

- <logger name="gov.hhs.onc.dcdt.web.filter" level="debug"
additivity="false">
- <appender-ref ref="console"/>
- <appender-ref ref="file"/>
- </logger>
</included>
=======================================
--- /dcdt-web/src/main/resources/META-INF/spring/spring-web-filter.xml Fri
May 2 05:07:20 2014 UTC
+++ /dcdt-web/src/main/resources/META-INF/spring/spring-web-filter.xml Fri
May 2 21:53:01 2014 UTC
@@ -24,48 +24,4 @@
p:confPath="/WEB-INF/urlrewrite/urlrewrite-web.xml"
p:confReloadCheckInterval="30"
p:statusPath="/urlrewrite/status"/>
-
-
<!--====================================================================================================
- = CONTENT FILTERS
-
=====================================================================================================-->
- <beans:bean id="filterContent"
class="gov.hhs.onc.dcdt.web.filter.ContentFilter" parent="filter"
abstract="true"/>
-
- <beans:bean id="filterContentCharEnc"
class="gov.hhs.onc.dcdt.web.filter.impl.ToolCharacterEncodingFilter"
parent="filterContent"
- c:enc-ref="charsetUtf8">
- <beans:property name="contentTypes">
- <util:set>
- <beans:value>#{
T(gov.hhs.onc.dcdt.web.media.WebContentTypes).APP_JAVASCRIPT }</beans:value>
- <beans:value>#{
T(org.springframework.http.MediaType).APPLICATION_JSON }</beans:value>
- <beans:value>#{
T(org.springframework.http.MediaType).APPLICATION_XHTML_XML }</beans:value>
- <beans:value>#{
T(org.springframework.http.MediaType).APPLICATION_XML }</beans:value>
- <beans:value>#{
T(gov.hhs.onc.dcdt.web.media.WebContentTypes).TEXT_CSS }</beans:value>
- <beans:value>#{
T(org.springframework.http.MediaType).TEXT_HTML }</beans:value>
- <beans:value>#{
T(gov.hhs.onc.dcdt.web.media.WebContentTypes).TEXT_JAVASCRIPT
}</beans:value>
- <beans:value>#{
T(org.springframework.http.MediaType).TEXT_PLAIN }</beans:value>
- <beans:value>#{
T(org.springframework.http.MediaType).TEXT_XML }</beans:value>
- </util:set>
- </beans:property>
- </beans:bean>
-
- <beans:bean id="filterContentJTidy"
class="gov.hhs.onc.dcdt.web.filter.impl.ToolJTidyFilter"
parent="filterContent">
- <beans:property name="config">
- <util:map>
- <beans:entry key="char-encoding" value="#{
charsetUtf8.name() }"/>
- <beans:entry key="force-output" value="true"/>
- <beans:entry key="indent" value="auto"/>
- <beans:entry key="indent-spaces" value="4"/>
- <beans:entry key="join-styles" value="false"/>
- <beans:entry key="literal-attributes" value="true"/>
- <beans:entry key="output-encoding" value="#{
charsetUtf8.name() }"/>
- <beans:entry key="trim-empty-elements" value="false"/>
- <beans:entry key="wrap" value="160"/>
- </util:map>
- </beans:property>
- <beans:property name="contentTypes">
- <util:set>
- <beans:value>#{
T(org.springframework.http.MediaType).APPLICATION_XHTML_XML }</beans:value>
- <beans:value>#{
T(org.springframework.http.MediaType).TEXT_HTML }</beans:value>
- </util:set>
- </beans:property>
- </beans:bean>
</beans:beans>
=======================================
--- /dcdt-web/src/main/webapp/META-INF/tags/tags-dcdt.tld Wed Jan 22
18:53:11 2014 UTC
+++ /dcdt-web/src/main/webapp/META-INF/tags/tags-dcdt.tld Fri May 2
21:53:01 2014 UTC
@@ -15,6 +15,16 @@

<!--====================================================================================================
= TAGS

=====================================================================================================-->
+ <tag>
+ <description>
+ Tag that cleans it's body content using HtmlCleaner.
+ </description>
+ <display-name>HtmlCleaner Tag</display-name>
+ <name>htmlcleaner</name>
+
<tag-class>gov.hhs.onc.dcdt.web.tags.impl.HtmlCleanerTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
<tag>
<description>
Tag that converts given object(s) into JSON.
=======================================
--- /dcdt-web/src/main/webapp/WEB-INF/views/layout.jsp Wed Apr 23 18:24:11
2014 UTC
+++ /dcdt-web/src/main/webapp/WEB-INF/views/layout.jsp Fri May 2 21:53:01
2014 UTC
@@ -8,24 +8,26 @@
<%@taglib prefix="tilesx"
uri="http://tiles.apache.org/tags-tiles-extras" %>
<%@taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@page contentType="text/html; charset=UTF-8" isELIgnored="false"
pageEncoding="UTF-8" %>
-<!DOCTYPE html>
-<html>
- <head>
- <tiles:insertAttribute name="head-common"/>
- <tiles:insertAttribute name="head" ignore="true"/>
- </head>
- <body>
- <div id="wrap">
- <tiles:insertAttribute name="nav-common"/>
- <tiles:insertAttribute name="nav" ignore="true"/>
- <div id="content">
- <div class="container">
- <tiles:insertAttribute name="content-common"/>
- <tiles:insertAttribute name="content" ignore="true"/>
+<dcdt:htmlcleaner>
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <tiles:insertAttribute name="head-common"/>
+ <tiles:insertAttribute name="head" ignore="true"/>
+ </head>
+ <body>
+ <div id="wrap">
+ <tiles:insertAttribute name="nav-common"/>
+ <tiles:insertAttribute name="nav" ignore="true"/>
+ <div id="content">
+ <div class="container">
+ <tiles:insertAttribute name="content-common"/>
+ <tiles:insertAttribute name="content"
ignore="true"/>
+ </div>
</div>
</div>
- </div>
- <tiles:insertAttribute name="footer-common"/>
- <tiles:insertAttribute name="footer" ignore="true"/>
- </body>
-</html>
+ <tiles:insertAttribute name="footer-common"/>
+ <tiles:insertAttribute name="footer" ignore="true"/>
+ </body>
+ </html>
+</dcdt:htmlcleaner>
=======================================
--- /dcdt-web/src/main/webapp/WEB-INF/web.xml Fri May 2 05:07:20 2014 UTC
+++ /dcdt-web/src/main/webapp/WEB-INF/web.xml Fri May 2 21:53:01 2014 UTC
@@ -121,30 +121,4 @@
<filter-name>springSecurityFilterChain</filter-name>
<servlet-name>dispatcherServlet</servlet-name>
</filter-mapping>
-
- <filter>
- <filter-name>filterContentCharEnc</filter-name>
-
<filter-class>gov.hhs.onc.dcdt.web.filter.impl.DispatcherServletFilterProxy</filter-class>
- <init-param>
- <param-name>targetFilterLifecycle</param-name>
- <param-value>true</param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>filterContentCharEnc</filter-name>
- <servlet-name>dispatcherServlet</servlet-name>
- </filter-mapping>
-
- <filter>
- <filter-name>filterContentJTidy</filter-name>
-
<filter-class>gov.hhs.onc.dcdt.web.filter.impl.DispatcherServletFilterProxy</filter-class>
- <init-param>
- <param-name>targetFilterLifecycle</param-name>
- <param-value>true</param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>filterContentJTidy</filter-name>
- <servlet-name>dispatcherServlet</servlet-name>
- </filter-mapping>
</web-app>
Reply all
Reply to author
Forward
0 new messages