Commit e0afb12d by Mandar Ambawane Committed by nixonrodrigues

ATLAS-3472 :- Fix to port jsp's to Servlet.

parent d57f5d8a
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.apache.atlas.web.servlets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AtlasErrorServlet extends AtlasHttpServlet {
public static final Logger LOG = LoggerFactory.getLogger(AtlasErrorServlet.class);
public static final String ERROR_HTML_TEMPLATE = "/error.html.template";
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) {
includeResponse( request, response, ERROR_HTML_TEMPLATE);
}
}
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.apache.atlas.web.servlets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AtlasHttpServlet extends HttpServlet {
public static final Logger LOG = LoggerFactory.getLogger(AtlasHttpServlet.class);
public static final String TEXT_HTML = "text/html";
public static final String XFRAME_OPTION = "X-Frame-Options";
public static final String DENY = "DENY";
protected void includeResponse(HttpServletRequest request, HttpServletResponse response, String template) {
try {
response.setContentType(TEXT_HTML);
response.setHeader(XFRAME_OPTION, DENY);
ServletContext context = getServletContext();
RequestDispatcher rd = context.getRequestDispatcher(template);
rd.include(request, response);
} catch (Exception e) {
LOG.error("Error in AtlasHttpServlet", template, e);
}
}
}
\ No newline at end of file
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.apache.atlas.web.servlets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AtlasLoginServlet extends AtlasHttpServlet {
public static final Logger LOG = LoggerFactory.getLogger(AtlasLoginServlet.class);
public static final String LOGIN_HTML_TEMPLATE = "/login.html.template";
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) {
includeResponse(request, response, LOGIN_HTML_TEMPLATE);
}
}
\ No newline at end of file
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<!-- This XML is no longer being used, @see AtlasSecurityConfig for the equivalent java config --> <!-- This XML is no longer being used, @see AtlasSecurityConfig for the equivalent java config -->
<security:http pattern="/login.jsp" security="none" /> <security:http pattern="/login.jsp" security="none" />
<security:http pattern="/error.jsp" security="none" />
<security:http pattern="/css/**" security="none" /> <security:http pattern="/css/**" security="none" />
<security:http pattern="/img/**" security="none" /> <security:http pattern="/img/**" security="none" />
<security:http pattern="/libs/**" security="none" /> <security:http pattern="/libs/**" security="none" />
......
...@@ -36,6 +36,26 @@ ...@@ -36,6 +36,26 @@
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>org.apache.atlas.web.servlets.AtlasLoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/login.jsp</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ErrorServlet</servlet-name>
<servlet-class>org.apache.atlas.web.servlets.AtlasErrorServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ErrorServlet</servlet-name>
<url-pattern>/error.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>jersey-servlet</servlet-name> <servlet-name>jersey-servlet</servlet-name>
<url-pattern>/api/atlas/*</url-pattern> <url-pattern>/api/atlas/*</url-pattern>
......
...@@ -15,12 +15,11 @@ ...@@ -15,12 +15,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
--> -->
<% response.setHeader("X-Frame-Options", "DENY"); %>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script type="text/javascript"> <script type="text/javascript">
function Redirect() { function Redirect() {
window.location.assign("ieerror.html"); window.location.assign("ieerror.html");
} }
...@@ -28,8 +27,8 @@ ...@@ -28,8 +27,8 @@
</script> </script>
<![endif]--> <![endif]-->
<!--[if gt IE 7]> <!--[if gt IE 7]>
<script src="js/external_lib/es5-shim.min.js"></script> <script src="js/external_lib/es5-shim.min.js"></script>
<script src="js/external_lib/respond.min.js"></script> <script src="js/external_lib/respond.min.js"></script>
<![endif]--> <![endif]-->
<!--[if gt IE 8]><!--> <!--[if gt IE 8]><!-->
<html class="no-js"> <html class="no-js">
...@@ -50,7 +49,7 @@ ...@@ -50,7 +49,7 @@
</head> </head>
<body class="login-body"> <body class="login-body">
<div class="login-form"> <div class="login-form">
<div class="logo-container text-center"> <div class="logo-container text-center">
<img src="img/atlas_logo.svg" /> <img src="img/atlas_logo.svg" />
</div> </div>
...@@ -66,7 +65,7 @@ ...@@ -66,7 +65,7 @@
<span id="errorBox" class="col-md-12 help-inline" style="color:#FF1A40;display:none;text-align:center;padding-bottom: 10px;"><span class="errorMsg"></span></span> <span id="errorBox" class="col-md-12 help-inline" style="color:#FF1A40;display:none;text-align:center;padding-bottom: 10px;"><span class="errorMsg"></span></span>
<button class="btn btn-default btn-block btn-login" id="signIn">Log in</button> <button class="btn btn-default btn-block btn-login" id="signIn">Log in</button>
</form> </form>
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment