@Component public abstract class AbstractView extends Object
Constructor and Description |
---|
AbstractView() |
Modifier and Type | Method and Description |
---|---|
protected void |
addHeadersIfRestricted(Page page,
HttpServletRequest req,
HttpServletResponse resp)
If the page is restricted and unlocked, send headers so public caches won't cache
the page, but private caches (user-agent) do.
|
protected boolean |
handleRestricted(Page page,
HttpServletRequest req)
Handles page restrictions.
|
protected boolean |
isNotModifiedSince(HttpServletRequest req,
Date date)
Checks that the request sent an "If-Modified-Since" header, and the date matches
the given date.
|
protected boolean |
redirectRestricted(Page page,
HttpServletRequest req,
HttpServletResponse resp)
Redirect to the section's page main view when the page is restricted and has not
been unlocked yet.
|
protected void |
streamDataSource(ResourceDataSource ds,
HttpServletRequest req,
HttpServletResponse resp)
Streams a
ResourceDataSource . |
public AbstractView()
protected boolean handleRestricted(Page page, HttpServletRequest req)
page
- Page
to check for restrictionsreq
- HttpServletRequest
true
, the page is restricted and needs to be unlocked. If
false
, the page either not restricted, or restricted and unlocked.protected void addHeadersIfRestricted(Page page, HttpServletRequest req, HttpServletResponse resp)
page
- Page
to checkreq
- HttpServletRequest
request to be checkedresp
- HttpServletResponse
response to add headers toprotected boolean redirectRestricted(Page page, HttpServletRequest req, HttpServletResponse resp) throws org.shredzone.commons.view.exception.ViewException
page
- Page
that is to be shownreq
- HttpServletRequest
resp
- HttpServletResponse
true
, the page access is restricted and must not be shown to the
user. A redirection to the main page has already been placed.org.shredzone.commons.view.exception.ViewException
protected boolean isNotModifiedSince(HttpServletRequest req, Date date)
req
- HttpServletRequest
to usedate
- Date
to checktrue
: Resource has not changed since it was last deliveredprotected void streamDataSource(ResourceDataSource ds, HttpServletRequest req, HttpServletResponse resp) throws org.shredzone.commons.view.exception.ViewException
ResourceDataSource
. Also cares about setting proper HTTP response
headers.ds
- ResourceDataSource
to streamreq
- HttpServletRequest
resp
- HttpServletResponse
org.shredzone.commons.view.exception.ViewException
Copyright © 2009–2016. All rights reserved.