/*
 * @(#)TestServlet.java
 *
 * Copyright (C) 2007 Infocity Inc. All Rights Reserved.
 */
package sample;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.opensaml.SAMLBrowserProfile;
import org.opensaml.SAMLBrowserProfileFactory;

/**
 * TODO ƒNƒ‰ƒXŠT—v
 * 
 * @author Hiroshi.Ebata(INFOCITY)
 * @version $Revision: 1.0 $ $Date: 2007/04/18 13:48:19 $
 */
public class TestServlet extends HttpServlet {

	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		process(request, response);
	}

	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		process(request, response);
	}

	private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			SAMLBrowserProfile profile = SAMLBrowserProfileFactory.getInstance();
			SAMLBrowserProfile.BrowserProfileRequest bpr = profile.receive(request);
//			profile.receive(arg0, arg1, arg2, arg3, arg4, arg5)
			for(int i = 0; i < bpr.SAMLArt.length; i++) {
				System.out.println(bpr.SAMLArt[i]);
			}
			System.out.println(SAMLBrowserProfile.PROFILE_ARTIFACT_URI);
			System.out.println(SAMLBrowserProfile.PROFILE_POST_URI);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

}
