Click here to Skip to main content
15,889,096 members
Home / Discussions / Java
   

Java

 
GeneralRe: Problem in using Spot Lights in Java3D(need to calculate direction) Pin
002comp31-Jan-10 23:58
002comp31-Jan-10 23:58 
GeneralRe: Problem in using Spot Lights in Java3D(need to calculate direction) Pin
42774801-Feb-10 0:33
42774801-Feb-10 0:33 
QuestionJava Pin
ammu2330-Jan-10 2:27
ammu2330-Jan-10 2:27 
AnswerRe: Java Pin
Richard MacCutchan30-Jan-10 2:49
mveRichard MacCutchan30-Jan-10 2:49 
GeneralRe: Java Pin
ammu2331-Jan-10 3:19
ammu2331-Jan-10 3:19 
GeneralRe: Java Pin
Richard MacCutchan31-Jan-10 3:33
mveRichard MacCutchan31-Jan-10 3:33 
GeneralRe: Java Pin
David Skelly1-Feb-10 22:31
David Skelly1-Feb-10 22:31 
QuestionDisplaying XML in a web browser Pin
numbskull2028-Jan-10 7:29
numbskull2028-Jan-10 7:29 
I want to return an XML document via HTTP. Here is the code:
package gmit;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;

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

public class XMLServlet extends HttpServlet {
	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
		response.setContentType("text/xml");
		
		File file = new File("../webapps/xml/WEB-INF/etc/flights.xml");
		FileInputStream in = new FileInputStream(file);
		PrintWriter out = response.getWriter();
		
		int i;
		while ((i = in.read()) != -1)
			out.write(i);
		in.close();	
	}



How do I execute this code? The goGet() method takes two parameters but I don't know what the parameters are.
AnswerRe: Displaying XML in a web browser Pin
Richard MacCutchan28-Jan-10 9:20
mveRichard MacCutchan28-Jan-10 9:20 
GeneralRe: Displaying XML in a web browser Pin
numbskull2028-Jan-10 9:23
numbskull2028-Jan-10 9:23 
GeneralRe: Displaying XML in a web browser Pin
Richard MacCutchan28-Jan-10 9:45
mveRichard MacCutchan28-Jan-10 9:45 
GeneralRe: Displaying XML in a web browser Pin
numbskull2028-Jan-10 12:31
numbskull2028-Jan-10 12:31 
GeneralRe: Displaying XML in a web browser Pin
Richard MacCutchan28-Jan-10 22:43
mveRichard MacCutchan28-Jan-10 22:43 
GeneralRe: Displaying XML in a web browser Pin
427748029-Jan-10 17:31
427748029-Jan-10 17:31 
GeneralRe: Displaying XML in a web browser Pin
Richard MacCutchan29-Jan-10 22:13
mveRichard MacCutchan29-Jan-10 22:13 
Questionhow to read a file in Binary mode? Pin
002comp26-Jan-10 23:53
002comp26-Jan-10 23:53 
AnswerRe: how to read a file in Binary mode? Pin
Richard MacCutchan27-Jan-10 2:12
mveRichard MacCutchan27-Jan-10 2:12 
QuestionConvert Java code to c++ Pin
002comp26-Jan-10 19:27
002comp26-Jan-10 19:27 
AnswerRe: Convert Java code to c++ Pin
427748026-Jan-10 20:04
427748026-Jan-10 20:04 
AnswerRe: Convert Java code to c++ Pin
Richard MacCutchan26-Jan-10 22:37
mveRichard MacCutchan26-Jan-10 22:37 
QuestionJava Array Sorting Problem Pin
bmnot26-Jan-10 8:40
bmnot26-Jan-10 8:40 
AnswerRe: Java Array Sorting Problem Pin
harold aptroot26-Jan-10 8:50
harold aptroot26-Jan-10 8:50 
GeneralRe: Java Array Sorting Problem Pin
bmnot26-Jan-10 11:17
bmnot26-Jan-10 11:17 
GeneralRe: Java Array Sorting Problem Pin
harold aptroot26-Jan-10 11:27
harold aptroot26-Jan-10 11:27 
GeneralRe: Java Array Sorting Problem Pin
bmnot26-Jan-10 11:39
bmnot26-Jan-10 11:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.