Skip to content

Commit

Permalink
sameip.jsp: cheap&dirty mvc
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Dec 24, 2009
1 parent 2f35bee commit c5cda74
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
38 changes: 38 additions & 0 deletions src/ru/org/linux/spring/SameIPController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 1998-2009 Linux.org.ru
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 ru.org.linux.spring;

import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import ru.org.linux.site.AccessViolationException;
import ru.org.linux.site.Template;

@Controller
public class SameIPController {
@RequestMapping("/sameip.jsp")
public ModelAndView sameIP(HttpServletRequest request) throws Exception {
Template tmpl = Template.getTemplate(request);

if (!tmpl.isModeratorSession()) {
throw new AccessViolationException("Not moderator");
}

return new ModelAndView("sameip");
}
}
4 changes: 0 additions & 4 deletions web/sameip.jsp → web/WEB-INF/jsp/sameip.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
<%
Template tmpl = Template.getTemplate(request);
if (!tmpl.isModeratorSession()) {
throw new AccessViolationException("Not moderator");
}
%>
<title>Поиск писем с IP-адреса</title>
<jsp:include page="/WEB-INF/jsp/header.jsp"/>
Expand Down
5 changes: 5 additions & 0 deletions web/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ version="2.4">
<servlet-name>springapp</servlet-name>
<url-pattern>/show-comments.jsp</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>/sameip.jsp</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Expand Down

0 comments on commit c5cda74

Please sign in to comment.