|
| AbstractDirect () |
|
boolean | isRedirectToCurrent () |
|
void | setRedirectToCurrent (boolean redirectToCurrent) |
|
String | createFormAction () |
|
String | createPOST (String values) |
|
String | getAjaxSubmitUrl (String containerId) |
|
String | getAjaxUrl (String containerId, String values) |
|
String | getAjaxUrl (String containerId, KeyValueMap values) |
|
String | getAjaxEvalUrl (KeyValueMap values) |
|
String | createRightNowURL (String values) |
|
String | createRightNowURL (KeyValueMap values) |
|
String | createLinkTo (String link, KeyValueMap values) |
|
String | createURL () |
|
String | createURL (IConstructor constructor, String values) |
|
String | createURL (IConstructor constructor, String values, int daysValid) |
|
String | createURL (IConstructor constructor, String values, int daysValid, boolean withDomain) |
|
String | createURL (IConstructor constructor, IContact recipe, String values, int daysValid, boolean withDomain) |
|
String | createURL (IConstructor constructor, IContact recipe, KeyValueMap values, int daysValid, boolean withDomain) |
|
boolean | itsMe (String id) |
|
boolean | myTurn (HttpServletRequest request) |
|
void | execute (ServletContext context, HttpServletRequest request, HttpServletResponse response) |
|
void | execute (IConstructor constructor) |
|
◆ AbstractDirect()
org.turro.elephant.direct.AbstractDirect.AbstractDirect |
( |
| ) |
|
◆ createFormAction()
String org.turro.elephant.direct.AbstractDirect.createFormAction |
( |
| ) |
|
◆ createJsonItem()
JsonObjectBuilder org.turro.elephant.direct.AbstractDirect.createJsonItem |
( |
String |
itemElement, |
|
|
Object |
item |
|
) |
| |
|
protected |
Definition at line 198 of file AbstractDirect.java.
199 if(item instanceof String) {
200 return Json.createObjectBuilder().add(itemElement, (String) item);
201 }
else if(item instanceof Double) {
202 return Json.createObjectBuilder().add(itemElement, (Double) item);
203 }
else if(item instanceof Integer) {
204 return Json.createObjectBuilder().add(itemElement, (Integer) item);
205 }
else if(item instanceof Boolean) {
206 return Json.createObjectBuilder().add(itemElement, (Boolean) item);
208 return Json.createObjectBuilder().add(itemElement, item.toString());
◆ createLinkTo()
String org.turro.elephant.direct.AbstractDirect.createLinkTo |
( |
String |
link, |
|
|
KeyValueMap |
values |
|
) |
| |
Definition at line 140 of file AbstractDirect.java.
141 return ElephantContext.getRootWebPath() +
142 link +
"?" + Actions.createAction(values);
◆ createPOST()
String org.turro.elephant.direct.AbstractDirect.createPOST |
( |
String |
values | ) |
|
Definition at line 65 of file AbstractDirect.java.
66 return "$.post('" + ElephantContext.getRootWebPath() + DirectContents.DIRECT_CONTENT_PATH +
getIdentifier() +
"'," +
67 "{ exrino : '" + Actions.createRightNowParameter(values) +
"' })";
◆ createRightNowURL() [1/2]
String org.turro.elephant.direct.AbstractDirect.createRightNowURL |
( |
KeyValueMap |
values | ) |
|
Definition at line 134 of file AbstractDirect.java.
135 return ElephantContext.getRootWebPath() +
137 "?" + Actions.createRightNowAction(values);
◆ createRightNowURL() [2/2]
String org.turro.elephant.direct.AbstractDirect.createRightNowURL |
( |
String |
values | ) |
|
Definition at line 125 of file AbstractDirect.java.
128 }
catch (ParserException ex) {
129 Logger.getLogger(
AbstractDirect.class.getName()).log(Level.SEVERE,
null, ex);
String createRightNowURL(String values)
◆ createURL() [1/6]
String org.turro.elephant.direct.AbstractDirect.createURL |
( |
| ) |
|
◆ createURL() [2/6]
String org.turro.elephant.direct.AbstractDirect.createURL |
( |
IConstructor |
constructor, |
|
|
IContact |
recipe, |
|
|
KeyValueMap |
values, |
|
|
int |
daysValid, |
|
|
boolean |
withDomain |
|
) |
| |
Definition at line 171 of file AbstractDirect.java.
172 values.put(Actions.USER_PAR, recipe.getConnector(IUser.CONNECTOR_EMAIL));
173 if(redirectToCurrent) values.put(Actions.REDIR_PAR,
getRedirContext(constructor, withDomain));
174 return (withDomain ? ElephantContext.getServerBase(
"http") :
"") +
175 ElephantContext.getRootWebPath() +
177 "?" + Actions.createAction(values, daysValid,
false);
String getRedirContext(IConstructor constructor, boolean withDomain)
◆ createURL() [3/6]
String org.turro.elephant.direct.AbstractDirect.createURL |
( |
IConstructor |
constructor, |
|
|
IContact |
recipe, |
|
|
String |
values, |
|
|
int |
daysValid, |
|
|
boolean |
withDomain |
|
) |
| |
Definition at line 162 of file AbstractDirect.java.
164 return createURL(constructor, recipe,
new KeyValueMap(values), daysValid, withDomain);
165 }
catch (ParserException ex) {
166 Logger.getLogger(
AbstractDirect.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ createURL() [4/6]
String org.turro.elephant.direct.AbstractDirect.createURL |
( |
IConstructor |
constructor, |
|
|
String |
values |
|
) |
| |
◆ createURL() [5/6]
String org.turro.elephant.direct.AbstractDirect.createURL |
( |
IConstructor |
constructor, |
|
|
String |
values, |
|
|
int |
daysValid |
|
) |
| |
◆ createURL() [6/6]
String org.turro.elephant.direct.AbstractDirect.createURL |
( |
IConstructor |
constructor, |
|
|
String |
values, |
|
|
int |
daysValid, |
|
|
boolean |
withDomain |
|
) |
| |
◆ doExecute()
abstract void org.turro.elephant.direct.AbstractDirect.doExecute |
( |
IConstructor |
constructor, |
|
|
KeyValueMap |
map |
|
) |
| |
|
abstractprotected |
◆ execute() [1/2]
void org.turro.elephant.direct.AbstractDirect.execute |
( |
IConstructor |
constructor | ) |
|
Definition at line 239 of file AbstractDirect.java.
240 KeyValueMap map = Actions.isRightNowAction(constructor) ?
241 Actions.getRightNowAction(constructor) :
242 Actions.getAction(constructor);
243 if(map ==
null &&
"POST".equals(constructor.getRequest().getMethod())) {
244 map =
new KeyValueMap(Collections.EMPTY_MAP);
245 if(
"application/json".equals(constructor.getRequest().getHeader(
"Content-Type"))) {
247 map.put(
"json", IOUtils.toString(constructor.getRequest().getReader()));
248 }
catch (IOException ex) {
249 Logger.getLogger(
AbstractDirect.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
252 for(String key : constructor.getRequest().getParameterMap().keySet()) {
253 map.put(key, constructor.getRequest().getParameter(key));
259 String redirect = map.get(Actions.REDIR_PAR);
260 if(!Strings.isBlank(redirect)) {
262 constructor.redirect(redirect);
263 }
catch (IOException ex) {
264 Logger.getLogger(
AbstractDirect.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
abstract void doExecute(IConstructor constructor, KeyValueMap map)
◆ execute() [2/2]
void org.turro.elephant.direct.AbstractDirect.execute |
( |
ServletContext |
context, |
|
|
HttpServletRequest |
request, |
|
|
HttpServletResponse |
response |
|
) |
| |
◆ generateJson()
String org.turro.elephant.direct.AbstractDirect.generateJson |
( |
String |
rootElement, |
|
|
String |
itemElement, |
|
|
List |
results |
|
) |
| |
|
protected |
Definition at line 190 of file AbstractDirect.java.
191 JsonObjectBuilder builder = Json.createObjectBuilder();
192 JsonArrayBuilder array = Json.createArrayBuilder();
194 builder.add(rootElement, array);
195 return builder.build().toString();
JsonObjectBuilder createJsonItem(String itemElement, Object item)
◆ getAjaxEvalUrl()
String org.turro.elephant.direct.AbstractDirect.getAjaxEvalUrl |
( |
KeyValueMap |
values | ) |
|
Definition at line 119 of file AbstractDirect.java.
120 return "$.post('" + ElephantContext.getRootWebPath() + DirectContents.DIRECT_CONTENT_PATH +
getIdentifier() +
"'," +
121 "{ exrino : '" + Actions.createRightNowParameter(values) +
"' })" +
122 ".done(function(data) { eval(data); });";
◆ getAjaxSubmitUrl()
String org.turro.elephant.direct.AbstractDirect.getAjaxSubmitUrl |
( |
String |
containerId | ) |
|
FORM with id = 'form_containerId
'. Must have a hidden input with domid = containerId
, to resolve the container when is false while rendering and a hidden input with type
value, to differentiate the action to process. A container with id = containerId
must exist
- Parameters
-
containerId | identifier created when render container is true |
- Returns
- The URL to use in the submit button
Definition at line 80 of file AbstractDirect.java.
81 return "$.post('" + ElephantContext.getRootWebPath() + DirectContents.DIRECT_CONTENT_PATH +
getIdentifier() +
"'," +
82 "$('#form_" + containerId +
"').serialize())" +
83 ".done(function(data) { $('#" + containerId +
"').html(data); });" +
◆ getAjaxUrl() [1/2]
String org.turro.elephant.direct.AbstractDirect.getAjaxUrl |
( |
String |
containerId, |
|
|
KeyValueMap |
values |
|
) |
| |
Ajax action with values passed in the URL. Includes domid = containerId
, to resolve the container when is false while rendering.
- Parameters
-
containerId | identifier created when render container is true |
values | Map values to encrypt |
- Returns
- The URL to use in the onclick event
Definition at line 112 of file AbstractDirect.java.
113 values.put(
"domid", containerId);
114 return "$.post('" + ElephantContext.getRootWebPath() + DirectContents.DIRECT_CONTENT_PATH +
getIdentifier() +
"'," +
115 "{ exrino : '" + Actions.createRightNowParameter(values) +
"' })" +
116 ".done(function(data) { $('#" + containerId +
"').html(data); });";
◆ getAjaxUrl() [2/2]
String org.turro.elephant.direct.AbstractDirect.getAjaxUrl |
( |
String |
containerId, |
|
|
String |
values |
|
) |
| |
Ajax action with values passed in the URL. Includes domid = containerId
, to resolve the container when is false while rendering.
- Parameters
-
containerId | identifier created when render container is true |
values | Values in format name=value separated by semicolon |
- Returns
- The URL to use in the onclick event
Definition at line 95 of file AbstractDirect.java.
97 return getAjaxUrl(containerId,
new KeyValueMap(values));
98 }
catch (ParserException ex) {
99 Logger.getLogger(AbstractDirectContentCtrl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(values), ex);
String getAjaxUrl(String containerId, String values)
◆ getIdentifier()
abstract String org.turro.elephant.direct.AbstractDirect.getIdentifier |
( |
| ) |
|
|
abstractprotected |
◆ getRedirContext()
String org.turro.elephant.direct.AbstractDirect.getRedirContext |
( |
IConstructor |
constructor, |
|
|
boolean |
withDomain |
|
) |
| |
|
protected |
Definition at line 180 of file AbstractDirect.java.
182 return ElephantContext.getServerBase(
"http") + constructor.getCurrentContext().getWebPath();
184 return constructor.getCurrentContext().getPath();
◆ isRedirectToCurrent()
boolean org.turro.elephant.direct.AbstractDirect.isRedirectToCurrent |
( |
| ) |
|
◆ itsMe()
boolean org.turro.elephant.direct.AbstractDirect.itsMe |
( |
String |
id | ) |
|
◆ myTurn()
boolean org.turro.elephant.direct.AbstractDirect.myTurn |
( |
HttpServletRequest |
request | ) |
|
◆ setRedirectToCurrent()
void org.turro.elephant.direct.AbstractDirect.setRedirectToCurrent |
( |
boolean |
redirectToCurrent | ) |
|
◆ writeJsonResponse()
void org.turro.elephant.direct.AbstractDirect.writeJsonResponse |
( |
HttpServletResponse |
response, |
|
|
String |
json |
|
) |
| |
|
protected |
Definition at line 212 of file AbstractDirect.java.
214 response.setContentType(
"application/json");
216 response.getWriter().write(json);
217 }
catch (IOException ex) {
218 Logger.getLogger(AbstractDirectQuery.class.getName()).log(Level.SEVERE,
null, ex);
The documentation for this class was generated from the following file: