I have a web application written in the Struts2 framework. I want to host the application with another company. Is there any way to hide the code which is hosted on the server? What I want is to hide the code from anyone who has access to the server. Using the application would be allowed, but viewing the code prohibited.

  • 1
    What kind of web application do you speak of? What language is that web application written in? – Gumbo Nov 11 '11 at 9:00
  • 1
    well, can you tell us at least about your environment: *Nix, windows, asp.net php or ?? – Pleun Nov 11 '11 at 9:01
  • 1
    You haven't given us any specifics - things to include might be the server OS, web-server software, programming language, and the area of your application you're trying to secure. Please read the FAQ: stackoverflow.com/faq – Rob Nov 11 '11 at 9:02
  • A disturbingly bad question... Which code? The client visible code (so, generated HTML) or server-side code (JSP)? What do you mean by "access to the server" - like a user that has an account with filesystem access, or just someone with a web browser? – Vladislav Zorov Nov 11 '11 at 9:14
  • This is not a programming question. I know struts2 but this has nothing to do with struts2/java, you are putting content on someone else's machine if they really wanted to get at that content they can get a copy. It's like saying "I want to put my money in a bank, what assurance can I have that they will not steal it?" For which the obvious answer is they can, but how would that make any sense? – Quaternion Nov 11 '11 at 20:32

By hiding code i assume that you want to restrict others from seeing your business logic which includes you struts2 Action classes any other configurations and Business logic or other potential algorithms business routines you have written in your application.

When we deploy our application on a web-server we generally give only class files along with any JSP,CSS java-script etc.

though there is no certain or 100% way to d-compile java classes but there are potential so many d-compiler out there which can help to d-compile the code.

So if some one want to really see your code he can get an idea about it.

regarding securing JSP/HTML/CSS etc @pauli has already mentioned some ways but still there is no way you can assure yourself 100% about this.

  • How can I migrate a question? question is – Sarin Jacob Sunny Nov 23 '11 at 8:57
  • I have been facing ban because of this question.. How can I remove my ban??? I cant ask any questions.. – Sarin Jacob Sunny Nov 23 '11 at 9:00
  • what kind of ban?? – Umesh Awasthi Nov 23 '11 at 9:23
  • For this question I have got -2 reputation.. – Sarin Jacob Sunny Nov 23 '11 at 9:25
  • Previously in some questions I gave a site address directly for reference, which I got as tutorial from apache struts site.. Some1 flaged it and moderators deleted them... From that time onwards I cant ask questions – Sarin Jacob Sunny Nov 23 '11 at 9:27

If you want to protect you HTML and javascript code then there are tools like Googles Closure compiler that optomise the javascript and in the process render it difficult to reverse engineer.

If your code is written in java then there are open source tools like Proguard. It is likely there are similar tools for other languages. Retrofitting obfuscation can be a be a bit tricky, especially where interfaces are concerned but does provide a degree pf protection.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.