|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: |
------------------------------------------ File 1 ----------------------------------------------------
<!-- /WEB-INF/jsp/my.jsp -->
<jsp:useBean id="viewDefinition" scope="request" class="mytld.mycompany.projectpackage.MVC_view.ViewDefinition" />
<jsp:getProperty name="viewDefinition" property="sessionIPAddress"/>
<!-- this works fine -->
------------------------------------------ File 2 ----------------------------------------------------
/** ViewDefiition **/
package mytld.mycompany.projectpackage.MVC_view;
public class ViewDefinition implements java.io.Serializable {
public String sessionIPAddress;
/** * Default Constructor **/
public ViewDefinition() {
}
// and accessor method ::.
public String getSessionIPAddress() {
return sessionIPAddress;
}
// and mutator method ::.
public void setSessionIPAddress(String sessionIPAddress) {
this.sessionIPAddress = sessionIPAddress;
}
} // end class
------------------------------------------ File 3 ----------------------------------------------------
/** Mail notification **/
package mytld.mycompany.projectpackage.MVC_model;
public class MailNotification implements Serializable {
private static final String IP_PATTERN = "${userhostip}";
/** * Default Constructor **/
public MailNotification() {
}
public String getMessage() {
// I know this is WRONG -- it works but blow out other code... Any ideas ?
ViewDefinition ipview = new ViewDefinition();
String reapIP = ipview.getSessionIPAddress();
String text = message;
text = replace(text, IP_PATTERN, reapIP);
return text;
}
} // end class
------------------------------------------ File 4 ----------------------------------------------------
<!-- /WEB-INF/notifications.xml -->
<notification notificationType="EMAIL_IP">
<subject>IP Alert</subject>
<message><![CDATA[
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>IP Notice</title>
</head><body>
<p style="${style}">User's IP: <strong>${userhostip}</strong></p>
</body></html>
]]></message>
<mime_type>text/html</mime_type>
</notification>
------------------------------------------ File 5 ----------------------------------------------------
<!-- /WEB-INF/webconfig.xml -->
<servlet>
<servlet-name>controlservlet</servlet-name>
<servlet-class>mytld.mycompany.projectpackage.controller.ControlServlet</servlet-class>
<init-param>
<description>Email Destination</description>
<param-name>infosecEmail</param-name>
<param-value>myTargetEmail@myDomainName.tld</param-value>
</init-param>
</servlet>
------------------------------------------ File 6 ----------------------------------------------------
/** Processor Class **/
package mytld.mycompany.projectpackage.controller;
import java.io.IOException;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import mytld.mycompany.projectpackage.MVC_model.*;
import mytld.mycompany.projectpackage.MVC_view.*;
try {
MailNotification notification = MailNotification.loadNotification(ctx.getResourceAsStream("/WEB-INF/notifications.xml"), NotificationType.EMAIL_IP);
Util.sendMail(Util.INFOSEC_EMAIL, Util.DEFAULT_FROM, notification.getSubject(), notification.getMessage(resetAccount), notification.getMimeType());
catch (Exception mex) {
mex.printStackTrace();
logger.log(Logger.ERROR, "IP Error +mex.getMessage(), request.getRemoteAddr()); // it works here ? Why cant I pass the HostInetAddress to the Email Message Object ? AUURRGGGHH ! ;)
}
return viewDefinition;
}
break;
|
Advertisement
| Hall of Fame |