fr.paris.lutece.plugins.mvc
Class MVCApplication

java.lang.Object
  extended by fr.paris.lutece.plugins.mvc.MVCApplication
All Implemented Interfaces:
fr.paris.lutece.portal.web.xpages.XPageApplication

public abstract class MVCApplication
extends Object
implements fr.paris.lutece.portal.web.xpages.XPageApplication

MVC XPage Application


Constructor Summary
MVCApplication()
           
 
Method Summary
protected  void addError(String strMessage)
          Add an error message
protected  void addError(String strMessageKey, Locale locale)
          Add an error message
protected  void addInfo(String strMessage)
          Add an info message
protected  void addInfo(String strMessageKey, Locale locale)
          Add an info message
protected  fr.paris.lutece.portal.web.xpages.XPage download(byte[] data, String strFilename, String strContentType)
          Initiates a download of a byte array
 fr.paris.lutece.portal.web.xpages.XPage download(String strData, String strFilename, String strContentType)
          Initiates a file download
protected  void fillCommons(Map<String,Object> model)
          Fill the model with commons objects used in templates
protected  String getAction(javax.servlet.http.HttpServletRequest request)
          Get the action parameter or any parameter with the prefix 'action_'
protected  String getActionUrl(String strAction)
          Get Action URL
protected  String getDefaultPagePath(Locale locale)
          Returns the default page path
protected  String getDefaultPageTitle(Locale locale)
          Returns the default page title
protected  Locale getLocale(javax.servlet.http.HttpServletRequest request)
          Default getLocale() implementation.
