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 @@
<!-- This XML is no longer being used, @see AtlasSecurityConfig for the equivalent java config -->
<security:http pattern="/login.jsp" security="none" />
<security:http pattern="/error.jsp" security="none" />
<security:http pattern="/css/**" security="none" />
<security:http pattern="/img/**" security="none" />
<security:http pattern="/libs/**" security="none" />
......
......@@ -36,6 +36,26 @@
<load-on-startup>1</load-on-startup>
</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-name>jersey-servlet</servlet-name>
<url-pattern>/api/atlas/*</url-pattern>
......
......@@ -15,12 +15,11 @@
* See the License for the specific language governing permissions and
* 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 IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript">
<script type="text/javascript">
function Redirect() {
window.location.assign("ieerror.html");
}
......@@ -28,8 +27,8 @@
</script>
<![endif]-->
<!--[if gt IE 7]>
<script src="js/external_lib/es5-shim.min.js"></script>
<script src="js/external_lib/respond.min.js"></script>
<script src="js/external_lib/es5-shim.min.js"></script>
<script src="js/external_lib/respond.min.js"></script>
<![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
......@@ -50,23 +49,23 @@
</head>
<body class="login-body">
<div class="login-form">
<div class="logo-container text-center">
<img src="img/atlas_logo.svg" />
</div>
<h4>Sign In to your account</h4>
<form action="" method="post" accept-charset="utf-8">
<div class="form-group icon-group user">
<input type="text" name="username" id="username" class="form-control" placeholder="Username" tabindex="1" required autofocus />
</div>
<div class="form-group icon-group password">
<input type="password" name="password" class="form-control" placeholder="Password" id="password" tabindex="2" autocomplete="off" required />
<i class="fa fa-eye-slash show-password"></i>
</div>
<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>
</form>
<div class="login-form">
<div class="logo-container text-center">
<img src="img/atlas_logo.svg" />
</div>
<h4>Sign In to your account</h4>
<form action="" method="post" accept-charset="utf-8">
<div class="form-group icon-group user">
<input type="text" name="username" id="username" class="form-control" placeholder="Username" tabindex="1" required autofocus />
</div>
<div class="form-group icon-group password">
<input type="password" name="password" class="form-control" placeholder="Password" id="password" tabindex="2" autocomplete="off" required />
<i class="fa fa-eye-slash show-password"></i>
</div>
<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>
</form>
</div>
</body>
</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