Servlet as consumer application
I'm writing an application that I eventually expect not-so-sophisticated users to install on their home computers. The system acts as a server, and I'm developing it as a servlet running under Tomcat. What I'm afraid of is that my choice of these technologies is going to be beyond most people's abilities to properly install (once installed, the system is very simple to run).
I have several questions about this that I'm hoping someone can give some inputs to:
1) Running this thing is very easy, the trouble I believe is in the installation. To install Tomcat properly I need to go through several steps that aren't so easy for the unsophisticated user. Is there some selection of tools I can make that I can really just put on a cd and have it install in a simple way?
2) Is a system like this really beyond that average person's ability to install and run? Are there any consumer level products out there that are based on servlet technology?
3) My dependance on being a servlet is really very loose. As long as I can retrieve the information from the user's request and get an output stream to write my data to, I'm fine. What I mean by this is that this could just as easily have been written as a standard CGI program without the overhead/benefits of being a servlet (*I'm* doing development as a servlet as a convenience to me - the end result doesn't have to stay that way) . What technologies should I look at if I want to do this?
4) Anything else you can think of to help out?
Thanks a lot for any help.
Sander Smith
Are there any consumer level products out there that are based on servlet technology?There are very few consumer level products that are servers of any kind at all. The only ones I'm aware of are peer-to-peer file swapping networks. Besides, most consumers don't have a computer setup that even permits them to run a server, which could be a problem for your marketing plan. Perhaps those who do have such a setup will be more technically adept than the average person.
What does your application do?
Similar Messages
-
How to create a servlet in PAR Application
Hi Experts,
I want to create a servlet in PAR application. This servlet should be capable of accessing the functions of other java files included in PAR Application. Servlet should be capable of accessing the functions say doContent(req, resp) of any class of PAR application.
Is it possible to create Servlet in PAR application?
I created one servlet but unable to declare its information in Deployment Descriptor.
Because the deployment which is provide ie portalapp.xml doesnt allow us to write tags like <servlet-name>, <servlet-mapping>, <url-pattern> etc. These are necessary for declaration of servlet.
So how can i write a complete working Servlet under PAR application?
Please help and replies will be appreciated.Hi,
Depending upon your usecase there are different ways to implement this logic.
Check this for example (Read my answer in this post):
https://forums.sdn.sap.com/thread.jspa?threadID=349151
Also check these senarios:
http://help.sap.com/saphelp_nw70/helpdata/en/42/9ddf20bb211d72e10000000a1553f6/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/42/9ddcc9bb211d72e10000000a1553f6/frameset.htm
Also the delegation may be interesting for you:
http://help.sap.com/saphelp_nw70/helpdata/en/a0/44b742cafec96ae10000000a155106/frameset.htm
Greetings,
Praveen Gudapati -
Servlets Vs Standalone Application?
Servlets Vs Standalone Application?
I know this is an extremely broad subject, but put very simply can anyone give me a basic list of pros & cons in writing an application on a network with either of the two mentioned technologies?!?
We will need security, efficiency, speed etc as well as an intuitive interface!!
Not much to ask i know!
cheers now!Servlets:
+Easier to deploy
+Upgrading easier (Just upgrade one instance)
-Interface somewhat limited
+Security is centralized
Standalone
-You have to deploy to every client
-Upgrading is cumbersome, especially when the new version is not backwards compatible, and you need a big bang upgrade.
+Highly interactive interfaces (Swing)
-Security can be a problem (e.g. clients can be forged), when it is not centralized.
The speed of the application is dependent on the kind of application. It depends on the complexity of the UI, whether data is on a central server or local, etc.
--Arnout -
Want to deploy Servlet in Oracle Application Server R12
Hi,
I am trying to deploy the developed servlet in Oracle applications server.
But I am not getting the console for the same, can anyone help me finding the way to achieve the same.
Thanks in advance...
Regards
NaimOracle follows the sun standards, you can save your application jsps to
ORACLE_HOME\j2ee\home\applications\MyApp and it gets automatically deployed (and ofcourse the servlet classes under the WEB-INF/classes) -
Consumer application using ETW events for TCPIP tarffic message
I am planning to build a consumer application using ETW events in real time mode. My application is already set with EVENT_TRACE_REAL_TIME_MODE for KERNEL_LOGGER_NAME. And successfully consume the Registry and file events.
Interested in consuming Network events for TCP/UDP and looking for sample code (C++) that gets relevant data from _EVENT_RECORD structure.
Any sample application and relevant documentation will be of great help.
Thanks.I know they are in this kit
http://www.microsoft.com/en-us/download/details.aspx?id=3138
Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com -
How to send byte array and String values to servlet from Swing application
Hi all,
I am new to swing, servlet, and socket connection.
I have swing application to draw images and some input data. I dont know to send to server.
byte[] buf = baos.toByteArray();
URL servletURL = new URL("http://10.70.70.1:8080/servlet/SaveImage)
URLConnection conn = servletURL.openConnection();
conn.setDoOutput(true);
BufferedWriter out = new BufferedWriter( new OutputStreamWriter( conn.getOutputStream() ) );
out.write(buf&a=aaaa&b=bbbbb);
out.flush();
out.close();
can I do like this. Strings are received in server side perfect. but i cant get byte array data. Please help me.
Thanks in advance.<img src="myservlet">
In your myservlet:
response.setContentType("image/jpeg");
then write your image date via ImageIO that uses response output stream. -
Use jar file for one servlet in one application (not global in classpath)
I have a servlet application that needs a jar file to load with one particular servlet. If I put the classpath to the jar file in the jvm12.conf, the servlet loads fine. I can't run it like that, however, since I use another jar file by the same name in a different application. I would like to specify it only with the servlet that needs it. According to the online help file, it says more than one jar, zip, or class file can be specified in the servlet classpath, but that doesn't seem to be the case. We're running iPlanet 4.1. I've tried adding the classpath to the jar file after the classpath for the servlet itself (servlet.properties), but it gives the class not found error for that function. Is there a way to do this? Context.properties, maybe? I can't find any instructions on setting that up.
You might have better luck asking this question on a web server forum. This is an application server forum and most people here are going to more experienced with iAS.
David -
Connecting to Remote EJB from Servlet in same application
Please help!
I was able to connect to SessionBeans and EJB from my sample java client in OCJ4 but when I try to do same thing from my web application using servlets, I get the below NullPointerException error.
The JNDI lookup works fine using java client but difficult from a servlet.
I am sure there is something I am missing.
Thanks
This is what I do in the servlet:
public void init() throws ServletException, NamingException, CreateException, RemoteException
Context jndiContext = getInitialContext();
SessionCartEJBHome home = (SessionCartEJBHome)jndiContext.lookup("SessionCartEJBBean");
sessionEJB = null;
try{
sessionEJB = (SessionCartEJB) home.create();
}catch (Exception e)
e.printStackTrace();
private static Context getInitialContext() throws NamingException
Hashtable env = new Hashtable();
// Standalone OC4J connection details
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");
env.put(Context.PROVIDER_URL, "ormi://Princeton/ejb1");
return new InitialContext(env);
And when I call the following procedure, it blow up at the line sessionEJB.getLineItem(new Long(1304));
sessionEJB is a class variable.
void processCatalogPage(HttpServletRequest request,
HttpServletResponse response,
ActionMapping mapping,
HttpSession session
throws ServletException, IOException , Exception, FinderException{
try {
ActionForward actFor = null;
String itemId = request.getParameter("id");
if ( itemId != null ) {
String[] itemIds = new String[1];
itemIds[0] = itemId;
sessionEJB.getLineItem(new Long(1304));
actFor = mapping.findForward("catalog");
return (mapping.findForward("success"));
} catch (Exception ex)
ex.printStackTrace();
System.err.println(ex.toString());
throw new EJBException(ex.toString());
04/12/11 23:45:24 java.lang.NullPointerException
04/12/11 23:45:24 at com.alashoofi.Cart.processCatalogPage(Cart.java:187)
04/12/11 23:45:24 at com.alashoofi.Cart.execute(Cart.java:86)
04/12/11 23:45:24 at org.apache.struts.action.RequestProcessor.processActi
onPerform(RequestProcessor.java:484)
04/12/11 23:45:24 at org.apache.struts.action.RequestProcessor.process(Req
uestProcessor.java:274)
04/12/11 23:45:24 at org.apache.struts.action.ActionServlet.process(Action
Servlet.java:1482)
04/12/11 23:45:24 at org.apache.struts.action.ActionServlet.doGet(ActionSe
rvlet.java:507)
04/12/11 23:45:24 at javax.servlet.http.HttpServlet.service(HttpServlet.ja
va:740)
04/12/11 23:45:24 at javax.servlet.http.HttpServlet.service(HttpServlet.ja
va:853)
04/12/11 23:45:24 at com.evermind.server.http.ServletRequestDispatcher.inv
oke(ServletRequestDispatcher.java:765)
04/12/11 23:45:24 at com.evermind.server.http.ServletRequestDispatcher.for
wardInternal(ServletRequestDispatcher.java:317)
04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.processRe
quest(HttpRequestHandler.java:790)
04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.run(HttpR
equestHandler.java:270)
04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.run(HttpR
equestHandler.java:112)
04/12/11 23:45:24 at com.evermind.util.ReleasableResourcePooledExecutor$My
Worker.run(ReleasableResourcePooledExecutor.java:192)
04/12/11 23:45:24 at java.lang.Thread.run(Thread.java:534)
04/12/11 23:45:24 java.lang.NullPointerException
Dec 11, 2004 11:45:24 PM org.apache.struts.action.RequestProcessor processExcept
ion
WARNING: Unhandled Exception thrown: class javax.ejb.EJBExceptionAvi,
Thanks for your response. I am actually returning a new InitialContext in a function call in the servlet. What I have noticed though is that JDeveloper creates two ear files for the application. One for the ejbs called ejb1.ear and another for the web files webapp1.ear. These are located in the applications subdirectory in OC4J directory.
I know I have two projects in the application, model and viewController. I am just trying to follow the MVC pattern.
In short, I don't think the web and the ejbs are in same ear file. I made the web project depend on the ejbs though. There is an option to set such. I don't know how to tell JDeveloper to put them all in one ear file.
I will appreciate any suggestion.
Thanks
Matilda -
How to send a HTTP request to servlet in java application
I'm new in Java. I need to send a HTTP request with parameters to servlet in a java aplication. Here is my code. It can be compiled but always threw an exceptions when I ran it. Can anyone help?
package coreservlets;
import java.io.*;
import java.net.*;
public class PostHTTP
public static void main(String args[])
throws IOException, UnknownHostException {
try
// URL and servlet
URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
URLConnection c = myURL.openConnection();
c.setUseCaches(false);
c.setDoOutput(true);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
PrintWriter out = new PrintWriter(byteStream, true);
//parameters
String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
out.print(postData);
out.flush();
String lengthString = String.valueOf(byteStream.size());
c.setRequestProperty("Content-Length", lengthString);
c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
byteStream.writeTo(c.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader
(c.getInputStream()));
String line;
//String linefeed = "\n";
//resultsArea.setText("");
while((line = in.readLine()) != null) {
System.out.println(line);
//resultsArea.append(linefeed);
catch(IOException ioe) {
// Print debug info in Java Console
System.out.println("IOException: " + ioe);here are some updates to your code I haven't tested it running
post again if you still have trouble
URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
HttpURLConnection c = (HttpURLConnection)myURL.openConnection();
c.setDoInput(true);
c.setDoOutput(true);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
String lengthString = String.valueOf(byteStream.size());
c.setRequestProperty("Content-Length", lengthString);
c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
PrintWriter out = new PrintWriter(byteStream, true);
//parameters
String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
out.print(postData);
out.flush();
byteStream.writeTo(c.getOutputStream());
// connect
c.connect();
BufferedReader in = new BufferedReader(new InputStreamReader
(c.getInputStream()));
String line;
while((line = in.readLine()) != null)
System.out.println(line); -
Servlet context in application.xml does not appear to work
Hi all,
I have created a very simple servlet and an index.html file with a link
to it, then packaged it into a WAR file with the appropriate web.xml and
ias-web.xml files. I then created an application.xml file referencing
only this servlet and adding a context root. After deployment via
"iasdeploy deployapp simple.ear" and cycling the web server, I can reach
the welcome file (index.html) correctly
-"http://localhost/NASApp/simple". When I attempt to follow the link to
the servlet ("simple servlet") the URL ends
up as "http://localhost/NASApp/SimpleServlet" whereas it should be
http://localhost/NASApp/simple/SimpleServlet If I type that url in, the
servlet executes fine.
I've deployed this into Tomcat and get the behavior I expect. It appears
that the element in the application.xml file is ignored by
iAS.
I'm using iAS SP3 on Win2k (same problem on NT).
This is such a basic behavior that I can't believe this is an existing
bug. I must be doing something wrong...
Any ideas?
Thanks in advance,
-Glen
Files are attached.Can you show me some of your code? This works for me.
Also, you say that you are working with 6.0sp3. Are you sure? sp3 hasn't been
released yet, except in a very limited beta. (I believe only internally, but I
could be wrong about that.)
David
[email protected] wrote:
Hi all,
I have created a very simple servlet and an index.html file with a link
to it, then packaged it into a WAR file with the appropriate web.xml and
ias-web.xml files. I then created an application.xml file referencing
only this servlet and adding a context root. After deployment via
"iasdeploy deployapp simple.ear" and cycling the web server, I can reach
the welcome file (index.html) correctly
-"http://localhost/NASApp/simple". When I attempt to follow the link to
the servlet ("simple servlet") the URL ends
up as "http://localhost/NASApp/SimpleServlet" whereas it should be
http://localhost/NASApp/simple/SimpleServlet If I type that url in, the
servlet executes fine.
I've deployed this into Tomcat and get the behavior I expect. It appears
that the element in the application.xml file is ignored by
iAS.
I'm using iAS SP3 on Win2k (same problem on NT).
This is such a basic behavior that I can't believe this is an existing
bug. I must be doing something wrong...
Any ideas?
Thanks in advance,
-Glen
Files are attached.
Name: simple.ear
simple.ear Type: application/x-unknown-content-type-ear_auto_file
Encoding: base64
Description: filename="simple.ear" -
How to call a servlet from Webdynpro application
Hi All,
I am new to SAP . I have requirement to call a SERVLET which is on a different application server from my webdynpro application , the servlet will return a file .. i need to display that file to the user .. can some one tell me how this can be done .. If possibel please provide some sample code.
Regards,
Tarun.Hi
Check this
1. How to access Servlet information from a webdynpro application ?
Regards
Abhijith YS -
How to invoke a Servlet method from application
please help me.the scenario is as follows
1)a servlet is placed on the server and application has invoked servlet with URL and URL Connection class
but how do i call a certain method of servlet on the server from the application.Let suppose the servlet's method to be invoked is print(String s).How it can be done from application.As GrayMan suggested, Servlets are intended to be used for HTTP communication.
If you want to open common logic to multiple clients, use EJBs, CORBA or some type of Web Service (SOAP, XML-RPC).
When you send a request to a servlet, the doPost or doGet method will be invoked. Products such as STRUTS allow you do 'map' to other classes. I suggest avoiding this.
Personally, I avoid STRUTS like a bad disease. Using STRUTS instead of just learning Servlets/JSP adds a lot of overhead. I prefer performance over development time. A good example of this is that ANY request that comes in over the WEB has ALL variables from the calling page (text boxes, radio buttons and such) made avaialable through the HttpServletRequest.getParameter(String parameterName) method. STRUTS requires you to build a subclass of it's ActionForm classes that is nothing more than a JavaBean with fields that match that of the web page. STRUTS will look at all the parameters in the request and all the fields in the Bean and assign any matches from the request to the Bean. The Bean is instanciated and the matching logic performed just to give you access to objects you already have access to.
Just my 2 cents, avoid STRUTS like an STD. -
How to invoke a servlet from an application-URGENT
Hi,
My requirement is as follows :
I have to invoke a servlet from a client application. I am using
java.net.URL and java.netURLConnection classes to
open a connection and invoke the servlet.
I am using WebLogic5.1
my code snippet is as follows :
URL url = new URL("http://localhost:7001/urlservlet");
URLConnection connection = url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setDoInput(true);
PrintStream outStream = new PrintStream( connection.getOutputStream() );
outStream.print("message=hai");
outStream.flush();
outStream.close();
When I execute the application, Webloigc server console is displaying the
following line.
<Listen Thread> Adding Address : <machine name><ip address>
But the service method of servlet is not getting invoked at all.
Help me to find the answer.
Jeelani
jeelani <[email protected]> wrote:
> Hi Dimitri,
> Thanks a lot.That worked for me.
> But if I want to send java objects (Vectors,beans),what is the best way to
> do it.
> This is exactly what our requirement is..
If you want to send Java object you have to use POST:
URLConnection conn = ...
conn.setDoOutput(true); // makes this a POST
OutputStream os = conn.getOutputStream();
...write your objects here...
os.flush();
os.close();
InputStream in = conn.getInputStream(); // sends data to the server and
// opens input stream
..read servlet response..
.. ot just close the stream...
in.close();
> my client application need to send some java components to our main server
> located in our head office.The servlet will read the objects and execute the
> functionality..
> I really appreciate for the fast response from you.
> Dimitri Rakitine <[email protected]> wrote in message
> news:[email protected]...
>> Try it like this:
>>
>> URL url = new URL("http://localhost:7001/urlservlet?message=hai");
>> URLConnection connection = url.openConnection();
>> InputStream in = connection.getInputStream();
>> in.close();
>>
>>
>> jeelani <[email protected]> wrote:
>> > Thanks for the quick response.
>>
>> > Actually right now it doesn't matter whether it is by GET or by POST.
>> > Add my clinet application just needs to send data to Servlet and nothing
> to
>> > get in return.Thats why I am using connection.getOutputStream().
>>
>> > since application will not be reading anything from servlet, I don't
>> > think it is required to use connection.getInputStream().
>> > (I am sorry, if I am wrong).
>>
>> > Can you please help me out. weblogic server is able to get the address
>> > from where the request is coming. Only problem is servlet is not getting
>> > invoked.
>>
>> > regards,
>> > Jeelani
>>
>>
>> > Dimitri Rakitine <[email protected]> wrote in message
>> > news:[email protected]...
>> >> Are you trying to do get or post? First you set method to GET
>> >> and then you do the POST.
>> >>
>> >> And add InputStream is = connection.getInputStream() - that will
>> >> result in HttpURLConnection sending data to the server and getting
>> >> back the response.
>> >>
>> >> jeelani <[email protected]> wrote:
>> >> > Hi,
>> >>
>> >> > My requirement is as follows :
>> >>
>> >> > I have to invoke a servlet from a client application. I am using
>> >> > java.net.URL and java.netURLConnection classes to
>> >> > open a connection and invoke the servlet.
>> >>
>> >> > I am using WebLogic5.1
>> >>
>> >> > my code snippet is as follows :
>> >>
>> >> > URL url = new URL("http://localhost:7001/urlservlet");
>> >>
>> >> > URLConnection connection = url.openConnection();
>> >>
>> >> > connection.setRequestMethod("GET");
>> >> > connection.setDoOutput(true);
>>
>> >> > PrintStream outStream = new
>> > PrintStream( connection.getOutputStream() );
>> >> > outStream.print("message=hai");
>> >> > outStream.flush();
>> >> > outStream.close();
>> >>
>> >> > When I execute the application, Webloigc server console is displaying
>> > the
>> >> > following line.
>> >>
>> >> > <Listen Thread> Adding Address : <machine name><ip address>
>> >>
>> >> > But the service method of servlet is not getting invoked at all.
>> >>
>> >> > Help me to find the answer.
>> >>
>> >> > Jeelani
>> >>
>> >> --
>> >> Dimitri
>> >> http://dima.dhs.org
>>
>>
>>
>> --
>> Dimitri
>> http://dima.dhs.org
Dimitri
http://dima.dhs.org
-
When to choose JSP and When to choose Servlet in Web Application
Hi,
I know that using JSP over servlet has only one advantage like for huge Application you can devide presentation layer from business logic. Is there any other advantage.
Also, if anyone can tell me how to handle FTP request in Servlet as HttpServlet supports only HTTP.
Thanks.
SubsDepends on what you're rying to accomplish. If you want to generate a bunch of HTML then JSP is the way to go. If you just want to extend the server (i.e. add functionality that isn't specific to any one screen of your application), then Servlets are the way to go.
Additionaly, if you have a lot of HTML forms, and want to do it right, check out Struts. This would be the case if you wanted to both extend the server and generate HTML. It's an MVC framework available from Jakarta. It's fairly tried and true at this point. It makes it very easy to maintain, extend, and develop with. It also comes with a wealth of custom tag libraries out of the box. I have developed two projects with it so far and find it a pleasure to work with.
http://jakarta.apache.org/struts/index.html
Regards,
Kyle -
Adding multiple servlets under same application
Hi,
We are trying to add multiple servlets (2 to be precise) to an Application.
We are using j2ee1.3 server and deploytool for deploying the same.
Is it possible to have a single context root in which i'll be able to place both servlets with different aliases to access them?
The moment I specify same contextRoot in Web context tab of Application, i get an error saying Deployment failed because "mycontextroot" already exists.
When I assign two different context roots to each servlet, they can function, but then the URL for each changes inspite of being in the same application.
Any suggestions are welcomed.
Thank you,
Manish.Hi,
I did not quite follow the solution and I am wondering if it will solve a problem I am having.
I wish to define multple jax-rpc endpoints, but I want the classes servicing those endpoints to be able to communicate with one another. I tried placing them both in the same war and entering two endpoints in the jaxrpc-ri.xml file, but it didn't like the second endpoint entry being there.
Is there a way to do this?
Maybe you are looking for
-
IPod detected by Windows but not by ipod apps; installation freezes
Hello As the installation CD felt out of the box I did not read the warning label that I first should install the drivers and then connect the ipod, probably this was a bad idea.. Now I cannot install the iPod nano software. The CD tries to detect th
-
Cisco IPSec VPN Client and sending a specific Radius A-V value to ACS 5.2
This setup is to try routing Cisco VPN to either RSA or Entrust from Cisco ACS 5.2, depending on some parameter in incoming AUTH request from Cisco IPSec VPN Client 5.x. Tried playing with pcf files and user names/identity stores, none seems working
-
Strange Error When Opening Logic
Hi all. I'm using Logic Pro version 7.2.3, and I'm getting a weird error that reads as follows: "Error reading/writing file "com.apple.logic.pro.cs": Logical end-of-file reached" I'm able to load files, but unable to hear anything or do anything. Any
-
Hi, The below mentioned link is with reference to a question which has been asked by the user regarding how to encrypt pl./sql programs .. and the answer which has been given is using WRAP command ,.. Encrypt PL/SQL At the same stage, later on, if I
-
Protocol used by WRT160NL to share USB
Do you know which protocol is used by the WRT160NL to share the contents of the USB drive?? I've read in several places that NFS is a much better protocol than Samba in terms of speed and efficiency. As WRT160NL is Linux-based, is it possible that wi