//* Licensed Materials - Property of IBM *
//* eu.abc4trust.pabce.1.14 *
//* (C) Copyright IBM Corp. 2012. All Rights Reserved. *
//* US Government Users Restricted Rights - Use, duplication or *
//* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
//* *
//* This file is licensed under the Apache License, Version 2.0 (the *
//* "License"); you may not use this file except in compliance with *
//* the License. You may obtain a copy of the License at: *
//* http://www.apache.org/licenses/LICENSE-2.0 *
//* Unless required by applicable law or agreed to in writing, *
//* software distributed under the License is distributed on an *
//* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
//* KIND, either express or implied. See the License for the *
//* specific language governing permissions and limitations *
//* under the License. *
//*/**/****************************************************************
package eu.abc4trust.ri.ui.user;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PostServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doPost(final HttpServletRequest req,
final HttpServletResponse resp) throws ServletException,
IOException {
// super.doPost(req, resp);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println("Incoming request to PostServlet at " + dateFormat.format(cal.getTime()) + " with parameters:");
System.out.println("user-nonce: " + req.getParameter("user-nonce"));
System.out.println("resource: " + req.getParameter("resource"));
System.out.println("policy: " + req.getParameter("policy"));
System.out.println("successURL: " + req.getParameter("successURL"));
System.out.println("failureURL: " + req.getParameter("failureURL"));
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
Container.INSTANCE.addPresentation(
URLEncoder.encode(req.getParameter("user-nonce"), "UTF-8"),
new PresentationContainer(req.getParameter("resource"), req
.getParameter("policy"), req.getParameter("successURL"), req.getParameter("failureURL")));
resp.sendRedirect("/user-ui?userNonce=" + URLEncoder.encode(req.getParameter("user-nonce"), "UTF-8"));
}
}