|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.xweb.util.BasicXwebHelper magoffin.matt.ma2.web.util.WebHelper
public final class WebHelper
Utility methods for web layer.
The configurable properties of this class are:
UserBiz
implementation to use.
Constructor Summary | |
---|---|
WebHelper()
|
Method Summary | |
---|---|
void |
clearSavedRequestURL(javax.servlet.http.HttpServletRequest request)
Remove the saved session URL. |
static void |
clearSaveRequestURLFlag(javax.servlet.http.HttpServletRequest request)
Clear the flag indicating the saved session URL should not be cleared on this request. |
void |
clearUserSessionData(javax.servlet.http.HttpServletRequest request)
Remove all user session data. |
JobInfo |
createJobInfo(BizContext context,
java.lang.Long ticket)
Create a JobInfo instance from a WorkInfo instance. |
BizContext |
getAdminBizContext(javax.servlet.http.HttpServletRequest request)
Get an admin-level BizContext for the current request. |
BizContext |
getAnonymousBizContext(javax.servlet.http.HttpServletRequest request)
Get a BizContext for the current request that can be an anonymous user even if anonymous features are disabled. |
BizContext |
getBizContext(javax.servlet.http.HttpServletRequest request,
boolean userRequired)
Get a BizContext for the current request. |
BizContext |
getBizContextWithViewSettings(javax.servlet.http.HttpServletRequest request)
Get a BizContext for the current request, checking that a Session
object exists on the HttpSession. |
java.lang.String |
getDatePattern()
|
java.util.TimeZone |
getDateTimeZone()
|
DomainObjectFactory |
getDomainObjectFactory()
|
MediaBiz |
getMediaBiz()
|
org.springframework.context.MessageSource |
getMessageSource()
|
Theme |
getRequestTheme()
Get the saved theme from the current request. |
SystemBiz |
getSystemBiz()
|
UserBiz |
getUserBiz()
|
Session |
getUserSession(javax.servlet.http.HttpServletRequest request)
Get the Session from the current session. |
java.lang.Long[] |
getUserWorkTickets(javax.servlet.http.HttpServletRequest request)
Get a list of work tickets for the current user. |
WorkBiz |
getWorkBiz()
|
static boolean |
isSaveRequestURL(javax.servlet.http.HttpServletRequest request)
Return true if the save request URL flag is currently set. |
void |
populateMediaSizeAndQuality(java.util.List<MediaSizeDefinition> list)
Add a MediaSizeDefinition for every MediaSize
in the system. |
void |
populateModelWorkInfo(javax.servlet.http.HttpServletRequest request,
WorkBiz.WorkInfo workInfo,
java.util.Map<java.lang.String,java.lang.Object> model)
Populate data from a WorkInfo instance onto a model Map. |
void |
saveAnonymousUserSession(javax.servlet.http.HttpServletRequest request,
MediaSpec thumbnailSpec,
MediaSpec viewSpec)
Save an anonymous user session. |
void |
saveRequestTheme(Theme theme)
Save a theme for the current request. |
void |
saveUserSession(javax.servlet.http.HttpServletRequest request,
User user)
Save the action user to session. |
void |
setDatePattern(java.lang.String datePattern)
|
void |
setDateTimeZone(java.util.TimeZone dateTimeZone)
|
void |
setDomainObjectFactory(DomainObjectFactory domainObjectFactory)
|
void |
setMediaBiz(MediaBiz mediaBiz)
|
void |
setMessageSource(org.springframework.context.MessageSource messageSource)
|
static void |
setSaveRequestURLFlag(javax.servlet.http.HttpServletRequest request)
Set a flag indicating the saved session URL should not be cleared on this request. |
void |
setSystemBiz(SystemBiz systemBiz)
|
void |
setUserBiz(UserBiz userBiz)
|
void |
setWorkBiz(WorkBiz workBiz)
|
Methods inherited from class magoffin.matt.xweb.util.BasicXwebHelper |
---|
clearSavedMessage, getAppContextSupport, getSavedMessage, getSavedRequestURL, saveMessage, saveRequestURL |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WebHelper()
Method Detail |
---|
public JobInfo createJobInfo(BizContext context, java.lang.Long ticket)
context
- the contextticket
- the requested ticket number
public void saveRequestTheme(Theme theme)
theme
- the theme to save forpublic Theme getRequestTheme()
public BizContext getBizContextWithViewSettings(javax.servlet.http.HttpServletRequest request)
Session
object exists on the HttpSession.
request
- the request
NoUserSessionException
- if no Session
is available in the
HttpSessionpublic BizContext getBizContext(javax.servlet.http.HttpServletRequest request, boolean userRequired)
If the userRequired
parameter is true then an
AuthorizationException
will be thrown with a
AuthorizationException.Reason.ANONYMOUS_ACCESS_DENIED
if the current request
is for an anonymous user.
request
- the current requestuserRequired
- if true then a logged-in user must be on the current
request, otherwise an AuthorizationException
will be thrown
AuthorizationException
- if userRequired is true and
no user exists on the current requestpublic BizContext getAdminBizContext(javax.servlet.http.HttpServletRequest request)
If the current request is for an anonymous user, then an
AuthorizationException
will be thrown with a
AuthorizationException.Reason.ANONYMOUS_ACCESS_DENIED
reason. If the current
request is for a logged in user that does not have admin
priveleges, an AuthorizationException
will be thrown with
a AuthorizationException.Reason.ACCESS_DENIED
reason.
request
- the current request
public BizContext getAnonymousBizContext(javax.servlet.http.HttpServletRequest request)
This can be used by actions that can be performed even if anonymous features are disabled, such as self registration.
request
- the current request
public void saveUserSession(javax.servlet.http.HttpServletRequest request, User user)
This method will save the user
instance to session, allowing
the application to maintain a logged-in state for the user. The user is
added to a Session
instance as the actingUser
property. If the user has the UserBiz.ACCESS_ADMIN
permission bit set
the admin
property of the Session
will be set
to true.
request
- the current requestuser
- the User to save in sessionpublic void saveAnonymousUserSession(javax.servlet.http.HttpServletRequest request, MediaSpec thumbnailSpec, MediaSpec viewSpec)
request
- the requestthumbnailSpec
- the MediaSpec to use for thumbnail itemsviewSpec
- the MediaSpec to use for full-size itemspublic void clearUserSessionData(javax.servlet.http.HttpServletRequest request)
This method simply invalidates the current session (if available).
request
- the current reqeustpublic Session getUserSession(javax.servlet.http.HttpServletRequest request)
Session
from the current session.
request
- the current request
public static final void setSaveRequestURLFlag(javax.servlet.http.HttpServletRequest request)
request
- the current requestpublic static final boolean isSaveRequestURL(javax.servlet.http.HttpServletRequest request)
request
- the current request
public static final void clearSaveRequestURLFlag(javax.servlet.http.HttpServletRequest request)
request
- the current requestpublic void clearSavedRequestURL(javax.servlet.http.HttpServletRequest request)
request
- the current requestpublic java.lang.Long[] getUserWorkTickets(javax.servlet.http.HttpServletRequest request)
This method will only return tickets for jobs that the WorkBiz
returns job information for. Tickets that do not have any job information
associated with them will be pruned from the user's list of tickets and
not returned.
request
- the request
public void populateModelWorkInfo(javax.servlet.http.HttpServletRequest request, WorkBiz.WorkInfo workInfo, java.util.Map<java.lang.String,java.lang.Object> model)
request
- the request, so can save the ticket into sessionworkInfo
- the WorkInfomodel
- the model Mappublic void populateMediaSizeAndQuality(java.util.List<MediaSizeDefinition> list)
MediaSizeDefinition
for every MediaSize
in the system.
list
- the list to add MediaSizeDefinition objects topublic UserBiz getUserBiz()
public void setUserBiz(UserBiz userBiz)
userBiz
- The userBiz to set.public java.lang.String getDatePattern()
public void setDatePattern(java.lang.String datePattern)
datePattern
- the datePattern to setpublic java.util.TimeZone getDateTimeZone()
public void setDateTimeZone(java.util.TimeZone dateTimeZone)
dateTimeZone
- the dateTimeZone to setpublic DomainObjectFactory getDomainObjectFactory()
public void setDomainObjectFactory(DomainObjectFactory domainObjectFactory)
domainObjectFactory
- the domainObjectFactory to setpublic WorkBiz getWorkBiz()
public void setWorkBiz(WorkBiz workBiz)
workBiz
- the workBiz to setpublic org.springframework.context.MessageSource getMessageSource()
public void setMessageSource(org.springframework.context.MessageSource messageSource)
messageSource
- the messageSource to setpublic SystemBiz getSystemBiz()
public void setSystemBiz(SystemBiz systemBiz)
systemBiz
- the systemBiz to setpublic MediaBiz getMediaBiz()
public void setMediaBiz(MediaBiz mediaBiz)
mediaBiz
- the mediaBiz to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |