diff options
Diffstat (limited to 'datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/web/PublishRedirectStrategy.java')
-rw-r--r-- | datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/web/PublishRedirectStrategy.java | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/web/PublishRedirectStrategy.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/web/PublishRedirectStrategy.java index 3ceec627..9dcf133a 100644 --- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/web/PublishRedirectStrategy.java +++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/web/PublishRedirectStrategy.java @@ -1,6 +1,6 @@ -/* +/*- * ============LICENSE_START====================================================================== - * Copyright (C) 2018 NOKIA Intellectual Property, 2018 Nordix Foundation. All rights reserved. + * Copyright (C) 2018 NOKIA Intellectual Property, 2018-2019 Nordix Foundation. All rights reserved. * =============================================================================================== * 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 @@ -37,10 +37,8 @@ import org.slf4j.LoggerFactory; import org.slf4j.MDC; /** - * PublishRedirectStrategy implementation - * that automatically redirects all HEAD, GET, POST, PUT, and DELETE requests. - * This strategy relaxes restrictions on automatic redirection of - * POST methods imposed by the HTTP specification. + * PublishRedirectStrategy implementation that automatically redirects all HEAD, GET, POST, PUT, and DELETE requests. + * This strategy relaxes restrictions on automatic redirection of POST methods imposed by the HTTP specification. * */ @Contract(threading = ThreadingBehavior.IMMUTABLE) @@ -50,6 +48,17 @@ public class PublishRedirectStrategy extends DefaultRedirectStrategy { private final Map<String, String> contextMap; /** + * Redirectable methods. + */ + private static final String[] REDIRECT_METHODS = new String[] { // + HttpPut.METHOD_NAME, // + HttpGet.METHOD_NAME, // + HttpPost.METHOD_NAME, // + HttpHead.METHOD_NAME, // + HttpDelete.METHOD_NAME // + }; + + /** * Constructor PublishRedirectStrategy. * * @param contextMap - MDC context map @@ -58,17 +67,6 @@ public class PublishRedirectStrategy extends DefaultRedirectStrategy { this.contextMap = contextMap; } - /** - * Redirectable methods. - */ - private static final String[] REDIRECT_METHODS = new String[] { // - HttpPut.METHOD_NAME, // - HttpGet.METHOD_NAME, // - HttpPost.METHOD_NAME, // - HttpHead.METHOD_NAME, // - HttpDelete.METHOD_NAME // - }; - @Override protected boolean isRedirectable(final String method) { for (final String m : REDIRECT_METHODS) { @@ -81,7 +79,7 @@ public class PublishRedirectStrategy extends DefaultRedirectStrategy { @Override public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context) - throws ProtocolException { + throws ProtocolException { MDC.setContextMap(contextMap); final URI uri = getLocationURI(request, response, context); logger.trace("getRedirect...: {}", request); |