Created
January 4, 2013 21:26
-
-
Save ojacobson/4456217 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<!-- ... --> | |
<p>${fn:escapeXml(it)}</p> <%-- 'it' is defined by Jersey's glue from the 2nd arg --%> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<web-app 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://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_3_0.xsd" | |
version="3.0"> | |
<listener> | |
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> | |
</listener> | |
<listener> | |
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> | |
</listener> | |
<filter> | |
<filter-name>springSecurityFilterChain</filter-name> | |
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> | |
</filter> | |
<filter-mapping> | |
<filter-name>springSecurityFilterChain</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> | |
<filter> | |
<filter-name>ds.Jersey</filter-name> | |
<filter-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</filter-class> | |
<init-param> | |
<param-name>com.sun.jersey.config.property.JSPTemplatesBasePath</param-name> | |
<param-value>/WEB-INF/jsp</param-value> | |
</init-param> | |
<init-param> | |
<!-- Treat any random URL ending in "foo.bar" as non-Jersey content. Dots are only | |
treated magically in the trailing path segment. --> | |
<param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name> | |
<param-value>\A((.*/)?[^/.]*\.[^/]*)|(/session/.*)\Z</param-value> | |
</init-param> | |
</filter> | |
<filter-mapping> | |
<filter-name>ds.Jersey</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> | |
<servlet> | |
<servlet-name>ds.Login</servlet-name> | |
<jsp-file>/WEB-INF/jsp/session/login.jsp</jsp-file> | |
</servlet> | |
<servlet-mapping> | |
<servlet-name>ds.Login</servlet-name> | |
<url-pattern>/session/login</url-pattern> | |
</servlet-mapping> | |
<error-page> | |
<error-code>404</error-code> | |
<location>/WEB-INF/jsp/error/404.jsp</location> | |
</error-page> | |
<jsp-config> | |
<jsp-property-group> | |
<url-pattern>*.jsp</url-pattern> | |
<page-encoding>UTF-8</page-encoding> | |
<trim-directive-whitespaces>true</trim-directive-whitespaces> | |
</jsp-property-group> | |
</jsp-config> | |
<session-config> | |
<!-- Try to avoid prematurely murdering sessions while someone is playing. | |
This is not a replacement for remember-me authentication, but it helps avoid | |
re-authenticating unnecessarily. --> | |
<session-timeout>120</session-timeout> | |
<!-- Never use URL-based session tracking. Ever. Even a little. --> | |
<tracking-mode>COOKIE</tracking-mode> | |
</session-config> | |
</web-app> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.web; | |
import java.net.URI; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.core.MediaType; | |
import javax.ws.rs.core.UriInfo; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.stereotype.Service; | |
import com.sun.jersey.api.view.Viewable; | |
/** | |
* Presents the welcome page at the application's root URL. | |
*/ | |
@Controller | |
@Path("/") | |
public class Welcome { | |
/** | |
* Displays the welcome page. | |
* | |
* @return the welcome page. | |
*/ | |
@GET | |
@Produces(MediaType.TEXT_HTML) | |
public Viewable index() { | |
return new Viewable("/index", "Hello, world!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment