$("body").on("click",".new_layer", function() { dialog("Create new layer", "Enter your layer name", "_input", { OK: function() { // There must be a way to get the input from here using this, if it is a standard library. If you wrote your own, make the value retrievable using something other than a class selector (horrible performance + scoping +multiple instance issues) // This is where the view comes into play. Instead of cloning, bind the rendering into a JS prototype, and instantiate it. It means that you only have to modify stuff in one place, you don't risk cloning events with it, and you can test your Layer stand-alone var newLayer = new Layer(); newLayer .setName(name) .bindToGroup(parent); } }); });
private HTTPClient getHTTPClient(HTTPStoreInfo info) { String capabilitiesURL = info.getCapabilitiesURL(); // check for mock bindings. Since we are going to run this code in production as well, // guard it so that it only triggers if the MockHttpClientProvider has any active binding if (TestHttpClientProvider.testModeEnabled() && capabilitiesURL.startsWith(TestHttpClientProvider.MOCKSERVER)) { HTTPClient client = TestHttpClientProvider.get(capabilitiesURL); return client; } HTTPClient client; if (info.isUseConnectionPooling()) { client = new MultithreadedHttpClient(); if (info.getMaxConnections() > 0) { int maxConnections = info.getMaxConnections(); MultithreadedHttpClient mtClient = (MultithreadedHttpClient) client; mtClient.setMaxConnections(maxConnections); } } else { client = new SimpleHttpClient(); } String username = info.getUsername(); String password = info.getPassword(); int connectTimeout = info.getConnectTimeout(); int readTimeout = info.getReadTimeout(); client.setUser(username); client.setPassword(password); client.setConnectTimeout(connectTimeout); client.setReadTimeout(readTimeout); return client; }
/** @deprecated use {@link #AbstractOpenWebService(OWSConfig)} */ public AbstractOpenWebService(final URL serverURL, int requestTimeout) throws IOException, ServiceException { this(serverURL, new SimpleHttpClient(), null); this.httpClient.setConnectTimeout(requestTimeout); this.httpClient.setReadTimeout(requestTimeout); }
/** @deprecated use {@link #AbstractOpenWebService(OWSConfig, Capabilities)} */ public AbstractOpenWebService(C capabilties, URL serverURL) throws ServiceException, IOException { this(serverURL, new SimpleHttpClient(), capabilties); }
@Override public void dispose() { delegate.dispose(); }
@Override public void setConnectTimeout(int connectTimeout) { delegate.setConnectTimeout(connectTimeout); }
/** * Sets the REQUEST parameter * * <p>Subclass can override if needed. */ protected void initRequest() { setProperty(REQUEST, "GetCapabilities"); // $NON-NLS-1$ } }
@Override public void setTryGzip(boolean tryGZIP) { delegate.setTryGzip(tryGZIP); }
@Override public String getContentType() { return delegate.getContentType(); }
@Override public String getResponseHeader(String headerName) { return delegate.getResponseHeader(headerName); }
@Override public HTTPResponse get(URL url) throws IOException { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("GET Request URL: " + url); return new LoggingHTTPResponse(delegate.get(url), charsetName); } else { return delegate.get(url); } }
@Override public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException { return delegate.post(url, postContent, postContentType); }
@Override public String getResponseCharset() { return delegate.getResponseCharset(); } }
@Override public String getUser() { return delegate.getUser(); }
@Override protected void initRequest() { super.initRequest(); }
@Override public boolean isTryGzip() { return delegate.isTryGzip(); } }
@Override public WFSServiceInfo getInfo() { return (WFSServiceInfo) super.getInfo(); }
@Override public String getPassword() { return delegate.getPassword(); }
/** * Set up the specifications used and retrieve the Capabilities document given by serverURL. * * @param serverURL a URL that points to the capabilities document of a server * @throws IOException if there is an error communicating with the server * @throws ServiceException if the server responds with an error */ public AbstractOpenWebService(final URL serverURL) throws IOException, ServiceException { this(serverURL, new SimpleHttpClient(), null); }