protected  Map<String,Object> getModel()
          Get a model Object filled with default values
 fr.paris.lutece.portal.web.xpages.XPage getPage(javax.servlet.http.HttpServletRequest request, int nMode, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns the content of the page
protected  String getView(javax.servlet.http.HttpServletRequest request)
          Get the view parameter
protected  String getViewFullUrl(String strView)
          Gets the view URL with the JSP path
protected  String getViewUrl(String strView)
          Get a View URL
protected  fr.paris.lutece.portal.web.xpages.XPage getXPage()
          Returns a new XPage object with default values
protected  fr.paris.lutece.portal.web.xpages.XPage getXPage(String strTemplate)
          Returns a new XPage object with default values and the content filled by a template
protected  fr.paris.lutece.portal.web.xpages.XPage getXPage(String strTemplate, Locale locale)
          Returns a new XPage object with default values and the content filled by a template using a default model and for a given locale
protected  fr.paris.lutece.portal.web.xpages.XPage getXPage(String strTemplate, Locale locale, Map<String,Object> model)
          Returns a new XPage object with default values and the content filled by a template using a given model and for a given locale
protected  String getXPageName()
          Returns the XPage name
protected  void populate(Object bean, javax.servlet.http.HttpServletRequest request)
          Populate a bean using parameters in http request
protected  fr.paris.lutece.portal.web.xpages.XPage redirect(javax.servlet.http.HttpServletRequest request, String strTarget)
          Redirect to requested page
protected  fr.paris.lutece.portal.web.xpages.XPage redirectMessageBox(javax.servlet.http.HttpServletRequest request, MVCMessageBox messageBox)
          Redirect to a Message Box page
protected  fr.paris.lutece.portal.web.xpages.XPage redirectView(javax.servlet.http.HttpServletRequest request, String strView)
          Redirect to requested view
protected
<T> boolean
validateBean(T bean)
          Validate a bean
protected
<T> boolean
validateBean(T bean, Locale locale)
          Validate a bean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MVCApplication

public MVCApplication()
Method Detail

getPage

public fr.paris.lutece.portal.web.xpages.XPage getPage(javax.servlet.http.HttpServletRequest request,
                                                       int nMode,
                                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
                                                throws fr.paris.lutece.portal.service.message.SiteMessageException
Returns the content of the page

Specified by:
getPage in interface fr.paris.lutece.portal.web.xpages.XPageApplication
Parameters:
request - The http request
nMode - The current mode
plugin - The plugin object
Returns:
The XPage
Throws:
fr.paris.lutece.portal.service.message.SiteMessageException - Message displayed if an exception occurs

getView

protected String getView(javax.servlet.http.HttpServletRequest request)
Get the view parameter

Parameters:
request - The HTTP request
Returns:
The view parameter or null if not found

getAction

protected String getAction(javax.servlet.http.HttpServletRequest request)
Get the action parameter or any parameter with the prefix 'action_'

Parameters:
request - The HTTP request
Returns:
The action parameter or null if not found

getXPageName

protected String getXPageName()
Returns the XPage name

Returns:
The XPage name

getDefaultPageTitle

protected String getDefaultPageTitle(Locale locale)
Returns the default page title

Parameters:
locale - The locale
Returns:
The default page title

getDefaultPagePath

protected String getDefaultPagePath(Locale locale)
Returns the default page path

Parameters:
locale - The locale
Returns:
The default pagepath

getXPage

protected fr.paris.lutece.portal.web.xpages.XPage getXPage()
Returns a new XPage object with default values

Returns:
An XPage Object

getXPage

protected fr.paris.lutece.portal.web.xpages.XPage getXPage(String strTemplate)
Returns a new XPage object with default values and the content filled by a template

Parameters:
strTemplate - The template
Returns:
An XPage Object

getXPage

protected fr.paris.lutece.portal.web.xpages.XPage getXPage(String strTemplate,
                                                           Locale locale)
Returns a new XPage object with default values and the content filled by a template using a default model and for a given locale

Parameters:
strTemplate - The template
locale - The locale
Returns:
An XPage Object

getXPage

protected fr.paris.lutece.portal.web.xpages.XPage getXPage(String strTemplate,
                                                           Locale locale,
                                                           Map<String,Object> model)
Returns a new XPage object with default values and the content filled by a template using a given model and for a given locale

Parameters:
strTemplate - The template
locale - The locale
model - The model
Returns:
An XPage Object

getModel

protected Map<String,Object> getModel()
Get a model Object filled with default values

Returns:
The model

populate

protected void populate(Object bean,
                        javax.servlet.http.HttpServletRequest request)
Populate a bean using parameters in http request

Parameters:
bean - bean to populate
request - http request

validateBean

protected <T> boolean validateBean(T bean)
Validate a bean

Type Parameters:
T - The bean class
Parameters:
bean - The bean
Returns:
true if validated otherwise false

validateBean

protected <T> boolean validateBean(T bean,
                                   Locale locale)
Validate a bean

Type Parameters:
T - The bean class
Parameters:
bean - The bean
locale - The locale
Returns:
true if validated otherwise false

addError

protected void addError(String strMessage)
Add an error message

Parameters:
strMessage - The message

addError

protected void addError(String strMessageKey,
                        Locale locale)
Add an error message

Parameters:
strMessageKey - The message
locale - The locale

addInfo

protected void addInfo(String strMessage)
Add an info message

Parameters:
strMessage - The message

addInfo

protected void addInfo(String strMessageKey,
                       Locale locale)
Add an info message

Parameters:
strMessageKey - The message key
locale - The locale

fillCommons

protected void fillCommons(Map<String,Object> model)
Fill the model with commons objects used in templates

Parameters:
model - The model

redirect

protected fr.paris.lutece.portal.web.xpages.XPage redirect(javax.servlet.http.HttpServletRequest request,
                                                           String strTarget)
Redirect to requested page

Parameters:
request - the http request
strTarget - the targeted page
Returns:
the page requested

redirectView

protected fr.paris.lutece.portal.web.xpages.XPage redirectView(javax.servlet.http.HttpServletRequest request,
                                                               String strView)
Redirect to requested view

Parameters:
request - the http request
strView - the targeted view
Returns:
the page requested

getViewUrl

protected String getViewUrl(String strView)
Get a View URL

Parameters:
strView - The view name
Returns:
The URL

getViewFullUrl

protected String getViewFullUrl(String strView)
Gets the view URL with the JSP path

Parameters:
strView - The view
Returns:
The URL

getActionUrl

protected String getActionUrl(String strAction)
Get Action URL

Parameters:
strAction - The view name
Returns:
The URL

download

public fr.paris.lutece.portal.web.xpages.XPage download(String strData,
                                                        String strFilename,
                                                        String strContentType)
Initiates a file download

Parameters:
strData - Data of the file to download
strFilename - Name of file
strContentType - content type to set to the response
Returns:
The page requested

download

protected fr.paris.lutece.portal.web.xpages.XPage download(byte[] data,
                                                           String strFilename,
                                                           String strContentType)
Initiates a download of a byte array

Parameters:
data - Data to download
strFilename - Name of the downloaded file
strContentType - Content type to set to the response
Returns:
The page requested

redirectMessageBox

protected fr.paris.lutece.portal.web.xpages.XPage redirectMessageBox(javax.servlet.http.HttpServletRequest request,
                                                                     MVCMessageBox messageBox)
Redirect to a Message Box page

Parameters:
request - The HTTP request
messageBox - The MessageBox infos
Returns:
A redirect XPage

getLocale

protected Locale getLocale(javax.servlet.http.HttpServletRequest request)
Default getLocale() implementation. Could be overriden

Parameters:
request - The HTTP request
Returns:
The Locale


Copyright © 2013 Mairie de Paris. All Rights Reserved.