On Jul 1, 2009, at 6:51 AM, Vicky C. Miller wrote:
We have updated our existing WebObjects application from WO 5.2.4 to
WO
5.4.3 and integrated in Project Wonder. We have hit a problem with
WebObjects 5.4.3 in our application and the dispatchRequest method in
Application class that is a part of the WebObjects request response
loop.
The purpose of this section of our code is to check whether the same
user
who started accessing the application or somebody else is trying to
access
the application in the middle. This check will happen for every page
request. If the logged in user is not the person who is accessing
the page,
then page will be redirected to homepage of solar application.
Does any one have suggestions on resolving this? Below is more
information.
The interesting this is that this problem only occur when we attempt
to log
on using IE 7 or 8 but works fine in Safari and Firefox.
I don't think I understand what the problem is. What exactly is the
problem and what part of the code below is causing it?
Chuck
Problem Location :
In Class Application.java and in method public WOResponse
dispatchRequest(WORequest aRequest)
Problem Code :
public WOResponse dispatchRequest(WORequest aRequest)
{
//here we basically want to capture one recently served perfect
request, so to get to this, we'll check the request as follows.
if(recentlyServedPerfectReq == null ||
canResetRecentlyServedPerfectReq ||
(recentlyServedPerfectReq.sessionID() !=
null && aRequest.sessionID() != null
&&
recentlyServedPerfectReq.sessionID().equals(aRequest.sessionID())
== false))
{
recentlyServedPerfectReq = aRequest;
canResetRecentlyServedPerfectReq =
(recentlyServedPerfectReq.sessionID() == null);
}
//added for bug# 313(07/11/2007, MSK) -- end
// first check if the session is created for this Request
// Session not created means, first time user
if(aRequest.sessionID() == null || (aRequest.sessionID() !=
null &&
aRequest.formValueForKey(".loginPage") != null) ||
(aRequest.sessionID() !=
null && aRequest.formValueForKey(".homePage") != null) ||
(aRequest.sessionID() != null &&
aRequest.formValueForKey(".exitPage") !=
null)){
//This is the case where the session is not created Yet
or the
first page is not LoginPage
return super.dispatchRequest(aRequest);
}else if(aRequest.sessionID() != null &&
aRequest.cookieValueForKey(aRequest.sessionID()) != null){
// This is the case where the session is created and
there is a
cookie created in this request
// check to see if the cookie matches the one that's set
String userNameInSes = "";
String hostNameInReq = "";
String cookieValue =
aRequest.cookieValueForKey(aRequest.sessionID());
if(this.sessionStore() != null &&
this
.sessionStore().restoreSessionWithID(aRequest.sessionID(),aRequest) !=
null){
userNameInSes =
((Session
)this.sessionStore().restoreSessionWithID(aRequest.sessionID(),aReq
uest)).loginUser().fullName();
hostNameInReq = getHostNameFromRequest(aRequest);
//System.out.println(" Cookie Value Constructed from
session
and request values= " + userNameInSes+hostNameInReq);
// check to see if the value of cookie is same as that
obtained now
if((userNameInSes+hostNameInReq).equals(cookieValue)){
// success. Send the user to the respective Page
return super.dispatchRequest(aRequest);
}
}
}
// Any of the case doesn'e match, send the user to the login
Page.
WOResponse res = new WOResponse();
WOComponent redirectPage =
pageWithName("Main",createContextForRequest(aRequest));
WOResponse resp = redirectPage.generateResponse();
res.setContent(resp.contentString());
//res.setContent("<html><body><h1>Error</h1></body></html>");
return res;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-deploy mailing list (Webobjects-
dep...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-deploy/chill%40global-village.net
This email sent to ch...@global-village.net
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-deploy mailing list (Webobjects-deploy@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-deploy/archive%40mail-archive.com
This email sent to arch...@mail-archive.com