Search Results

Search found 2 results on 1 pages for 'matdan'.

Page 1/1 | 1 

  • InvalidAttributeValueException when using non-ascii characters in JNDI

    - by matdan
    Hi, I have some trouble using JNDI since it accepts only 7-bits encoded parameters. I am trying to change an LDAP entry using JNDI with the following code : Attribute newattr = new BasicAttribute("userpassword", password); ModificationItem[] mods = new ModificationItem[1]; mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, newattr); context.modifyAttributes("uid=anID,ou=People,o=MyOrganisation,c=com", mods); If my password contains only ascii characters, it works perfectly, but if I use a non-ascii character, like "à", I have this error message : javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 19 - The value is not 7-bit clean: à]; My ldap supports those characters so I guess it comes from JNDI. Does anyone know how to fix that? Am I supposed to convert my parameter? How can I do that easily? Thanks

    Read the article

  • Http authentication with apache httpcomponents

    - by matdan
    Hi, I am trying to develop a java http client with apache httpcomponents 4.0.1. This client calls the page "https://myHost/myPage". This page is protected on the server by a JNDIRealm with a login form authentication, so when I try to get https://myHost/myPage I get a login page. I tried to bypass it unsuccessfully with the following code : //I set my proxy HttpHost proxy = new HttpHost("myProxyHost", myProxyPort); //I add supported schemes SchemeRegistry supportedSchemes = new SchemeRegistry(); supportedSchemes.register(new Scheme("http", PlainSocketFactory .getSocketFactory(), 80)); supportedSchemes.register(new Scheme("https", SSLSocketFactory .getSocketFactory(), 443)); // prepare parameters HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, "UTF-8"); HttpProtocolParams.setUseExpectContinue(params, true); ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, supportedSchemes); DefaultHttpClient httpclient = new DefaultHttpClient(ccm, params); httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); //I add my authentication information httpclient.getCredentialsProvider().setCredentials( new AuthScope("myHost/myPage", 443), new UsernamePasswordCredentials("username", "password")); HttpHost host = new HttpHost("myHost", 443, "https"); HttpGet req = new HttpGet("/myPage"); //show the page ResponseHandler<String> responseHandler = new BasicResponseHandler(); String rsp = httpClient.execute(host, req, responseHandler); System.out.println(rsp); When I run this code, I always get the login page, not myPage. How can I apply my credential parameters to avoid this login form? Any help would be fantastic

    Read the article

1