Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • s51119/broken-petclinic
  • s72462/broken-petclinic
  • s61200/broken-petclinic
  • s76620/broken-petclinic
  • s76545/broken-petclinic
  • s76915/broken-petclinic
  • s70130/broken-petclinic
  • s72523/broken-petclinic
  • s77047/broken-petclinic
  • s70178/broken-petclinic
  • s76522/broken-petclinic
  • s76426/broken-petclinic
  • s76863/broken-petclinic
  • s76856/broken-petclinic
  • s76728/broken-petclinic
  • williamreetz/broken-petclinic
  • s77034/broken-petclinic
  • s76400/broken-petclinic
  • s72288/broken-petclinic
  • s76608/broken-petclinic
20 results
Show changes
Showing
with 0 additions and 415 deletions
package org.springframework.samples.petclinic.util;
import org.springframework.ui.Model;
// This is an idea as a context object to make avail to @Controller methods to interact with Dispatcher
public interface ExternalContext {
Model getModel();
void selectView(String viewName);
void renderFragment(String fragment);
void redirect(Object resource);
ExternalContext forResource(Object resource);
Object getNativeRequest();
Object getNativeResponse();
}
package org.springframework.samples.petclinic.util;
import java.math.BigDecimal;
public class Measurement {
private BigDecimal amount;
private Unit unit;
}
package org.springframework.samples.petclinic.util;
public enum Unit {
POUNDS
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
</layout>
</appender>>
<!-- Application Loggers -->
<logger name="org.springframework.samples.petclinic">
<level value="info" />
</logger>
<!-- 3rdparty Loggers -->
<logger name="org.springframework.core">
<level value="info" />
</logger>
<logger name="org.springframework.beans">
<level value="info" />
</logger>
<logger name="org.springframework.context">
<level value="info" />
</logger>
<logger name="org.springframework.web">
<level value="info" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<h2>Add New Appointment</h2>
<form:form id="addNewForm" action="${pageContext.request.contextPath}/appointments" modelAttribute="appointment" method="post">
<form:label for="doctor" path="doctor">
Doctor
<form:input path="doctor" />
</form:label>
<form:label for="owner" path="owner">
Owner
<form:input path="owner" />
</form:label>
<form:label for="pet" path="pet">
Pet
<form:input path="pet" />
</form:label>
<form:label for="date" path="date">
Date
<form:input path="date" />
</form:label>
<form:label for="time" path="time">
Time
<form:input path="time" />
</form:label>
<form:label for="notes" path="notes">
Notes
<form:input path="notes" />
</form:label>
<input type="submit" value="Add" />
</form:form>
\ No newline at end of file
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<h2>Appointment Calendar</h2>
\ No newline at end of file
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<div id="sidebar">
<ul id="sub-nav">
<li><a href="${pageContext.request.contextPath}/appointments">Calendar</a></li>
<li><a href="${pageContext.request.contextPath}/appointments/new">Add New</a></li>
</ul>
</div>
<div id="main">
<tiles:insertAttribute name="main" />
</div>
\ No newline at end of file
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<h2>Welcome to the Spring 3 Petclinic</h2>
<img id="petlogo" src="${pageContext.request.contextPath}/resources/images/pets.png" />
<p>
This sample application demonstrates many of the features Spring provides for web application development.
</p>
\ No newline at end of file
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@ page session="false" %>
<html>
<head>
<title><tiles:insertAttribute name="title"/></title>
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/resources/styles/main.css"/>
</head>
<body id="page-body">
<div id="page">
<div id="header">
<ul id="signin">
<c:choose>
<c:when test="${pageContext.request.userPrincipal != null}">
<p>Welcome ${pageContext.request.userPrincipal.name}</p>
<li><a href="<c:url value="/account/signout"/>">Sign Out</a></li>
</c:when>
<c:otherwise>
<li><a href="<c:url value="/account/signin"/>">Sign In</a></li>
</c:otherwise>
</c:choose>
</ul>
<div id="nav">
<ul>
<li><a href="${pageContext.request.contextPath}">Home</a></li>
<li><a href="${pageContext.request.contextPath}/appointments">Appointments</a></li>
<li><a href="${pageContext.request.contextPath}/owners">Owners</a></li>
</ul>
</div>
</div>
<div id="content">
<tiles:insertAttribute name="content"/>
</div>
<div id="footer">
<ul id="legal">
<li>Privacy Policy</li>
<li>Terms of Service</li>
</ul>
<p>(c) 2009 <a href="http://www.springsource.org">springsource.org</a></p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<h2>Add New Owner</h2>
<form:form id="addNewForm" action="${pageContext.request.contextPath}/owners" modelAttribute="owner" method="post">
<form:label for="firstName" path="firstName">
First Name
<form:input path="firstName" />
</form:label>
<form:label for="lastName" path="lastName">
Last Name
<form:input path="lastName" />
</form:label>
<input type="submit" value="Add" />
</form:form>
\ No newline at end of file
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<div id="sidebar">
<ul id="sub-nav">
<li><a href="${pageContext.request.contextPath}/owners">Search</a></li>
<li><a href="${pageContext.request.contextPath}/owners/new">Add New</a></li>
</ul>
</div>
<div id="main">
<tiles:insertAttribute name="main" />
</div>
\ No newline at end of file
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<h2>Owner Details</h2>
\ No newline at end of file
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<h2>Search Owners</h2>
<form:form id="searchForm" action="owners/search" modelAttribute="ownerSearchForm" method="get">
<form:label for="lastName" path="lastName">
Last Name
<form:input path="lastName" />
</form:label>
<input type="submit" value="Search" />
</form:form>
\ No newline at end of file
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<h2>Search Results</h2>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<!-- Scans within the base package of the application for @Components to configure as beans -->
<context:component-scan base-package="org.springframework.samples.petclinic" />
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<!-- HANDLER MAPPING RULES -->
<!-- Maps requests to @Controllers based on @RequestMapping("path") annotation values
If no annotation-based path mapping is found, Spring MVC sends a 404 response and logs a pageNotFound warning. -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="1" />
</bean>
<!-- REGISTERED HANDLER TYPES -->
<!-- Enables annotated @Controllers; responsible for invoking an annotated POJO @Controller when one is mapped. -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<!-- VIEW RESOLUTION AND RENDERING -->
<!-- Resolves view names to tiles definitions in /WEB-INF/tiles.xml -->
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
</bean>
<!-- Initializes the Apache Tiles CompositeView system -->
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" />
<!-- Configures Apache Commons Fileupload -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="10000000"/>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<!-- ABSTRACT PAGE TEMPLATES -->
<definition name="page" template="/WEB-INF/layouts/page.jsp"/>
<!-- PAGES -->
<definition name="home" extends="page">
<put-attribute name="title" value="Welcome to Petclinic" type="string" />
<put-attribute name="content" value="/WEB-INF/home.jsp" type="template" />
</definition>
<!-- APPOINTMENTS PAGES -->
<!-- CALENDAR PAGE -->
<definition name="appointments" extends="page">
<put-attribute name="title" value="Appointments" type="string" />
<put-attribute name="content" value="appointments.content" type="definition" />
</definition>
<definition name="appointments.content" template="/WEB-INF/appointments/content.jsp">
<put-attribute name="main" value="/WEB-INF/appointments/calendar.jsp" type="template" />
</definition>
<!-- ADD NEW PAGE -->
<definition name="appointments/new" extends="page">
<put-attribute name="title" value="Add New Appointment" type="string" />
<put-attribute name="content" value="appointments/new.content" type="definition" />
</definition>
<definition name="appointments/new.content" template="/WEB-INF/appointments/content.jsp">
<put-attribute name="main" value="/WEB-INF/appointments/addNewForm.jsp" type="template" />
</definition>
<!-- OWNERS PAGES -->
<!-- SEARCH PAGE -->
<definition name="owners" extends="page">
<put-attribute name="title" value="Owners" type="string" />
<put-attribute name="content" value="owners.content" type="definition" />
</definition>
<definition name="owners.content" template="/WEB-INF/owners/content.jsp">
<put-attribute name="main" value="/WEB-INF/owners/searchForm.jsp" type="template" />
</definition>
<!-- ADD NEW PAGE -->
<definition name="owners/new" extends="page">
<put-attribute name="title" value="Add New Owner" type="string" />
<put-attribute name="content" value="owners/new.content" type="definition" />
</definition>
<definition name="owners/new.content" template="/WEB-INF/owners/content.jsp">
<put-attribute name="main" value="/WEB-INF/owners/addNewForm.jsp" type="template" />
</definition>
<!-- SEARCH RESULTS PAGE -->
<definition name="owners/search" extends="page">
<put-attribute name="title" value="Owner Search" type="string" />
<put-attribute name="content" value="owners/search.content" type="definition" />
</definition>
<definition name="owners/search.content" template="/WEB-INF/owners/content.jsp">
<put-attribute name="main" value="/WEB-INF/owners/searchResults.jsp" type="template" />
</definition>
<!-- DETAIL PAGE -->
<definition name="owner" extends="page">
<put-attribute name="title" value="Owner" type="string" />
<put-attribute name="content" value="owner.content" type="definition" />
</definition>
<definition name="owner.content" template="/WEB-INF/owners/content.jsp">
<put-attribute name="main" value="/WEB-INF/owners/owner.jsp" type="template" />
</definition>
</tiles-definitions>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<urlrewrite default-match-type="wildcard">
<rule>
<from>/resources/**</from>
<to>/resources/$1</to>
</rule>
<rule>
<from>/**</from>
<to>/app/$1</to>
</rule>
<outbound-rule>
<from>/app/**</from>
<to>/$1</to>
</outbound-rule>
</urlrewrite>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Enables clean URLs with JSP views e.g. /welcome instead of /app/welcome -->
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Handles all requests into the application -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/*.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Maps all /app requests to the DispatcherServlet for handling -->
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
<!-- Serves static resource content from the webapp root & .jar files such as spring-js.jar -->
<servlet>
<servlet-name>Resources Servlet</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<!-- Map all /resources requests to the Resource Servlet for handling -->
<servlet-mapping>
<servlet-name>Resources Servlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
</web-app>