How-to: Not having to use '/servlet' in URL

All,
How would I go about modifying Tomcat so that I wouldn't have to use .../servlet... in the URL?
eg.
current:
http://myhost/servlet/loginServlet
configure to:
http://myhost/sBin/loginServlet
sBin (just an example) can be any other name
Is this possible?
Thanks.

in your .webapp file, change the value of the
<servlet-path> parameters to what you want it to be. i.e.
in default-app.webapp we find:
<servlet>
<name>snoop</name>
<description>snoop servlet</description>
<code>SnoopServlet</code>
<servlet-path>/servlet/snoop/*</servlet-path>
<servlet-path>/servlet/snoop2/*</servlet-path>
<init-parameter>
<name>param1</name>
<value>test-value1</value>
</init-parameter>
<autostart>false</autostart>
</servlet>
change /servlet/snoop/* to /sBin/snoop/* et al.

Similar Messages

  • How file dowloading concept works using servlets.

    How file dowloading concept works using servlets.
    We will get window when downloading something from site
    if we close that window downloading stops.
    how this process works if we use servlets .
    Or what are the general concepts for downloading a file

    How file dowloading concept works using servlets.You send a request and get a reply stream. Where the servlet gets the data from is totally irrelevant.
    We will get window when downloading something from
    site
    if we close that window downloading stops.
    how this process works if we use servlets .If you close that window, downloading stops.
    Or what are the general concepts for downloading a fileSend a request, get a reply stream.

  • How to get XML value using servlet?

    how to get values from a XML file using servlet ? Thank you.
    for example: how can I get the location value (aaa) from this XML file?
    abc.xml:
    <business>
    <location>aaa</location>
    </business>

    Try to use XML Parsers to do the job.
    Use DOM or SAX Parsers that are freely available.
    Some of the popular ones are xerces, DOM, SAX.

  • How to read a file using servlet

    hi ,
    i've to read a file using servlet ,
    should read the file using servlet and display it in JSP,Could anybody get me how can i do it .
    Shiva

    To do that you need to get the response output stream and write yur file contents to that.
    response.setContentType(mimeType); //Set the mime type for the response
    ServletOutputStream sos = resp.getOutputStream();
    sos.write(bytes from your file input stream);
    sos.close();

  • LoadMovie without having to use full path/URL

    I've always used loadMovie to call external swf files from a
    main/menu swf file, but it seems that some new security settings
    and restrictions, I'm not able to do this anymore - at least not
    online. All my swf files are in the same directory, and when I play
    the swf locally, it loads all the external swfs without a problem.
    I tried changing the path to my swf in the loadMovie command
    to the pull path on the server, and this worked. The problem is, I
    have to hand off my website to another company, and it will go
    through many rounds of testing (and servers) before eventually
    going online. Is there any way to avoid having to use the full
    path/domain in the loadMovie command for a situation like this
    where the domain/path will change?
    I have this in the Flash embed tag:
    <PARAM NAME="allowScriptAccess" VALUE="sameDomain" />
    I have this as my loadMovie command:
    loadMovie ("flashfile.swf", 1);
    But it only works when I have it like this, which is a
    problem because the URL will change many times before launch.
    loadMovie ("
    http://www.website/media/flashfile.swf",
    1);
    Any help would be appreciated!

    Yes, I've done this all the time too, and never had this
    problem, which is why I'm stumped.
    I've changed my code to this, with module_proxy being an
    empty movie clip. This works. But when I take out the URL and path,
    even though the swf files are in the same directory, it's doesn't
    play.
    loadMovie ("
    http://www.website/media/01_Mixie_Pixie_Telegram_Service.swf",
    "module_proxy");
    _parent.gotoAndPlay("dim_menu");
    //openCountdownFile();
    stop();
    Then, I tried to create a varible for the URL/domain, so I
    can change it out more easily (although when I hand this off, I
    won't be able to do that):
    var domainPath = "
    http://www.website/media/"
    function (openCountdownFile){
    var linkToSWF = domainPath + eval(PgFile[item_chosen]);
    loadMovie (linkToSWF, "module_proxy");
    parent.gotoAndPlay("dim_menu");
    var swfPageLabel = item_chosen.toString();
    gotoAndPlay(swfPageLabel);
    This doesn't seem to work either. So, if swf files SHOULD be
    able to communicate using loadMovie, why am I having this problem?
    Thanks.

  • How to disable client cookie using Servlet code

    Hi All,
              I want to disable the client cookie using JSP or servlet code.Is it possible how I can do it.
              Thanks in Advance .

    Hi,
              first of all, the URL rewriting option (URLRewritingEnabled) in the weblogic.xml must be set to true.
              Now, for all first-timer web requests the BEA WLS always uses URL rewriting in addition to cookies to see wether the browser accepts cookies or not.
              I would try to rip of all of the cookies in the header, then flush the response to force the http header to be written.
              I have never tried it and has no idea if it will work, however the teory behind supports the idea.
              This will not work for toggling session tracking mechanism from a session already established with cookies, the session will be lost if attempted to do this without the URL-rewriting enabled on the page.
              - Anders M.

  • How to get XML file using servlets that XI sent to my J2EE appl?

    Hi All!
    I have a scenario like XI sends xml file to j2ee application. In my J2EE application my servlet receives this xml. Will the xml file be in my HTTPServletRequest object? if so how to get that file from Request object.
    Please help me its urgent, Any code help is highly appreciated.
    My xml file will be like this:
    <ns0:Http_Message_Type_Demo
    xmlns:ns0="http://abcdemo.com">
    <Name>ABC</Name>
    <RollNo>123</RollNo>
    <Address>a-4</Address>
    </ns0:Http_Message_Type_Demo>
    somebody should help me!please
    Thanks

    Hi,
    You can use HTTPServletRequest object to get the XML payload.
    BufferedReader reader = request.getReader(); //gets XML payload
    String line = reader.readLine(); // to read the XML payload line by line
    (request is the HTTPServletRequest object)
    Regards,
    Uma

  • How to create crystal reports using servlets/jsp

    plase any body help me how to create and interact with crystal reports using java

    To use the inproc RAS SDK with CR.NET, you'd have to purchase either (1) Crystal Reports XI Release 2 Developer edition, and apply Service Pack 2 or above, or (2) Crystal Reports 2008 (not Crystal Reports Basic that comes with Visual Studio 2008).
    Sincerely,
    Ted Ueda

  • How to access serial port using servlet

    I want to communicate with a microcontroller connected to the serial port of my computer.
    *I am using the following:
    Windows 98 operating system
    Tomcat web server 4.1
    *The directory structure is as given:
    Tomcat 4.1/webapps/myjsp/web-inf/classes/remoteservlets.
    I have placed my jsp files in my jsp folder and classfiles in remote servlets folder.
    **my java program has compiled correctly.**
    ** my simple java application which accesses the serial port works fine.***
    *when I start tomcat I am able to access the sevlet as the servlet responds with the button name i have pressed.
    **** I have also tried the following
    Copied file comm.jar in <JAVA_HOME>\jre\lib\ext
    Copied file javax.comm.properties in <JAVA_HOME>\jre\lib
    Copied file win32com.dll in <JAVA_HOME>\lib and also in c:\windows\system32 and c:\windows\system
    ***************which helped me do away with errors.
    still I don't get any output. I dont get any errors either.
    PLEASE HELP. URGENT. i am at my wits end.
    Thank you.

    Servlet is the one which runs in the server side...if u want to comunicate with the serial port of the server in which ur servlet is running can be done but making use of Communication api available....
    U can download the Api from http://java.sun.com/products/javacomm/index.jsp
    There are three levels of classes in the Java communications API:
    High-level classes like CommPortIdentifier and CommPort manage access and ownership of communication ports.
    Low-level classes like SerialPort and ParallelPort provide an interface to physical communications ports. The current release of the Java communications API enables access to serial (RS-232) and parallel (IEEE 1284) ports.
    Driver-level classes provide an interface between the low-level classes and the underlying operating system. Driver-level classes are part of the implementation but not the Java communications API. They should not be used by application programmers.
    regards
    shanu

  • How to download a file using servlet

    I have a problem about downloading a file using a servlet.
    Anybody can help me?
    Thanks

    I am assuming that you want to write a servlet that, when invoked by a user (for instance, through a URL link), will download a file using the "save as" dialog (on Windows, for example) in the user's browser.
    In such a case, all you need to do is get the OutputStream from the response object, set the proper MIME type header, and write the file. Here is an (untested, not even compiled) skeleton.
    public class MyServlet extends HttpServlet {
    protected void doGet (HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    ServletOutputStream out = resp.getOutputStream ();
    resp.setContentType ("application/x-foobar");
    while (/* whatever */) {
    In this loop, you generate your "file's" data.
    You can compute it on the fly, pull it from a database,
    read it from a "real" file, or any other means you can dream up.
    The sample line below just writes some of the data (for example,
    a byte array) to the user's browser via the output stream out.
    out.write (data);
    out.flush ();
    Go to http://java.sun.com/j2ee/sdk_1.3/techdocs/api/index.html
    for the JavaDoc on the classes used.
    Cheers!
    Jerry Oberle

  • How  to create Tab pages using servlet

    I want to create a tab pages which can carry different pages. Can you help me on this?? Provided if you have some guideline or program which can help me.
    Thanks
    Message was edited by:
    wesleygch

    those kinda tab pages should be coded :) there is no built-in support for them!
    like BalusC wrote you better sould export the layout into CSS, then, you have the option of using javascript when switching between tabs.
    if you want to avoid using of javascript or you want to do it serverside, then you'll have to write that tab handling in your jsp page

  • How to check whether the browser supports cookie using servlet

    Hi
    I have a servlet that uses session.I want to check whether the browser supports cookie.
    Please help me how can i detect this using servlet.
    could you please include a sample code
    thanks
    sabu

    You can check whether any cookies were sent in the request to your servlet:
    Cookie cookies[] = request.getCookies();
    if cookies is not null (cookies != null) then the browser sending you the request suppoerts cookies.
    If it is null then you would need to do a little extra work. Basically add a cookie to the response going back to the browser. Then send a redirect back to this same servlet. You then would have to add code to check to see whether the cookie was sent back.
    // Servlet named myServlet
    String test = request.getParameter("TEST");
    Cookie cookies[] = request.getCookies();
    if (test == null || !test.equals("TRUE")
    if (cookies == null)
    response.addCookie("testCookies","testCookies");
    response.sendRedirect("myServlet?TEST=TRUE");
    else
    // cookies were sent in the initial request, so
    // browser supports cookies
    else
    // This is the redirect. Check the for the presence of
    // our testCookie
    Hope this helps.

  • How to parse the xml file using servlet

    My scenario is like this:
    <b>FILE-->XI-->J2EE Application</b>
    XI sends the xml file to j2ee application. My servlet receives the file in HTTPRequest string. 
    How to parse that file using servlets.I should get the xml file as it is and should be displayed in the browser.
    Can anyone please help me with code, its urgent.
    Please help me!

    Download this java code
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/work/Echo02.java
    in your servlet code you can write
    public void doPost(req,resp){
    DefaultHandler handler = new Echo02();
    handler.parse(req.getInputStream());
    Offcourse you will need to modify the code of Echo02 class a bit to suit your requirement which would finally retrun you a string and you can then write it using
    respose.getWriter().write(responseString);

  • When to use jsp,and when to use servlet?

    I think that jsp and servlet can realize the same functions, because when run a jsp, it is transferred to a servlet program, so when to use jsp and when to use servlet?
    I am now developing the input interface for a website, I just use jsp and javabean to connect to weblogic and database, and I didn't use servlet, Is there any unseemliness?
    Thank you!

    IMHO I use servlets to control the flow between my jsp's based on a number of factors in a webapp. For instance, user authorization. If a user has the authorization to conduct various administrative functions on an application (like change user rights, reset passwords etc) they will have access to specific buttons or links on some screens that others will not. I use servlets to establish what access rights a user has and direct them to the appropriate pages. I also use servlets to test data validity on form input screens. I know that I can also do this with JavaScript but that can be disabled by the client and in order to prevent that I also double check the form input from a servlet. All my jsp's do is display the results of a business process (which is held in a JavaBean or EJB) and the servlets act as the controllers for the application, connecting to multiple databases, verifying application state, flow control etc. I try to keep the jsp as simple as possible as some of them are maintained by html developers who lack the necessary experience to write java code. I hope this helps.

  • How to NOT shrink on nUp pageHandling

    Hi,
    I have a PDF with 2 A5 pages. I want to print these on 1 A4 page 2-up. Below is the javascript -
    var pp = this.getPrintParams();
    pp.interactive = pp.constants.interactionLevel.silent;
    pp.firstPage = 0;
    pp.lastPage = 1;
    pp.pageHandling = pp.constants.handling.nUp;
    pp.nUpPageOrders = pp.constants.nUpPageOrders.Vertical;
    pp.nUpNumPagesV = 2;
    pp.nUpNumPagesH = 1;
    this.print(pp);
    Problem is the A5s on the A4 are shrunk.
    Could someone please help how to not shrink while using nUp pageHandling.
    Thanks in advance

    You are making the printing process a bit difficult. You can simply go the the Adobe PDF printer properties and select to print 2-up. In Acrobat, there is an additional item in the print menu, but that shrinks the pages a bit further than using the 2-up process. Unfortunately, the 2-up process appears to put a border around the pages, though that is easy to remove with the object touchup tool. There is a slight reduction in size, but not bad. I know of no other way to do it with Acrobat. I did try one thing that might work for you. I printed with 2-up (under the printer properties) and also when into the advanced menu on the first tab and selected scaling to be 102%. That just about did the job of using the full size. The main thing that may happen there is that you will drop off some info at the sides if your original goes all the way to the edge of the A4 sheet.
    Just as a relative figure of merit, I made measurements on the screen for the 2-up versions. The one on the print menu put 0.75 cm on each side, .35 cm between, with 17.7 cm wide print areas. The one in the properties menu gave 0.2 cm on each side, 0.4 cm between and 18.2 cm print areas. My measurements appear to differ by 5mm total, but that gives you a rough idea. The 2-up from the properties screen sized things the best, but I had to deal with the border in that case. With the print menu option you have a choice about the borders -- could not find an option for the properties menu selection. A scale of 102 % should be about right to use the full width, but you will likely lose a bit of the info in that 0.2 cm portion about your print. The print menu option scaling did not seem to work, but seems to autoscale.
    I think this is about as close as you will come with Acrobat. If you have clear space around the outer edge of your document, then this 2-up property with scaling should do the job. I am not sure what scaling would work best for A4 to A5, I was using letter to letter. Guess you will have to play around a bit. If you have a lot, the border is going to be a pain.

Maybe you are looking for

  • Delivery log

    Hello Experts,               I need a mechanism by which i am able to track for a specific error while creating delivery from sales order . Error : Message class : VL           Message Number : 367 so is there any table which hold those error , how t

  • InterVideo WinDVR encountered a problem and needs to close (VOX USB 2.0)

    Device: MSI VOX USB 2.0 Driver: vox_1.1.0505.0.zip Software: msipvs_8609.zip (both driver and windvr software were download from official MSI site). Machine: Dell Latitude D600 with 1G memory Symptom: Installed ok, during starting the following is po

  • Help with optimize analitics query .

    HI, I've got Oracle 10.2.0.3 query like : select * from      select rank() over (partition by t1.customer_key order by      func(t1.klt_dlugosc,t1.klt_szerokosc,t2.gemfo_dlugosc,t2.gemfo_szerokosc),rownum) as id,      t1.customer_key,      func(t1.kl

  • Duel displays Mac pro not working properly

    I have a MacPro Tower that I bought 4 years ago that was running OS 10.5.x. I *just* finally got around to upgrading the OS (I've had Snow Leopard discs for over a year and never installed them), so that's what I upgraded to. I have two displays conn

  • HP Pavilion dv7 - 2012TX Hardware Upgrade

    Product: HP Pavilion dv7 Model #: dv7 - 2012TX p/n: NW975PA#ABG OS: Windows 7 Ultimate 32 bit This product has never been tampered with and is totally stock apart from installing windows 7 onto it. It is fairly old now and id like to upgrade it if po