public class RestController extends Object
Modifier | Constructor and Description |
---|---|
protected |
RestController() |
protected |
RestController(ResponseHelper response) |
Modifier and Type | Method and Description |
---|---|
protected void |
addObject2Request(String name,
Object object)
Deprecated.
Use putParam(String name, Object object)
|
String |
getExtension()
Gets the URL extension, if any.
|
protected String |
getId()
Gets the value of an Id for the current resource.
/sessions/1 -> Id: 1, identifier of 'session' /sessions/1/users/2 -> Id: 2, identifier of 'users' |
protected String |
getId(String resource)
Gets the value of an Id given its resource's name.
/sessions/1 -> Id: 1, Resource: session /sessions/1/users/2 -> Id: 2, Resource: user |
protected Object |
getParam(String name)
Gets a the value of a parameter that came in the URL or in the request.
|
protected Map<String,Object> |
getParams()
Gets a Map containing all the parameters in the query string, and all the
attributes in the request.
|
protected String |
getRemoteAddress()
Returns the remote address with including protocol.
|
ResponseHelper |
getResponseHelper()
Gets the ResponseHelper associated to the request.
When a controller's action is called, a ResponseHelper is set through RestController.setResponseHelper(ResponseHelper response) so the action method will be able to access objects like HttpServletResponse, ServletContext and HttpServletRequest. |
String |
getSerializer()
Gets the Serializer class, if any.
|
protected String |
getStringParam(String name)
Returns parameter's value that is a String.
|
protected void |
putParam(String name,
Object object)
Adds an object to the request.
|
void |
renderPage()
Renders the predefined page.
|
void |
renderPage(String page)
Renders some page within 'views' directory.
|
void |
renderPage(String resource,
String page)
Renders a page from a resource.
|
void |
serialize(Object object)
Serialize an object.
|
void |
setResponseHelper(ResponseHelper response) |
protected RestController()
protected RestController(ResponseHelper response)
public void setResponseHelper(ResponseHelper response)
public ResponseHelper getResponseHelper()
protected Map<String,Object> getParams()
protected Object getParam(String name)
protected void addObject2Request(String name, Object object)
name
- Parameter nameobject
- Object to put in the requestprotected void putParam(String name, Object object)
name
- Parameter nameobject
- Object to put in the requestprotected String getRemoteAddress()
protected String getStringParam(String name)
name
- Parameter's name.ClassCastException
- if the value is not a String
.protected String getId()
protected String getId(String resource)
public void renderPage() throws IOException
IOException
- if the page doesn't exist.public void renderPage(String page) throws IOException
page
- The page could have an extension or not. If it doesn't have an
extension, the framework first looks for page.jsp, then .html
or .htm extension.IOException
- if the page doesn't exist.public void renderPage(String resource, String page) throws IOException
resource
- The name of the resource (bank, account, etc...). It must
exists below /views directory.page
- The page can have an extension or not. If it doesn't have an
extension, the framework first looks for page.jsp, then with
.html or .htm extension.IOException
- if the page doesn't exist.public void serialize(Object object)
object
- Object to serialize.public String getExtension()
public String getSerializer()
Copyright © 2012 ElPaso Software. All Rights Reserved.