Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting old url form applet

 
amol sambhaji phadke
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In our application we are using applet for license verification on users machine.When the user enters a serial number for search the request goes to the servlet,here we check whether the license available falg is set in the users session,If the flag is not set then we are are calling the applet for license verification.Before that we are placing the serial number entered by user in the property file which is serialized and sent to the applet.Applet verifies the license on users machine and takes the serial number from that property file and makes the request to servlet to display the search result and the applet gets destroyed.Now when user clicks the search againg button after session time out and enters another serial number for search,As session is timed out the request again goes to applet for license verification by placing the new serial number entered by user in property file which is being serialized and sent to applet,But here the applet instead of making the request to servlet with new serial number,it makes the request with old serial number enterd by user before.We are not able to figure out how the applet is getting the old serial number and making the request.

I tried to reset the ObjectOutPutStream as well as response object,But its is giving same problem.And as we are not having source code of applet we are using its jar file.Its very difficult to figure out what is the actuall problem.

Please help me.

Thanks in advance.
Amol.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are placing the serial number entered by user in the property file which is serialized and sent to the applet

How does this work? Files can't be serialized, so how does this information get to the client?
 
amol sambhaji phadke
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually we are reading the property file by using BufferedInputStream and writing it to a ByteArrayOutputStream which is then converted to byte array and this byte array is added to the vector ,This vector is then serialized and sent to the applet.

The code for which is as below :
public Vector getAppletPropertyFile(String path)
{
//LicenseMgmtBroker lic = new LicenseMgmtBroker();
Vector vProp = new Vector();
/**
* loads or reloads the LMApplet.properties file
*/

appletProperties = new Properties();

try
{
/**
* gets the Property file path
*/
//int iPath = (path.lastIndexOf(".")) - 3;
//String substring = path.substring(0, iPath);
//12-2-2003 DJJ This really should be changed to use the IAF calls
int iPath = (path.lastIndexOf("\\"));
if(iPath < 0)
{
iPath = (path.lastIndexOf("/"));
}
String substring = path.substring(0, iPath + 1);
String aFile = substring + propertyFileName + FILE_EXTENSION;

FileInputStream aFileInputStream = new FileInputStream(aFile);

/**
* Load the property file
*/
appletProperties.load(aFileInputStream);

/**
* If aFileInputStream is null then return -1 else 0
*/

if (aFileInputStream == null)
vProp.addElement(new Integer(-1));
else
vProp.addElement(new Integer(0));

vProp.addElement(appletProperties);

aFileInputStream.close();

/**
* Reads the HostId Program
*/

/**
* gets the HostId.exe path
*/
String hPath = substring + fileNameHostId + FILE_EXTENSION_HOSTID;

BufferedInputStream ghidInputStream =
new BufferedInputStream(new FileInputStream(hPath));
ByteArrayOutputStream ghidBAOStream = new ByteArrayOutputStream();

/**
* Read the contents of the current file
*/
byte yaData[] = new byte[ONE_BLOCK_OF_DATA];
int iReadBytes = 0;
while ((iReadBytes =
ghidInputStream.read(yaData, 0, ONE_BLOCK_OF_DATA))
> 0)
{
ghidBAOStream.write(yaData, 0, iReadBytes);
}
ghidInputStream.close();
vProp.addElement(new Integer(0));
vProp.addElement(ghidBAOStream.toByteArray());
ghidBAOStream.close();
}
catch (IOException ex)
{
Application.GetLog().writeInformation(
"FATAL ERROR - An IOException occured while reading a file - getAppletPropertyFile()"
+ ex);
}
catch (Exception ex)
{
Application.GetLog().writeInformation(
"FATAL ERROR - An Exception occured while writing a valid response object - getAppletPropertyFile()"
+ ex);
}

Application.GetLog().writeInformation(
"INFO - Loaded Applet properties successfully!");
return vProp;
}

Thanks for looking into the problem and sorry for miss writing.

Amol
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic