incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Strässer (JIRA) <>
Subject [jira] Created: (CLEREZZA-108) problem with Cookie Authentication Bundle / Access via Java HTTP Call
Date Tue, 09 Feb 2010 10:47:30 GMT
problem with Cookie Authentication Bundle / Access via Java HTTP Call

                 Key: CLEREZZA-108
             Project: Clerezza
          Issue Type: Question
            Reporter: Oliver Strässer

I try to connect to the Trialox and have problems with the redirecting to the login screen.
I tried the following code to connect to the Trialox system.

if I deactivate the Clerezza - Platform Security Cookie Authentication Bundle, the code worked
correctly and the authentication is successful.
if I activate the bundle my response is:  Server returned HTTP response code: 500 for URL:

is that an error on my side or at the cookie bundle

How is the correct way ?

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
package test;


 * @author osr
public class Main {

     * @param args the command line arguments
    public static void main(String[] args) {
        System.out.println("Starting request");

        // TODO code application logic here

// Access the page
        try {
            Authenticator.setDefault(new MyAuthenticator());

            // Create a URL for the desired page
            URL url = new URL("http://localhost:8080/macc/content/");
            // Read all the text returned by the server
            BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
            String str;
            while ((str = in.readLine()) != null) {
                // str is one line of text; readLine() strips the newline character(s)
        } catch (MalformedURLException e) {
        } catch (IOException e) {
            System.out.println("IOException: " + e.getMessage());

    public static class MyAuthenticator extends Authenticator {
        // This method is called when a password-protected URL is accessed

        protected PasswordAuthentication getPasswordAuthentication() {
            // Get information about the request
            String promptString = getRequestingPrompt();
            String hostname = getRequestingHost();
            InetAddress ipaddr = getRequestingSite();
            int port = getRequestingPort();
            // Get the username from the user...
            String username = "admin";
            // Get the password from the user...
            String password = "admin";
            // Return the information
            return new PasswordAuthentication(username, password.toCharArray());

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message