package com.api.htsc.mobile;
import weaver.general.GCONST;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.util.Date;
import java.util.Enumeration;

/**
 *
 */
@Path("/htmobile/login")
public class HtscMobileLoginActionApi{

    @GET
    @Path("/openWorkflow")
    @Produces({MediaType.TEXT_PLAIN})
    public void index(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        try {

            String ecologyContentPath = GCONST.getContextPath();

            ///htoa/spa/workflow/static4mobileform/index.html?_random="+new Date().getTime()+"#/req" + params
            String params = "" ;
            Enumeration enu=request.getParameterNames();
            while(enu.hasMoreElements()){
                String name=(String)enu.nextElement();
                String value = request.getParameter(name);
                params += params=="" ? name+"="+value : "&"+name+"="+value;
            }
            String url = ecologyContentPath+"/spa/workflow/static4mobileform/index.html?_random="+System.currentTimeMillis()+"#/req?"+params;
            response.sendRedirect(url);
        } catch (IOException e) {
        }

        }

}
