This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Find proxy information from not native app

Tags: proxy proxy proxy
(comma "," separated)
User avatar
hpalma
Registered Member
Posts
5
Karma
0
OS
Hi,
i'm developing a Java application that at some point will need to detect the configured proxy in the running KDE4 environment.

I'm not looking for help on the Java code, i would just like to know where can i get this information from. Is there any system file i can read with this information ?

Thanks.
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
I think that KDE's proxy settings are stored in the kioslaverc config file.
Depending on distribution and user setup the usual locations are
$HOME/.kde/share/config or $HOME/.kde4/share/config
(see most local path in output of "kde4-config --path config")

KDE uses a hierachical config system where values specified in a group context are seen at a user context. Users can override these unless this is restricted by the system administrator.
In other words reading the file is most likely enough, but could not cover all cases.

Another option would be to use the kreadconfig tool to read the necessary keys, because this tool does understand the hierachical system.
E.g.
Code: Select all
kreadconfig --file kioslaverc --group "Proxy Settings" --key httpProxy


A third option could be to create a Java interface for retrieving proxy settings, creating one implementation using KDE's Java bindings and trying to load that at runtime.

There might be more options, so it might be worthwhile to also ask this on KDE's main developer mailing list: https://mail.kde.org/mailman/listinfo/kde-devel

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
User avatar
hpalma
Registered Member
Posts
5
Karma
0
OS
Thanks for your detailed answer.

anda_skoa wrote:I think that KDE's proxy settings are stored in the kioslaverc config file.
Depending on distribution and user setup the usual locations are
$HOME/.kde/share/config or $HOME/.kde4/share/config
(see most local path in output of "kde4-config --path config")

KDE uses a hierachical config system where values specified in a group context are seen at a user context. Users can override these unless this is restricted by the system administrator.
In other words reading the file is most likely enough, but could not cover all cases.

Another option would be to use the kreadconfig tool to read the necessary keys, because this tool does understand the hierachical system.
E.g.
Code: Select all
kreadconfig --file kioslaverc --group "Proxy Settings" --key httpProxy


A third option could be to create a Java interface for retrieving proxy settings, creating one implementation using KDE's Java bindings and trying to load that at runtime.

There might be more options, so it might be worthwhile to also ask this on KDE's main developer mailing list: https://mail.kde.org/mailman/listinfo/kde-devel

Cheers,
_


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient