Sign in to follow this  

[web] Beginners question about server-side scripts

This topic is 3934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I write one application in java (it takes picture, draw something and display it). It works when I call it like "java -jar xxx.jar". I need to put it on web, but I also need to offer a client to choose on web site, for example (draw triangle, draw rectangle, draw circle). So when client come to my web page he choose one polygon which he wants to be drawn. Now I need something witch will call my application and give it the client choice. It would be good if my application is shown in new window. This shouldn't be big problem, but with this kind of problem I'm totaly beginner and any help would be useful. Luka

Share this post


Link to post
Share on other sites
In order to run a Java application in the web, it needs to be an Applet. This is different from a standalone application and will require modification to the code.

Parameters can (I think) be passed in via HTML for the Applet code to read and change its behaviour accordingly.

Why not just draw the polygon on the server-side and serve that to a conventional web browser (without requiring client-side Java code or anything else) ?

Mark

Share this post


Link to post
Share on other sites
So, suppose your server is http://myserver.com, and the client requests an image from http://somewhereelse.com/image.png. Since the client is a java applet, it requires authorization to fetch data from any other web site than the one it came from. So, you want to send the request to your very own http://myserver.com server. We'll assume that the URL of the required image is sent as GET parameter, such as:

http://myserver.com/getimage/?id=http://somewhereelse.com/image.png

So, your server has a directory named getimage, which contains an index.php, index.asp or some similar script, which takes an "id" argument containing an URL to a remote image, reads that image from wherever it is, and sends it back to the user.

So, choose your server-side programming language of choice and write a script that:
  1. Reads the 'id' GET argument, checks that it is an image (.png, .jpg, .gif)
  2. Downloads the data for the file from the internet using CURL, HttpRequest or some similar library.
  3. Sends the downloaded data to the user as a result.




Share this post


Link to post
Share on other sites

This topic is 3934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this