My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* MicroEmulator
* Copyright (C) 2006-2007 Vadym Pinchuk
* Copyright (C) 2006-2007 Vlad Skarzhevskyy
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @version $Id$
*/

header('Content-Type: application/x-java-jnlp-file');

$appURL = $_GET['app-url'];

$baseURL = str_replace('/'.basename(__FILE__), '', $_SERVER['SCRIPT_NAME']);
// This base one level UP from this script location
$baseURL = ereg_replace('/[a-zA-Z_0-9\-]+$', '', $baseURL);

// Can't use .. in Url, Use ~ in the beginning
$appURLfixed = $appURL;
do {
$pos = strpos($appURLfixed, '~');
if ($pos === 0) {
$baseURL = ereg_replace('/[a-zA-Z_0-9\-]+$', '', $baseURL);
$appURLfixed = substr($appURLfixed, 1);
}
} while($pos === 0);

$jadURL = 'http://' . $_SERVER['HTTP_HOST'] . $baseURL . $appURLfixed . '.jad';

$jnlpFileName = "demo.jnlp";

$jnlpRewritDir = "open-local/";

$jnlpFilePath = "../" . $jnlpFileName;
$fh = fopen($jnlpFilePath, 'r');
$xml = fread($fh, filesize($jnlpFilePath));
fclose($fh);
$xml = ereg_replace('<!--jadRewrite-->', '<argument>' . $jadURL . '</argument>', $xml);

if (strlen($appURL) > 0) {
$patern_href = 'href="' . $jnlpFileName . '"';
$new_href = 'href="' . $jnlpRewritDir . $appURL . '.jnlp"';
$xml = str_replace($patern_href, $new_href, $xml);
}

echo($xml);
?>

Change log

r2555 by skarzhevskyy on Dec 10, 2008   Diff
fixed webstart
Go to: 
Project members, sign in to write a code review

Older revisions

r2408 by skarzhevskyy on Oct 9, 2008   Diff
organize product to modules
r1084 by skarzhevskyy on Oct 14, 2007   Diff
fixed JNLP start cash
r598 by skarzhevskyy on Jun 29, 2007   Diff
webstart/open-local
All revisions of this file

File info

Size: 2135 bytes, 61 lines

File properties

svn:mime-type
text/plain
svn:eol-style
native
svn:keywords
Date Author Id Revision
Powered by Google Project Hosting