/*******************************************************************************
 *  Copyright 2017-2018 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 * 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 cdac.medinfo.sdk.dcm30_04.services.wadotest;

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

import cdac.medinfo.sdk.dcm30_04.services.wado.WADOServer;

/**
 * This Servlet can be used to accept a HTTP Request to retrieve a DICOM image,retrieve it from a C-MOVE SCP Server and send the DICOM image
 * over as a HTTP Response. 
 * 
 * Following are the parameters to be specified in the HTTP Request for retrieving the DICOM image:
 * 1) Request Type - Value should always be WADO.
 * 2) Study ID - Value should be a Study Instance UID of the Study existing on the C-MOVE SCP server.
 * 3) Series ID - Value should be a Series Instance UID of the Series that belongs to the above Study.
 * 4) Object ID - Value should be a SOP Instance UID of the SOP instance that belongs to the above Series.
 * 5) Content Type - Value should be the Content Type of the HTTP Response expected. Currently, application\dicom value is supported 
 * 					 as content type of the HTTP Response.
 * 
 * At least, one of the Study ID, Series ID, Object ID parameters should be specified in order to successfully retrieve the
 * DICOM image. All other parameter values can be specified as NULL. In case of some parameters being NULL, a single stream of multiple DICOM
 * images should be expected in the HTTP response.
 * 
 * Note that this Servlet, after getting the HTTP Request, forwards same Request to WADOServer instance created while
 * while context Initialization of Wado Application. Which internally creates a C-MOVE RQ with the specified 
 * parameters and sends it to the specified C-MOVE SCP.
 */
public class WadoServlet extends HttpServlet
{
	private static final long serialVersionUID = 1L;	

	public void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse)  throws ServletException
	{		
		((WADOServer)getServletContext().getAttribute("wadoserver")).doGet(httpRequest, httpResponse);
	}	
}
