hey Peppe, check r4476. i made it reuse the existing WMSRequest classes to avoid implementing additional http auth code.
..ede On 05.06.2015 11:01, Giuseppe Aruta wrote: > Hi Jukka, > can you send me a WMS url with relative User/Password? I want to check a > possibility to set them on asking GetLegendGraphic URL > Peppe > > 2015-06-05 9:59 GMT+02:00 Giuseppe Aruta <giuseppe.ar...@gmail.com > <mailto:giuseppe.ar...@gmail.com>>: > > I think also that Kosmo request to WMS Styles and Legends starts > probably together with a WMS layer request. Since I didn't want to modify > any original WMS OJ classes, OJ WMS legend plugin calls after a WMS is loaded. > Infact there is a small delay on OJ whenever a user ask for a legend, > comparing to the same process on Kosmo > > 2015-06-05 9:54 GMT+02:00 Giuseppe Aruta <giuseppe.ar...@gmail.com > <mailto:giuseppe.ar...@gmail.com>>: > > Hi Jukka, > thanks for the quick answer. > Regarding user/password of WMS, I can see that the code comes from > SelectUrlWithAuthPanel.class but I don't see where these datas are stored on > WMS classes ( or maybe not, they are only asked at the beginning of the WMS > request process). > > > This plugin is relatively simple. If you have time you can see the > code on class org.openjump.core.ui.plugin.wms.WMSLegendPlugIn. > > The core of legend request is Line 71, the String > getLegendUrl(PlugInContext context, String names). > The String is divided into 3 parts: > a) PlugInContext refers to WMS layer where to extract the URL calling > layer.getService().getServerUrl(). > b) while String "names" is the name of the WMS layer. > c) the rest of the code calls GetLegendGraphic, Version, etc, > including some graphical components for the legend. > > I don't have experience with WMS. I understood from your code > (https://username:pas...@site.fi/cgi-bin/service1?) that that user/password > should before the the server URL string (part a of String getLegendUrl) . > If so, and if OJ memorize somewhere those datas, it should be easy to > modify this String to get Legends from WMS withcredentials. > Otherwhise I should build "ad hoc" another panel where users have to > enter those info again. > > Regarding ChangeWMSStyleDialogPlugIn, I gave a look to it thinking to > port to OpenJUMP. While GetLegend is relatively easy as it is shown a new > image on a separate panel, for the Style it should redraw the workbench. > Which I still don't know how to do. > > I really appreciate any comment or help on the code from you. > > Best Regards > > Peppe > > > 2015-06-04 17:56 GMT+02:00 Rahkonen Jukka (MML) > <jukka.rahko...@maanmittauslaitos.fi > <mailto:jukka.rahko...@maanmittauslaitos.fi>>: > > Hi Peppe,____ > > __ __ > > Seems to work with Geoserver and it generates also a correct URL > for Mapserver so it should work. However, there is some little issue with > sites using basic authentication. I think that the plugin is sending the > request without credentials or something like that. Note that the error log > shows URL as____ > > URL: https://username:pas...@site.fi/cgi-bin/service1? and if I > copy the whole URL into browser I get the legend graphics. However, OpenJUMP > gets an http 401 “not authorized” response.____ > > __ __ > > __ __ > > javax.imageio.IIOException: Can't get input stream from URL!____ > > at > javax.imageio.ImageIO.read(Unknown Source)____ > > at > org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.getLegendPanel(WMSLegendPlugIn.java:150)____ > > at > org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.execute(WMSLegendPlugIn.java:48)____ > > at > com.vividsolutions.jump.workbench.plugin.AbstractPlugIn$1.actionPerformed(AbstractPlugIn.java:342)____ > > at > javax.swing.AbstractButton.fireActionPerformed(Unknown Source)____ > > at > javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)____ > > at > javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)____ > > at > javax.swing.DefaultButtonModel.setPressed(Unknown Source)____ > > at > javax.swing.AbstractButton.doClick(Unknown Source)____ > > at > javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)____ > > at > javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown > Source)____ > > at > java.awt.Component.processMouseEvent(Unknown Source)____ > > at > javax.swing.JComponent.processMouseEvent(Unknown Source)____ > > at > java.awt.Component.processEvent(Unknown Source)____ > > at > java.awt.Container.processEvent(Unknown Source)____ > > at > java.awt.Component.dispatchEventImpl(Unknown Source)____ > > at > java.awt.Container.dispatchEventImpl(Unknown Source)____ > > at > java.awt.Component.dispatchEvent(Unknown Source)____ > > at > java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)____ > > at > java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)____ > > at > java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)____ > > at > java.awt.Container.dispatchEventImpl(Unknown Source)____ > > at > java.awt.Window.dispatchEventImpl(Unknown Source)____ > > at > java.awt.Component.dispatchEvent(Unknown Source)____ > > at > java.awt.EventQueue.dispatchEventImpl(Unknown Source)____ > > at > java.awt.EventQueue.access$200(Unknown Source)____ > > at java.awt.EventQueue$3.run(Unknown > Source)____ > > at java.awt.EventQueue$3.run(Unknown > Source)____ > > at > java.security.AccessController.doPrivileged(Native Method)____ > > at > java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)____ > > at > java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)____ > > at java.awt.EventQueue$4.run(Unknown > Source)____ > > at java.awt.EventQueue$4.run(Unknown > Source)____ > > at > java.security.AccessController.doPrivileged(Native Method)____ > > at > java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)____ > > at > java.awt.EventQueue.dispatchEvent(Unknown Source)____ > > at > java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)____ > > at > java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)____ > > at > java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)____ > > at > java.awt.EventDispatchThread.pumpEvents(Unknown Source)____ > > at > java.awt.EventDispatchThread.pumpEvents(Unknown Source)____ > > at > java.awt.EventDispatchThread.run(Unknown Source)____ > > Caused by: java.io.IOException: Server returned HTTP response > code: 401 for URL: > https://username:pas...@site.fi/cgi-bin/service1?&SERVICE=WMS&REQUEST=GetLegendGraphic&VERSION=1.1.1&FORMAT=image/png&WIDTH=16&HEIGHT=16&legend_options=bgColor:0xFFFFEE;dpi:100;fontAntiAliasing:true;forceLabels:on&LAYER=tukialueet____ > > at > sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)____ > > at > sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown > Source)____ > > at java.net.URL.openStream(Unknown > Source)____ > > ... 42 more____ > > __ __ > > -Jukka Rahkonen-____ > > __ __ > > __ __ > > Giuseppe Aruta wrote:____ > > __ __ > > The plugin will be available on OJ 4474 Night Snapshot____ > > __ __ > > 2015-06-04 15:24 GMT+02:00 Giuseppe Aruta > <giuseppe.ar...@gmail.com <mailto:giuseppe.ar...@gmail.com>>:____ > > Dear Jumpers,____ > > I added on OpenJUMP a new plugin that displays WMS layer(s) > legend (if available) on a Dialog.____ > > This plugin is located on WMS Layer tree context menu, as "Show > WMS Layer Legend". ____ > > The code originally came from Kosmo SAIG and it was completely > rewritten in order to adapt WMS GetLegendGraphic and GetStyle operators > without modifing OJ WMS classes.____ > > Best Regards____ > > Peppe____ > > __ __ > > __ __ > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > <mailto:Jump-pilot-devel@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > ------------------------------------------------------------------------------ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel