Security : certifying the source code
Is it possible to certify the source code (.swf) in a
flash/flex application (digital signatures, certificates...)?
Hi,
I have an app that is in a jar file with the .class
files (so no source code).
I'm wondering how difficult it is to attain the
source code from these .class files in my jar?
Looking through the contents of the .class files it
seems there is a large amount of readable text. For
example I see method names, variables, etc.
This leads me to believe these jars are not secure.
What is a better way?
Thanks!
Edit:
Looking around, I've noticed many java decompilers
and Sun even supports a dissembler - javap. I think
this is not cool, haha.
What way can I protect my code? To me, the value of
java just went way down due to the ease at attaining
source code (based on what I read in the past hour or
so. I have yet to try it myself). I wonder if this
impacts companies reasons not to use java?All intellectual property stored in electronic form is vulnerable. Not just Java bytecode. You can use tools called obfuscators to make decompiling more difficult, which is usually good enough. The truth is, no matter how great you think your code is, it's of a lot less interest to others than you actually think. Unless you've got a particularly sexy argorithm or something, it's not really worth worrying too much about
All you can do is make it more difficult for people to crack things, never prevent it. True of all languages, all electronic media
Similar Messages
-
Jars and .class files - security of the source code
Hi,
I have an app that is in a jar file with the .class files (so no source code).
I'm wondering how difficult it is to attain the source code from these .class files in my jar? Looking through the contents of the .class files it seems there is a large amount of readable text. For example I see method names, variables, etc.
This leads me to believe these jars are not secure. What is a better way?
Thanks!
Edit:
Looking around, I've noticed many java decompilers and Sun even supports a dissembler - javap. I think this is not cool, haha.
What way can I protect my code? To me, the value of java just went way down due to the ease at attaining source code (based on what I read in the past hour or so. I have yet to try it myself). I wonder if this impacts companies reasons not to use java?
Edit 2:
I heard that there may be a way to make the jar closed, so you can't say, use winrar, to extract the class files. Does anyone know anything about this?
Message was edited by:
dayrinni
Message was edited by:
dayrinniHi,
I have an app that is in a jar file with the .class
files (so no source code).
I'm wondering how difficult it is to attain the
source code from these .class files in my jar?
Looking through the contents of the .class files it
seems there is a large amount of readable text. For
example I see method names, variables, etc.
This leads me to believe these jars are not secure.
What is a better way?
Thanks!
Edit:
Looking around, I've noticed many java decompilers
and Sun even supports a dissembler - javap. I think
this is not cool, haha.
What way can I protect my code? To me, the value of
java just went way down due to the ease at attaining
source code (based on what I read in the past hour or
so. I have yet to try it myself). I wonder if this
impacts companies reasons not to use java?All intellectual property stored in electronic form is vulnerable. Not just Java bytecode. You can use tools called obfuscators to make decompiling more difficult, which is usually good enough. The truth is, no matter how great you think your code is, it's of a lot less interest to others than you actually think. Unless you've got a particularly sexy argorithm or something, it's not really worth worrying too much about
All you can do is make it more difficult for people to crack things, never prevent it. True of all languages, all electronic media -
Good Day! I'm just having a hard time of thinking how to encrypt the source code of a given web page(html, jsp, etc.) without affecting how it is previewed in an Internet Browser. What I plan is to disable the capabilities of some malicious Internet users of copying the source codes of my web pages by using the "View Source" option of Internet Explorer and the equivalent function in Netscape Navigator. Please somebody help me in this matter (I'm planning to use an IDEA algorithm using JCE)....
It would be big help if a running code is supplied.
Thank you very much in advance.
God Bless!!!
- Jonathan Untalan([email protected])don't know theses softs. What i know about encrypted web pages, is that you need a secure socket connection (https).
Your web page will be ciphered, send to the user, and decipher by the browser with the signature file associated to your https connexion.
It isn't possible to encrypt your page directly, and then decrypt them when requested.
For the download time, only the server is responsible for this.
if it is overloaded, then it will slow down its upload.
Maybe you use some encryption method that require a lot of CPU time.
For summary : you can only cipher the pipe transport, but not the transported pages.
Good luck in your search. -
Procedures/packages security. Hide source code?
Hi.
I was wondering if it is possible to hide the source code of a procedure for a user or avoid him to recreate it, but let him to execute it.
Im doing a sandbox procedure who edit and run an external job. It works fine but I see a bunch of security holes. If any DB user who can execute that procedure can edit it too, they could run any shell command by changing the external job attributes. I could use credentials (11.2.0.2) and somehow limit the system user to specific commands but I want to fix the security hole by limiting the DB user instead limiting system user.
This is the external job
BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'test',
job_type => 'EXECUTABLE',
job_action => '/bin/sh',
number_of_arguments => 2
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
job_name => 'test',
argument_position => 1,
argument_value => '-c'
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
job_name => 'test',
argument_position => 2,
argument_value => '/bin/date>>/tmp/date.log'
END;
/ And then, the procedure.
CREATE OR REPLACE PROCEDURE TEST_DATE_FILE ( new_file IN varchar2 )
IS BEGIN
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
job_name => 'test',
argument_position => 2,
argument_value => '/bin/date>>/tmp/' || new_file
DBMS_SCHEDULER.RUN_JOB(
job_name => 'test',
use_current_session => TRUE
END;
SQL> conn scott/tiger
Conectado.
SQL> exec TEST_DATE_FILE('newfile.log');
Procedimiento PL/SQL terminado correctamente.
SQL> CREATE OR REPLACE PROCEDURE SYS.TEST_DATE_FILE ( new_file IN varchar2 )
2 IS BEGIN
3 DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
4 job_name => 'test',
5 argument_position => 2,
6 argument_value => '/bin/rm -rf /tmp/*'
7 );
8
9 DBMS_SCHEDULER.RUN_JOB(
10 job_name => 'test',
11 use_current_session => TRUE
12 );
13 END;
14 /
Procedimiento creado.
SQL> exec TEST_DATE_FILE ('');
Procedimiento PL/SQL terminado correctamente.
It is possible to hide the source code of the procedure who edits and run the external procedure?
There is any workaround or any idea of how can I prevent this?
Regards
Edited by: elvegaa_esp on 17-may-2012 2:41
Edited by: elvegaa_esp on 17-may-2012 2:43ops$[email protected]> host wrap iname=test.sql oname=test_wrap.sql
PL/SQL Wrapper: Release 8.1.7.2.0 - Production on Mon Jan 07 12:44:21 2002
Copyright (c) Oracle Corporation 1993, 2000. All Rights Reserved.
Processing test.sql to test_wrap.sql
ops$[email protected]> @test_wrap.sql
ops$[email protected]> create or replace procedure p wrapped
2 0
3 abcd
4 abcd
5 abcd
6 abcd
7 abcd
8 abcd
9 abcd
10 abcd
11 abcd
12 abcd
13 abcd
14 abcd
15 abcd
16 abcd
17 abcd
18 3
19 7
20 8106000
21 1
22 4
23 0
24 4
25 2 :e:
26 1P:
27 1DBMS_OUTPUT:
28 1PUT_LINE:
29 1Hello world:
30 0
31
86 /
Procedure created.
and now you don't
ops$[email protected]> select text from user_source where name = 'P';
TEXT
procedure p wrapped
0
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
3
7
8106000
1
4
0
4
2 :e:
1P:
1DBMS_OUTPUT:
1PUT_LINE:
1Hello world:
0
ops$[email protected]>
Edited by: HuaMin Chen on May 29, 2012 11:26 AM -
I am running 10.6.8 and using iweb for my web site. After several SEO analysis they all indicate I need H1-6 header tags. After looking at the source code I see there are none in iweb. Are they necessary to add? Why would one add these tags and how do I add H Tags to iweb? And are there examples to look at? I am slowly learning about simple web design and assumed that iweb was stand alone without having to write code. Is this one of the reasons iweb is no longer supported? Thanks for looking at this!
A simple text page like this:
Heading
sub heading
text paragraph ....
Is traditionally represented by html tags like:
<h1>Heading</h1>
<h2>sub heading</h2>
<p>text paragraph ... </p>
I would guess that the use of h1-h6 tags helps search engines to understand the structure of a page as the tags imply a certain structure.
This can be compared to more generic tags like <div> that could represent any kind of content - and may be what iWeb uses (you'll have to check yourself).
I would generally recommend that you use some kind of up to date blog/site building tool, perhaps Wordpress or Squarespace (I haven't used either one myself) that support current web technologies - this should reduce your SEO issues and make it easier to properly support mobile/tablet users. -
How can i get the source code from java concurrent program in R12
Hi 2 all,
How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
Regards,
Zulqarnainuser570667 wrote:
Hi 2 all,
How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
Regards,
ZulqarnainDid you see old threads for similar topic/discussion? -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Source+AND+Code&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Thanks,
Hussein -
How to get the source code in PAR file
Hi All,
I used the PAR migration tool to migrate from PAR to EAR file. When I imported the EAR into NWDS 7.3, I was just able to see the structure and jsp files and could not find the java source code files. I would requires the java source code to make modifications so that deprecated APIs can be replaced and to also make the code compatible with JDK 1.6.
I think the original 7.0 PAR file itself does not contain the source code. I decided to use the "Include source code" option when exporting the 7.0 PAR.
I have the portal application DC project in my NWDS 7.0. However, when I try to export the PAR file using Export --> PAR File -- > Next... I am unable to select any project from the list. The list appears blank with disabled Next & Finish buttons.
I also noticed that in the portal DC application structure, there is a .sda file under /gen/default/deploy. Also there is no PAR folder under /gen/default/public.
How do I include the source in the PAR file so that I can edit the same after migrating to EAR format ?
Regards,
MelwynDC and PAR/EAR stuff are different formats, SC/DC is an archive type used by NWDI, if I got it right.
How do I go about generating the PAR file (with source) ?
In fact through including the seources while creating the PAR/EAR in NWDS, but: no need to do that, you can also depack SDA (rename it to zip). If you wanna just see the Java sources you will find them there, otherwise decompile as Vijay already sad.
cheers -
When i try to log in to the log in link at the site https://efp.bpcl.in the log in page does not open but the firefox wants to ask with which program the firefox should open the file and when we give firefox or internet explorer than it opens the source code.Plz help...
Those files are send as application/octet-stream and that makes Firefox display a download dialog.
http://developer.mozilla.org/en/docs/Properly_Configuring_Server_MIME_Types -
How to find the Web Dnpro component from the Source code ?
Hi Gurus,
Please help me to find out the WD Component Name from the Source Code?
Regards
AnilHi Thomos,
When i right clik on the screen i see the following line by line.
-Back
-forward
-save background as
-set as background
-copy background
-set as desktop item
-select all
-Paste
-create shotcut
-add to favorites
-view source
-encoding
-print
-refresh
-export to microsoft excel
-properties
I have mentioned every thing i see when ever i right click on the screen.
--Anil -
Where is the source codes in the project
Help! NetBeans 6.5 Compile.
Old man trying to learn Java and tools provided by SUN.
I down loaded all those swing demos. I throw 3 demos into NB-6.5 to compile with existing source. When I start building got the message says compiled class file in the ?build? folder. Recommended to delete. If I clicked ?yes? or ?ignore?, it compiled and ran OK.
One of my problem is, I like the source codes in the edit window and another one is I can not find my source in any folder in the project..
Project folder :
E:\NbProj\NbProj-1
\NbProj-2
\Nb/Proj-3
Swing Demo source
E:\DnLd\DemoZips
\Source
\demo.java-1
\demo.java-2
\demo.java-3
Is it because of my setup?
How can I get source codes into NB so I can learn NB and provided tools by editing compiling.
Appreciate for any education to an old man.
MyintIn netbeans, File > New Project. In Categories select "Java", in Projects Select "Java With Existing Sources".
-
How to display the source code for this friggin' file.
Below is a rather lengthy bit of code that provides the behavior and attributes of a web server for OpenCyc. I need to know if I can enter some java to have the HTML source code displayed in a separate text file whenever this class returns some resulting webpage. If you have any ideas it will be greatly appreciated.
-"Will code for foo."
package org.opencyc.webserver;
* Class WebServer is simple multithreaded HTTP server
* with CGI limited to a Cyc connection on default port 3600.
* <p>
import java.net.*;
import java.io.*;
import java.util.*;
import java.util.jar.*;
import java.text.*;
import org.opencyc.util.*;
public class WebServer extends Thread {
* Singleton WebServer instance.
public static WebServer current;
* Default HTTP port.
protected static int DEFAULT_PORT = 80;
* Default Cyc base port.
protected static int DEFAULT_CYC_PORT = 3600;
* Default directory to serve files from on non-Windows OS.
protected static String DEFAULT_DIR = "/";
* Default directory to serve files from on Windows.
//protected static String DEFAULT_WIN_DIR = "C:\\";
protected static String DEFAULT_WIN_DIR = "k:\\opencyc\\run\\httpd\\htdocs";
* File cache capacity.
protected static final int CACHE_CAPACITY = 100;
* File cache to improve file serving performance.
protected static Hashtable fileCache = new Hashtable(CACHE_CAPACITY);
* Number of files served from this web server.
protected static long nbrFilesServed = 0;
* Number of files served from this web server that were found in the cache.
protected static long nbrCacheHits = 0;
* Server socket for accepting connections.
protected ServerSocket server;
* Directories to serve files from.
protected ArrayList dirs;
* Map from String (jar root) to JarFile[] (jar class path).
protected HashMap map;
* Webserver HTTP port.
protected int port;
* Cyc HTML host.
protected String cycHost = "localhost";
* Cyc HTML port.
protected int cycPort;
* Expand jar tress.
protected boolean trees;
* Requests flag.
protected boolean traceRequests;
* Constructs a WebServer object.
* @param port the port to use
* @param directories the directory to serve files from
* @param trees true if files within jar files should be served up
* @param traceRequests true if client's request text should be logged.
* @exception IOException if the listening socket cannot be opened, or problem opening jar files.
public WebServer() throws IOException {
getProperties();
server = new ServerSocket(port);
processDirectories();
* Class Task processes a single HTTP request.
protected class Task extends Thread {
* Socket for the incoming request.
protected Socket sock;
* Client socket to the Cyc KB HTML server.
protected Socket cycHtmlSocket;
* Output tcp stream.
protected DataOutputStream out;
* Contains the file request path for a not-found error message.
protected String notFoundPath;
* Contains the first line of a request message.
protected String methodLine;
* Contains the body of a POST method.
protected String bodyLine;
* Constructs a Task object.
* @param sock the socket assigned for this request.
public Task(Socket sock) {
this.sock = sock;
* Processes the HTTP request.
public void run() {
if (traceRequests)
Log.current.println("connection accepted from " + sock.getInetAddress());
notFoundPath = "";
try {
out = new DataOutputStream(sock.getOutputStream());
try {
getBytes();
catch (Exception e) {
Log.current.println("file not found: " + notFoundPath);
try {
out.writeBytes("HTTP/1.1 404 Not Found\r\n");
out.writeBytes("Server: Cyc WebServer\r\n");
out.writeBytes("Connection: close\r\n");
out.writeBytes("Content-Type: text/html\r\n\r\n");
out.writeBytes("<HTML><HEAD>\n");
out.writeBytes("<TITLE>404 Not Found</TITLE>\n");
out.writeBytes("</HEAD><BODY>\n");
out.writeBytes("<H1>404 - Not Found</H1>\n");
out.writeBytes("</BODY></HTML>");
out.flush();
catch (SocketException se) {
catch (Exception e) {
Log.current.printStackTrace(e);
finally {
try {
sock.close();
catch (IOException e) {
* Reads the HTTP request and obtains the response.
* @exception IOException when HTTP request has an invalid format.
private void getBytes() throws IOException {
// Below logic is complex because web browsers do not close the
// socket after sending the request, so must parse message to find
// the end.
BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
ArrayList inBytes = new ArrayList(200);
int ch = 0;
boolean postMethod;
methodLine = in.readLine();
//if (traceRequests)
// Log.current.println("methodLine=" + methodLine);
bodyLine = "";
if (methodLine.startsWith("POST /"))
postMethod = true;
else
postMethod = false;
//if (traceRequests)
// Log.current.println("postMethod=" + postMethod);
int ch1 = -1;
int ch2 = -1;
int ch3 = -1;
int ch4 = -1;
// Read the HTTP request headers.
while (true) {
ch = in.read();
inBytes.add(new Integer(ch));
ch1 = ch2;
ch2 = ch3;
ch3 = ch4;
ch4 = ch;
if (ch1 == '\r' && ch2 == '\n' && ch3 == '\r' && ch4 == '\n')
break;
if ((! postMethod) &&
(! in.ready()) &&
ch1 == -1 &&
ch2 == -1 &&
ch3 == '\r' &&
ch4 == '\n') {
inBytes.add(new Integer('\r'));
inBytes.add(new Integer('\n'));
break;
byte[] byteArray = new byte[inBytes.size()];
for (int i = 0; i < inBytes.size(); i++) {
Integer ich = (Integer) inBytes.get(i);
byteArray[i] = ich.byteValue();
String headers = new String(byteArray);
if (postMethod) {
String lcHeaders = headers.toLowerCase();
int i = lcHeaders.indexOf("content-length: ");
String contentLength = lcHeaders.substring(i + 16);
int j = contentLength.indexOf("\r\n");
contentLength = contentLength.substring(0, j);
int bodyLen = (new Integer(contentLength)).intValue();
for (int k = 0; k < bodyLen; k++) {
bodyLine = bodyLine + (new Character((char) in.read())).toString();
String line = methodLine + "\r\n" + headers + bodyLine;
if (traceRequests)
Log.current.println(line);
if (postMethod)
processHttpPost();
else
if (line.startsWith("GET /"))
processHttpGet(line.substring(4));
else {
Log.current.println("Invalid request = " + line);
throw new IOException();
* Processes an HTTP GET method.
* @param httpGetPath the path of the file to get.
* @exception IOException if the file is not found.
private void processHttpGet(String httpGetPath) throws IOException {
int i = httpGetPath.indexOf(' ');
if (i > 0)
httpGetPath = httpGetPath.substring(0, i);
Log.current.println(methodLine + " from " + sock.getInetAddress().getHostName());
i = httpGetPath.indexOf("cg?");
if (i > 0) {
cycHtmlRequest(httpGetPath.substring(i + 3));
return;
notFoundPath = httpGetPath;
i = httpGetPath.indexOf('/');
if (i < 0 || map == null) {
if (map == null || httpGetPath.endsWith(".jar")) {
for (int j = 0; j < dirs.size(); j++) {
String dir = (String) dirs.get(j);
String nativePath = dir + httpGetPath;
nativePath = nativePath.replace('/', File.separatorChar);
if (fileCache.containsKey(nativePath)) {
writeDataBytes((byte[]) fileCache.get(nativePath));
Log.current.println("...cached");
nbrCacheHits++;
nbrFilesServed++;
return;
try {
File f = new File(nativePath);
byte[] fileBytes = getBytes(new FileInputStream(f), f.length());
writeDataBytes(fileBytes);
if (fileCache.size() >= CACHE_CAPACITY)
fileCache.clear();
fileCache.put(nativePath, fileBytes);
Log.current.println("...from " + nativePath);
nbrFilesServed++;
return;
catch (IOException e) {
throw new IOException();
String jar = httpGetPath.substring(0, i);
httpGetPath = httpGetPath.substring(i + 1);
JarFile[] jfs = (JarFile[]) map.get(jar);
if (jfs == null)
throw new IOException();
for (i = 0; i < jfs.length; i++) {
JarEntry je = jfs.getJarEntry(httpGetPath);
if (je == null)
continue;
writeDataBytes(getBytes(jfs[i].getInputStream(je), je.getSize()));
nbrFilesServed++;
return;
throw new IOException();
* Processes an HTTP POST method.
* @exception IOException if the file is not found.
private void processHttpPost() throws IOException {
Log.current.println("POST " + bodyLine + " from " + sock.getInetAddress().getHostName());
cycHtmlRequest(bodyLine);
* Reads the specified number of bytes and always close the stream.
* @param in the file to be read for subsequent downloading.
* @param length the number of bytes to read from the file.
* @return An array of bytes from the file.
* @exception IOException if an error occurs when processing the file.
private byte[] getBytes(InputStream in, long length) throws IOException {
DataInputStream din = new DataInputStream(in);
byte[] bytes = new byte[ (int) length];
try {
din.readFully(bytes);
finally {
din.close();
return bytes;
* Sends the HTML request to Cyc.
* @param cycPath the portion of the URL which is given to the Cyc HTML server.
private void cycHtmlRequest(String cycPath) {
String request = sock.getInetAddress().getHostName() + "&" + cycPath + "#";
System.out.println("request=" + request);
ArrayList bytes = new ArrayList(10000);
try {
cycHtmlSocket = new Socket(cycHost, cycPort);
System.out.println("cycHost=" + cycHost + " cycPort=" + cycPort);
BufferedReader cycIn = new BufferedReader(new InputStreamReader(cycHtmlSocket.getInputStream()));
PrintWriter cycOut = new PrintWriter(cycHtmlSocket.getOutputStream(), true);
cycOut.println(request);
cycOut.flush();
int ch = 0;
while (ch >= 0) {
ch = cycIn.read();
bytes.add(new Integer(ch));
catch (Exception e) {
Log.current.printStackTrace(e);
byte[] byteArray = new byte[bytes.size()];
for (int i = 0; i < bytes.size() - 1; i++) {
Integer ich = (Integer) bytes.get(i);
byteArray[i] = ich.byteValue();
try {
writeTextBytes(byteArray);
catch (Exception e) {
Log.current.println(e.getMessage());
* Responds to the HTTP client with data content from the requested URL.
* @param bytes the array of bytes from the URL.
* @exception IOException if there is an error writing to the HTTP client.
public void writeDataBytes(byte[] bytes) throws IOException {
out.writeBytes("HTTP/1.1 200 OK\r\n");
out.writeBytes("Server: Cyc WebServer\r\n");
out.writeBytes("Connection: close\r\n");
out.writeBytes("Content-Length: " + bytes.length + "\r\n");
String prefix = (new String(bytes)).toLowerCase();
if (prefix.indexOf("<html>") > -1)
out.writeBytes("Content-Type: text/html\r\n\r\n");
else
out.writeBytes("Content-Type: application/java\r\n\r\n");
out.write(bytes);
out.flush();
* Respond to the HTTP client with text content from the requested URL.
* @param bytes the array of bytes from the URL.
* @exception IOException if there is an error writing to the HTTP client.
public void writeTextBytes(byte[] bytes) throws IOException {
out.writeBytes("HTTP/1.1 200 OK\r\n");
out.writeBytes("Server: Cyc WebServer\r\n");
out.writeBytes("Connection: close\r\n");
out.writeBytes("Content-Length: " + bytes.length + "\r\n");
out.writeBytes("Content-Type: text/html\r\n\r\n");
out.write(bytes);
out.flush();
* Gets properties governing the web server's behavior.
private void getProperties() {
port = DEFAULT_PORT;
String portProperty = System.getProperty("org.opencyc.webserver.port", "");
if (! portProperty.equalsIgnoreCase(""))
port = (new Integer(portProperty)).intValue();
Log.current.println("Listening on port " + port);
cycPort = DEFAULT_CYC_PORT;
String cycPortProperty = System.getProperty("org.opencyc.webserver.cycPort", "");
if (! cycPortProperty.equalsIgnoreCase(""))
cycPort = (new Integer(cycPortProperty)).intValue();
Log.current.println("Cyc connections directed to port " + cycPort);
String dirsProperty = System.getProperty("org.opencyc.webserver.dirs", "");
dirs = new ArrayList(3);
StringTokenizer st = new StringTokenizer(dirsProperty, ";", false);
while (st.hasMoreTokens()) {
String dir = st.nextToken();
dirs.add(dir);
trees = false;
String treesProperty = System.getProperty("org.opencyc.webserver.trees", "");
if (! treesProperty.equalsIgnoreCase(""))
trees = true;
traceRequests = false;
String traceRequestsProperty = System.getProperty("org.opencyc.webserver.traceRequests", "");
if (! traceRequestsProperty.equalsIgnoreCase("")) {
traceRequests = true;
Log.current.println("tracing requests");
* Adds transitive Class-Path jars to jfs.
* @param jar the jar file
* @param jfs the list of jar files to serve.
* @param dir the jar file directory.
* @exception IOException if an I/O error has occurred with the jar file.
private void addJar(String jar, ArrayList jfs, String dir) throws IOException {
Log.current.println("Serving jar files from: " + dir + jar);
JarFile jf = new JarFile(dir + jar);
jfs.add(jf);
Manifest man = jf.getManifest();
if (man == null)
return;
Attributes attrs = man.getMainAttributes();
if (attrs == null)
return;
String val = attrs.getValue(Attributes.Name.CLASS_PATH);
if (val == null)
return;
dir = dir + jar.substring(0, jar.lastIndexOf(File.separatorChar) + 1);
StringTokenizer st = new StringTokenizer(val);
while (st.hasMoreTokens()) {
addJar(st.nextToken().replace('/', File.separatorChar), jfs, dir);
* Administrative accessor method that obtains list of directories from which files are served.
public ArrayList getDirs() {
return dirs;
* Administrative method that updates the list of directories from which files are served.
public synchronized void setDirs(ArrayList dirs) throws IOException {
this.dirs = dirs;
fileCache.clear();
processDirectories();
* Administrative accessor method that obtains number of files served.
* @return The number of files served.
public long getNbrFilesServed() {
return nbrFilesServed;
* Administrative accessor method that obtains number of files served from cache.
* @return The number of files served from the cache.
public long getNbrCacheHits() {
return nbrCacheHits;
* Administrative method that clears the file cache.
public synchronized void clearFileCache() {
Log.current.println("Clearing file cache");
fileCache.clear();
nbrFilesServed = 0;
nbrCacheHits = 0;
* Processes the directories from which files are served, expanding jar trees if
* directed.
* @exception IOException if problem occurs while processing the jar files.
private void processDirectories() throws IOException {
if (dirs.size() == 0)
if (File.separatorChar == '\\')
dirs.add(DEFAULT_WIN_DIR);
else
dirs.add(DEFAULT_DIR);
Iterator directories = dirs.iterator();
while (directories.hasNext())
Log.current.println("Serving from " + directories.next());
if (trees) {
map = new HashMap();
for (int j = 0; j < dirs.size(); j++) {
String dir = (String) dirs.get(j);
String[] files = new File(dir).list();
for (int i = 0; i < files.length; i++) {
String jar = files[i];
if (!jar.endsWith(".jar"))
continue;
ArrayList jfs = new ArrayList(1);
addJar(jar, jfs, dir);
map.put(jar.substring(0, jar.length() - 4), jfs.toArray(new JarFile[jfs.size()]));
* Provides the command line interface for creating an HTTP server.
* The properties are:
* <pre>
* org.opencyc.webserver.port=<HTTP listening port>
* </pre>
* which defaults to 80.
* <pre>
* org.opencyc.webserver.cycPort=<Cyc connection port>
* </pre>
* which defaults to 3600.
* <pre>
* org.opencyc.webserver.dirs=<path>;<path> ... ;<path>
* </pre>
* with the argument enclosed in quotes if any path contains an
* embedded space.
* The default directory on Windows is C:
* and the default on other systems is / the default
* can be overridden with this property. By default, all files
* under this directory (including all subdirectories) are served
* up via HTTP. If the pathname of a file is <var>path</var> relative
* to the top-level directory, then the file can be downloaded using
* the URL
* <pre>
* http://<var>host</var>:<var>port</var>/<var>path</var>
* </pre>
* Caching of file contents is performed.
* <pre>
* org.opencyc.util.log=all
* </pre>
* If the all value is given, then all attempts to download files
* are output.
* <pre>
* org.opencyc.webserver.traceRequests
* </pre>
* If this property has any value, then the client HTTP requests are
* output.<p>
* <pre>
* org.opencyc.webserver.trees
* </pre>
* This property can be used to serve up individual files stored
* within jar files in addition to the files that are served up by
* default. If the property has any value, the server finds all jar files
* in the top-level directory (not in subdirectories). For each
* jar file, if the name of the jar file is <var>name</var>.jar, then any
* individual file named <var>file</var> within that jar file (or within
* the jar or zip files referenced transitively in the Class-Path manifest
* attribute, can be downloaded using a URL of the form:
* <pre>
* http://<var>host</var>:<var>port</var>/<var>name</var>/<var>file</var>
* </pre>
* When this property has any value, an open file descriptor and cached
* information are held for each jar file, for the life of the process.
* @param args an unused array of command line arguments.
public static void main(String[] args) {
Log.makeLog();
System.out.println("OpenCyc Web Server");
try {
// Launch thread to accept HTTP connections.
current = new WebServer();
current.start();
catch (IOException e) {
e.printStackTrace();
* Just keep looping, spawning a new thread for each incoming request.
public void run() {
try {
while (true) {
// Launch thread to process one HTTP request.
new Task(server.accept()).start();
catch (IOException e) {
e.printStackTrace();JLundan,
I want to thank you for responding to the thread I started on the forum at java.sun.com. Your solution to my problem of needing to print the code of the html pages that the file I included generates was just what I was looking for. However, I have some further questions to ask, if you don't mind. To clarify my task I should say that your rephrasing of the problem is accurate: "You wan't to display the contents of the HTML file that the web server produces in response of client's request?"
Yes, this is what I need to do, but also it needs to display the source code of that html file that the server produces in response to the client's request. Also, in this case, I am the client requesting that the server return some html file, and I'm not sure where the server is. But the webserver.java file that I shared on the forum is on my local machine. I was wondering if I could modify this webserver.java file at my home so that any html file the server returns to me would automatically display the source code. This is a school project of mine and I am stuck on this one thing here.
Further, where would I put the "foo.html" file so it can be written to?
FileOuputStream fos = new FileOutputStream("foo.html");
fos.write(bytes);
fos.close();
Thanks so much for your help. I look forward to your response, at your convenience.
Regards -
ABAP WD, Read the source code of a html page
Hi all,
I have the URL link of .jsp page and I want to get the source code generated by this page to extract some data for my web dynpro.
How do i solve this?
ThanksHi Antonio,
not sure if i understand the question properly.
You want to read html content of http site rendered via jsp.
You can use cl_http_client
to write a simple http client tool.
This tool opens the page. The html content is available to this class.
You can extract the content here.
See the attribute 'response' after making a call.
regards
Phil. -
I need to know the differnece between the Numeric Limit Test between the TestStand version 3.0 to 3.1. If there is any differnec in the source code how to find it out? If somebody has the code can you share it?
Thanks,
JeyanHi,
I don't believe there are any differences between the two versions. But you can check the source code for the Numeric Limit Test in TestStand\Components\NI\StepTypes\CommonSubsteps. But the main part of the step is the Code Module and this bit the users supplies this.
What has prompted this question?
Regards
Ray Farmer
Regards
Ray Farmer -
If I Use JavaFX to Create a Game Do I Have to Release the Source Code?
Hello,
I've asked this question before, but I just thought I would try it again now
that version 1.0 is out.
If I Use JavaFX to Create a Game Do I Have to Release the Source Code?
Thanx in advance.Could you please point me to a resource describing "the JavaFX Runtime license"? I'm trying to find answers to the following questions:
1. I'd like to use Scenario.jar from the JavaFX project in a desktop app that is not using Webstart and is not an applet. Will I be able to ship the jar with my software?
2. Can JavaFX applications be distributed as commercial software in the absence of a Web connection?
What's not clear to me is which is the real license for Scenario.jar (as shipped with JavaFX). Is it the one in openjfx-compiler's trunk, or the one that comes with the JavaFX SDK (which is very vague about redistribution)? -
I Need Help to Access The Source Code From A Form to Know the Calculation Formula
Hi,
I Need Help to Access The Source Code From A Form to Know the Calculation Formula. The application is a windows form application that is linked to SQL Server 2008. In one of the application forms it generates an invoice and does some calculations. I just
need to know where behind that form is the code that's doing the calculations to generate the invoice, I just need to get into the formula that's doing these calculations.
Thank you so much.Hi,
Thanks for the reply. This is a view and [AmountDue] is supposed to be [CurrentDueAmount] + [PastDueAmount] - [PaidAmount]. The view is not calculating [PaidAmount] right . Below is the complete code of the view. Do you see anything wrong in the code ?
Thanks.
SELECT [isi].[InvoiceID], [ii].[DueDate], [SubInvoiceID] = [isi].[ID], [INV_FacilityID] = [if].[ID], [if].[FacilityID],
[iff].[FacilityFeeID], [LoanID] = NULL, [isi].[PortfolioID], [isi].[Portfolio],
[PaymentType] = [isis_fee].[SectionType], [Name]
= [iff].[Name], [ReceivedAmount], [dates].[CurrentDueAmount],
[PastDueAmount] = CASE WHEN ISNULL([ReceivedAmount],
0) > 0 THEN [pastdue].[PastDueFeeAmount] + ISNULL([ReceivedAmount], 0)
WHEN ISNULL([ReceivedAmount], 0)
< 0 THEN /* We bring past due to zero and
apply reset to current. */ CASE WHEN [pastdue].[PastDueFeeAmount] + ISNULL([ReceivedAmount], 0)
< 0 THEN 0 ELSE [pastdue].[PastDueFeeAmount]
+ ISNULL([ReceivedAmount], 0) END WHEN ISNULL([ReceivedAmount], 0) = 0 AND
[pastdue].[PastDueFeeAmount] < 0 THEN 0 ELSE
[pastdue].[PastDueFeeAmount] END, [PaidAmount] = CASE WHEN ISNULL([ReceivedAmount], 0)
< 0 THEN /* We bring past due to zero and
apply rest to current. */ CASE WHEN [pastdue].[PastDueFeeAmount] + ISNULL([ReceivedAmount], 0)
< 0 THEN - ([pastdue].[PastDueFeeAmount]
+ ISNULL([ReceivedAmount], 0)) ELSE 0 END WHEN ISNULL([ReceivedAmount], 0) = 0 AND
[pastdue].[PastDueFeeAmount] < 0 THEN - [pastdue].[PastDueFeeAmount]
ELSE 0 END, [AmountDue] = [unpaid].[UnpaidFeeAmount], [ID] = [iff].[FacilityFeeID]
FROM [dbo].[INV_SubInvoice] isi JOIN
[dbo].[INV_Invoice] ii ON [isi].[InvoiceID]
= [ii].[ID] JOIN
[dbo].[INV_Facility] [if] ON [isi].[ID] = [if].[SubInvoiceID]
JOIN
[dbo].[INV_FacilityFee] iff ON [if].[ID] = [iff].[INV_FacilityID]
JOIN
(SELECT [sis_fee].[ID],
[sis_fee].[SectionTypeCode], [SectionType] = [st_fee].[Name], [sis_fee].[INV_FacilityFeeID]
FROM
[dbo].[INV_SubInvoiceSection] sis_fee JOIN
[dbo].[INV_SectionType] st_fee ON [sis_fee].[SectionTypeCode] = [st_fee].[Code]
WHERE [INV_FacilityFeeID]
IS NOT NULL AND [StatusCode] = 'BILL') isis_fee ON [iff].[ID] = [isis_fee].[INV_FacilityFeeID] JOIN
(SELECT [iffa].[SectionID],
[AccrualDeterminationDateMax] = MAX([iffa].[AccrualDeterminationDate]),
[AccrualDeterminationDateMin] = MIN([iffa].[AccrualDeterminationDate]), [CurrentDueAmount] = SUM([iffa].[AccruedFeeAmount]),
[ReceivedAmount] = SUM([iffa].[ReceivedFeeAmount])
FROM
[dbo].[INV_FacilityFeeAccrual] iffa
GROUP BY [iffa].[SectionID])
dates ON [isis_fee].[ID] = [dates].[SectionID] LEFT JOIN
(SELECT *
FROM
[dbo].[INV_FacilityFeeAccrual]) unpaid ON [dates].[SectionID] = [unpaid].[SectionID] AND
[dates].[AccrualDeterminationDateMax] = [unpaid].[AccrualDeterminationDate]
LEFT JOIN
(SELECT [SectionID],
[PastDueFeeAmount] = SUM([PastDueFeeAmount])
FROM
[dbo].[INV_FacilityFeeAccrual]
GROUP BY [SectionID]) pastdue
ON [dates].[SectionID] = [pastdue].[SectionID]
UNION
SELECT [isi].[InvoiceID], [ii].[DueDate], [SubInvoiceID] = [isi].[ID], [INV_FacilityID] = [if].[ID], [if].[FacilityID],
[FacilityFeeID] = NULL, [il].[LoanID], [isi].[PortfolioID], [isi].[Portfolio],
[PaymentType] = [isis_loan].[SectionType], [Name]
= [il].[Name], [ReceivedAmount], [CurrentDueAmount], [PastDueAmount] = CASE WHEN ISNULL([ReceivedAmount],
0) > 0 THEN [PastDueAmount] + ISNULL([ReceivedAmount],
0) WHEN ISNULL([ReceivedAmount], 0)
< 0 THEN /* We bring past due to zero and
apply rest to current. */ CASE WHEN [PastDueAmount] + ISNULL([ReceivedAmount], 0)
< 0 THEN 0 ELSE [PastDueAmount] + ISNULL([ReceivedAmount],
0) END WHEN ISNULL([ReceivedAmount], 0) = 0 AND
[PastDueAmount] < 0 THEN 0 ELSE [PastDueAmount]
END,
[PaidAmount] = CASE WHEN [isis_loan].[SectionTypeCode]
= 'LOAN_PRIN' THEN 0 ELSE CASE WHEN ISNULL([ReceivedAmount], 0)
< 0 THEN /* We bring past due to zero and
apply rest to current. */ CASE WHEN [PastDueAmount] + ISNULL([ReceivedAmount], 0)
< 0 THEN - ([PastDueAmount] + ISNULL([ReceivedAmount],
0)) ELSE 0 END WHEN ISNULL([ReceivedAmount], 0) = 0 AND
[PastDueAmount] < 0 THEN - [PastDueAmount]
ELSE 0 END END,
[AmountDue] = CASE WHEN [isis_loan].[SectionTypeCode]
= 'LOAN_PRIN' THEN [CurrentDueAmount] ELSE [unpaid].[AmountDue] END, [ID] = [il].[LoanID]
FROM [dbo].[INV_SubInvoice] isi JOIN
[dbo].[INV_Invoice] ii ON [isi].[InvoiceID]
= [ii].[ID] JOIN
[dbo].[INV_Facility] [if] ON [isi].[ID] = [if].[SubInvoiceID]
JOIN
[dbo].[INV_Loan] il ON [if].[ID] = [il].[INV_FacilityID]
JOIN
(SELECT [sis_loan].[ID],
[sis_loan].[SectionTypeCode], [SectionType] = [st_loan].[Name], [sis_loan].[INV_LoanID]
FROM
[dbo].[INV_SubInvoiceSection] sis_loan JOIN
[dbo].[INV_SectionType] st_loan ON [sis_loan].[SectionTypeCode] = [st_loan].[Code]
WHERE [INV_LoanID]
IS NOT NULL AND [StatusCode] = 'BILL') isis_loan ON [il].[ID] = [isis_loan].[INV_LoanID] JOIN
(SELECT [iffa].[SectionID],
[AccrualDeterminationDateMax] = MAX([iffa].[AccrualDeterminationDate]),
[AccrualDeterminationDateMin] = MIN([iffa].[AccrualDeterminationDate]), [CurrentDueAmount] = SUM([iffa].[ExpectedPrincipalAmount]),
[ReceivedAmount] = SUM([ReceivedPrincipalAmount])
FROM
[dbo].[INV_LoanPrincipalAmortization] iffa
GROUP BY [iffa].[SectionID]
UNION
SELECT [iffa].[SectionID],
[AccrualDeterminationDateMax] = MAX([iffa].[AccrualDeterminationDate]),
[AccrualDeterminationDateMin] = MIN([iffa].[AccrualDeterminationDate]), [CurrentDueAmount] = SUM([iffa].[AccruedInterestAmount]),
[ReceivedAmount] = SUM([ReceivedInterestAmount])
FROM
[dbo].[INV_LoanCashInterestAccrual] iffa
GROUP BY [iffa].[SectionID]
UNION
SELECT [iffa].[SectionID],
[AccrualDeterminationDateMax] = MAX([iffa].[AccrualDeterminationDate]),
[AccrualDeterminationDateMin] = MIN([iffa].[AccrualDeterminationDate]), [CurrentDueAmount] = SUM([iffa].[AccruedInterestAmount]),
[ReceivedAmount] = SUM([ReceivedInterestAmount])
FROM
[dbo].[INV_LoanPIKInterestAccrual] iffa
GROUP BY [iffa].[SectionID])
dates ON [isis_loan].[ID] = [dates].[SectionID] LEFT JOIN
(SELECT [AmountDue]
= [UnpaidPrincipalAmount], [SectionID], [AccrualDeterminationDate]
FROM
[dbo].[INV_LoanPrincipalAmortization]
UNION
SELECT [AmountDue]
= [UnpaidInterestAmount], [SectionID], [AccrualDeterminationDate]
FROM
[dbo].[INV_LoanCashInterestAccrual]
UNION
SELECT [AmountDue]
= [UnpaidInterestAmount], [SectionID], [AccrualDeterminationDate]
FROM
[dbo].[INV_LoanPIKInterestAccrual]) unpaid ON [dates].[SectionID] = [unpaid].[SectionID] AND
[dates].[AccrualDeterminationDateMax] = [unpaid].[AccrualDeterminationDate]
LEFT JOIN
(SELECT [PastDueAmount]
= SUM([PastDuePrincipalAmount]), [SectionID]
FROM
[dbo].[INV_LoanPrincipalAmortization]
GROUP BY [SectionID]
UNION
SELECT [PastDueAmount]
= SUM([PastDueInterestAmount]), [SectionID]
FROM
[dbo].[INV_LoanCashInterestAccrual]
GROUP BY [SectionID]
UNION
SELECT [PastDueAmount]
= SUM([PastDueInterestAmount]), [SectionID]
FROM
[dbo].[INV_LoanPIKInterestAccrual]
GROUP BY [SectionID]) pastdue
ON [dates].[SectionID] = [pastdue].[SectionID]
UNION
SELECT [isi].[InvoiceID], [ii].[DueDate], [SubInvoiceID] = [isi].[ID], [INV_FacilityID] = [if].[ID], [if].[FacilityID],
[FacilityFeeID] = NULL, [il].[LoanID], [isi].[PortfolioID], [isi].[Portfolio],
[PaymentType] = 'PIK Interest Applied', [Name]
= [il].[Name], [ReceivedAmount], [CurrentDueAmount] = - [dates].[CurrentDueAmount],
[PastDueAmount] = - CASE WHEN ISNULL([ReceivedAmount],
0) > 0 THEN [PastDueAmount] + ISNULL([ReceivedAmount], 0) WHEN ISNULL([ReceivedAmount], 0)
< 0 THEN /* We bring past due to zero and
apply rest to current. */ CASE WHEN [PastDueAmount] + ISNULL([ReceivedAmount], 0)
< 0 THEN 0 ELSE [PastDueAmount] + ISNULL([ReceivedAmount],
0) END WHEN ISNULL([ReceivedAmount], 0) = 0 AND
[PastDueAmount] < 0 THEN 0 ELSE [PastDueAmount]
END, [PaidAmount] = - CASE WHEN ISNULL([ReceivedAmount], 0)
< 0 THEN /* We bring past due to zero and
apply rest to current. */ CASE WHEN [PastDueAmount] + ISNULL([ReceivedAmount], 0)
< 0 THEN - ([PastDueAmount] + ISNULL([ReceivedAmount],
0)) ELSE 0 END WHEN ISNULL([ReceivedAmount], 0) = 0 AND
[PastDueAmount] < 0 THEN - [PastDueAmount]
ELSE 0 END, [AmountDue] = - [AmountDue], [ID] = [il].[LoanID]
FROM [dbo].[INV_SubInvoice] isi JOIN
[dbo].[INV_Invoice] ii ON [isi].[InvoiceID]
= [ii].[ID] JOIN
[dbo].[INV_Facility] [if] ON [isi].[ID] = [if].[SubInvoiceID]
JOIN
[dbo].[INV_Loan] il ON [if].[ID] = [il].[INV_FacilityID]
JOIN
(SELECT [sis_loan].[ID],
[sis_loan].[SectionTypeCode], [SectionType] = [st_loan].[Name], [sis_loan].[INV_LoanID]
FROM
[dbo].[INV_SubInvoiceSection] sis_loan JOIN
[dbo].[INV_SectionType] st_loan ON [sis_loan].[SectionTypeCode] = [st_loan].[Code]
WHERE [INV_LoanID]
IS NOT NULL AND [StatusCode] = 'BILL' AND [sis_loan].[SectionTypeCode] = 'LOAN_INT_PIK') isis_loan ON
[il].[ID] = [isis_loan].[INV_LoanID] JOIN
(SELECT [iffa].[SectionID],
[AccrualDeterminationDateMax] = MAX([iffa].[AccrualDeterminationDate]),
[AccrualDeterminationDateMin] = MIN([iffa].[AccrualDeterminationDate]), [CurrentDueAmount] = SUM([iffa].[AccruedInterestAmount]),
[ReceivedAmount] = SUM([ReceivedInterestAmount])
FROM
[dbo].[INV_LoanPIKInterestAccrual] iffa
GROUP BY [iffa].[SectionID])
dates ON [isis_loan].[ID] = [dates].[SectionID] LEFT JOIN
(SELECT [AmountDue]
= [UnpaidInterestAmount], [SectionID], [AccrualDeterminationDate]
FROM
[dbo].[INV_LoanPIKInterestAccrual]) unpaid ON [dates].[SectionID] = [unpaid].[SectionID] AND
[dates].[AccrualDeterminationDateMax] = [unpaid].[AccrualDeterminationDate]
LEFT JOIN
(SELECT [PastDueAmount]
= SUM([PastDueInterestAmount]), [SectionID]
FROM
[dbo].[INV_LoanPIKInterestAccrual]
GROUP BY [SectionID]) pastdue
ON [dates].[SectionID] = [pastdue].[SectionID]
Maybe you are looking for
-
Sub folders and Process multiple files in Photoshop Elements 10
I am looking to apply the same adjustments to numerous images in numerous sub-folders and overwrite the original images. Using the Process Multiple Files options, I added the main folder (which contains no images) to the Source field, selected the I
-
Hi, We want the system to pick the date of next working day if the payment due date is falling on non working day during billing. There is a functional module 'DATE_CONVERT_TO_FACTORYDATE' available. I donu2019t know where to use this FM so that it c
-
SQL Developer - 1.5.5.59.69 - XP - Memory Leak
I am running SQL Developer 1.5.5.59.69 in XP and I am having an issue with what seems to be a memory leak. I left SQL Developer running over night, and when I looked at the task manager, the memory usage was really high, and each time task manager re
-
I'm traveling and count on my iPhone 4S for entertainment. But all of a sudden my podcasts are 'frozen' . . . I can't select them and the text associated with them is gray, not the usual black. OS 6.1.3 Any ideas? I suspect a setting somewhere, but c
-
Where are the other address books that I had? Now personal, only
The original Personal Address book was unused and I had another Griffith Yahoo address book. I uploaded lots of data to that. It and another historical address book have disappeared with the latest update. I'm totally fouled up with the lost addresse