List Info

Thread: Re: Connect through proxy server




Re: Connect through proxy server
user name
2007-11-06 04:09:35
Hi,

I read this post and I had a similar problem. I'm trying to
get the JXMapKit to work. From my NetBeans (PreviewDesign)
it is no problem to receive the map (from OpenStreetMap),
but if I start the project there occurs a ConnectException.

I've configured my proxy in the Java JREs/JDKs in the system
settings and also in NetBeans. But I think that the
proxyserver blocks the map request.

How I have to use the ProxySelector? With the following code
snippet I tried to use your code i30817.

/*
 * JCartographicWebClient.java
 *
 * Created on 6. November 2007, 09:54
 */
package com.xxx.cawec;

import
com.xxx.cawec.webhelper.AuthentificationProxySelector;
import java.net.ProxySelector;

/**
 *
 * author  
 */
public class JCartographicWebClient extends
javax.swing.JPanel {

    /** Creates new form JCartographicWebClient */
    public JCartographicWebClient() {
        AuthentificationProxySelector ps = new
AuthentificationProxySelector();
       
ps.setProxyMode(AuthentificationProxySelector.ProxyMode.SYST
EM_PROXY);
        ProxySelector.setDefault(ps);
        initComponents();
    }

    /** This method is called from within the constructor
to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this
method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed"
desc="Generated Code">
    private void initComponents() {

        jXMapKit1 = new org.jdesktop.swingx.JXMapKit();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTree1 = new javax.swing.JTree();
        jComboBox1 = new javax.swing.JComboBox();

       
setBorder(javax.swing.BorderFactory.createBevelBorder(javax.
swing.border.BevelBorder.RAISED));

        jScrollPane1.setViewportView(jTree1);

        jComboBox1.setModel(new
javax.swing.DefaultComboBoxModel(new String[] { "Item
1", "Item 2", "Item 3", "Item
4" }));

        org.jdesktop.layout.GroupLayout layout = new
org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
           
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.L
EADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING,
layout.createSequentialGroup()
                .add(jXMapKit1,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 549,
Short.MAX_VALUE)
               
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
               
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLay
out.LEADING, false)
                    .add(jComboBox1, 0,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
                    .add(jScrollPane1,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 151,
Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
           
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.L
EADING)
            .add(jXMapKit1,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 565,
Short.MAX_VALUE)
            .add(layout.createSequentialGroup()
                .add(jComboBox1,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(3, 3, 3)
                .add(jScrollPane1,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 540,
Short.MAX_VALUE))
        );
    }// </editor-fold>
    // Variables declaration - do not modify
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTree jTree1;
    private org.jdesktop.swingx.JXMapKit jXMapKit1;
    // End of variables declaration
}


Sorry for my english, but its not my native language!
[Message sent by forum member 'schwarzo' (schwarzo)]

http://forums.java.net/jive/thread.jspa?messageID=244037


------------------------------------------------------------
---------
To unsubscribe, e-mail: jdnc-unsubscribejdnc.dev.java.net
For additional commands, e-mail: jdnc-helpjdnc.dev.java.net


Re: Connect through proxy server
user name
2007-11-06 04:15:55
Sorry for posting again, but i got the code to work by
adding/changing these lines:
       
ps.setProxyMode(AuthentificationProxySelector.ProxyMode.MANU
AL_PROXY);
        ps.setHttpProxy("192.168.1.7");
        ps.setHttpPort(8080);
[Message sent by forum member 'schwarzo' (schwarzo)]

http://forums.java.net/jive/thread.jspa?messageID=244038


------------------------------------------------------------
---------
To unsubscribe, e-mail: jdnc-unsubscribejdnc.dev.java.net
For additional commands, e-mail: jdnc-helpjdnc.dev.java.net


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )