If you get this error :
An internal error occurred during: "Launching baru".
Can't find resource for bundle java.util.PropertyResourceBundle, key CANNOT_PLAY_SCRIPT
Just restart your developer suit
It works for me :D
Monday, November 19, 2007
Friday, November 16, 2007
Prefix URL
We should declare prefix URL as global variable
For example :
public final static byte[] prefix = { '/', 'm', 's', 'g' };
this prefix will be called by one or more html pages
Here is example for form with post action
action="msg"
or href URL :
href="msg"
Afterwards, we should add it in SCWS container. Type it in your servlet constructor.
servletContainer.add(this, new ByteString(prefix));
For example :
public final static byte[] prefix = { '/', 'm', 's', 'g' };
this prefix will be called by one or more html pages
Here is example for form with post action
action="msg"
or href URL :
href="msg"
Afterwards, we should add it in SCWS container. Type it in your servlet constructor.
servletContainer.add(this, new ByteString(prefix));
Put your sensitive variable in RAM
// declare variable
byte[] requestParameterBuffer;
// allocate it in RAM , ensure the memory length
requestParameterBuffer = JCSystem.makeTransientByteArray(
(short) (queryString.length() * 2), JCSystem.CLEAR_ON_RESET);
JCSystem reset / clean memoryOptions :
byte[] requestParameterBuffer;
// allocate it in RAM , ensure the memory length
requestParameterBuffer = JCSystem.makeTransientByteArray(
(short) (queryString.length() * 2), JCSystem.CLEAR_ON_RESET);
JCSystem reset / clean memoryOptions :
- JCSystem.CLEAR_ON_DESELECT
- JCSystem.CLEAR_ON_RESET
Static .. Static Variable
Here are smart card programming rules :
- It is better to use static variable then use instance variable.
- Constants variable should be declare as static final variable
- Local variable is accessed faster than global variable
public static final byte[] PARAMETER = { 'P', 'a', 'r', 'a', 'm', 'e', 't','e', 'r', ' ', ':', ' ' };
public final static byte[] PROTOCOL = { 'P', 'r', 'o', 't', 'o', 'c', 'o', 'l', ':' };
No String No Integer
I have just known that there is no integer and string in Smart Card program.
So what are the data type ?
So what are the data type ?
- byte
- ByteString
- short
Wednesday, November 14, 2007
doGet()
I wrote my first servlet code in Smart Card Web Server.
Firstly, here is my html code :
and this following code is part of my servlet code :
testing by typing such username
Hey, it works now :D
Firstly, here is my html code :
and this following code is part of my servlet code :
public void doGet(HttpCardServletRequest req, HttpCardServletResponse resp)This is the capture of the result :
throws Exception {
try {
ByteString queryString = req.getQueryString();
if (queryString != null) {
byte[] hello = { 'h', 'e', 'l', 'l','o' ,' '};
ByteString temp=queryString.substring((short)5, queryString.length());
// set header
resp.setStatus(HttpCardServletResponse.SC_OK);
resp.setContentType(stringContainer
.getConstantString(HttpStringContainer.TEXT_PLAIN_KEY));
int length = hello.length+temp.length();
resp.setContentLength(length);
// write body
HttpCardServletOutputStream out = resp.getOutputStream();
out.write(hello,(short)0,(short)hello.length);
out.write(temp);
}
} catch (Exception e) {
resp.setStatus(HttpCardServletResponse.SC_BAD_REQUEST);
}
}
Subscribe to:
Posts (Atom)