Default Servlet
I am trying to deploy a war file with a servlet in there. I want it to be the default
servlet for the application. But I want the internal WebLogic servlets to respond
to the images,jsp,style sheet requests. I did what the documentation for 6.0 sp1
said and it does not seem to work like that. Does anybody have any suggestions.
I am trying to deploy a war file with a servlet in there. I want it to be the default
> servlet for the application.
I'm not sure what you mean by default servlet?
you can set up a mapping in web.xml
by default Weblogic (probably!) looks for index.html when you hit /context/.
so you can map the servlet to index.html.
and when the browser hits that context, your servlet will be called.
is that what you are trying to do?
Filip
~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
[email protected]
www.filip.net
"Sonu" <[email protected]> wrote in message
news:3af07efb$[email protected]..
>
> I am trying to deploy a war file with a servlet in there. I want it to be
the default
> servlet for the application. But I want the internal WebLogic servlets to
respond
> to the images,jsp,style sheet requests. I did what the documentation for
6.0 sp1
> said and it does not seem to work like that. Does anybody have any
suggestions.
>
Similar Messages
-
How can I have a default servlet and an index.html?
Hi,
I writing a small webapp to test/understand the 2.2 Servlet Spec. I am deploying this as a WAR to Orion, Tomcat and Silverstream.
The app's name is: "myapp"
My application has an index.html, which is listed as the sole welcome-file in the welcome-file-list element in the app's web.xml.
The interesting thing is that, after adding a default Servlet (<url-pattern>/</url-pattern>), I can no longer access the app's index.html either implicitly or explicitly:
1. Implicit:
- http://localhost/myapp
- http://localhost/myapp/
2. Explicit:
- http://localhost/myapp/index.html
- http://localhost/myapp/index.html/
All of these invoke the Default Servlet in all 3 app servers.
Question: How can I have both a default Servlet and an index page?
Thanks in advance.
Milesyou can define it in the web.xml file
look at the dtd, element "welcome-file-list" -
Unable to set root/main/default servlet in Tomcat 5.5
I'm on a shared hosting account with Tomcat 5.5 and cannot figure out why I can't set the default servlet. I want all incoming requests regardless of the relative path, to be handled by the Redirect servlet. There is only one servlet in the whole project.
Some examples
http://www.mydomain.com -> Redirect servlet (not working)
http://www.mydomain.com/ -> Redirect servlet (not working)
http://www.mydomain.com/a -> Redirect servlet
http://www.mydomain.com/blaldjflajdd -> Redirect servlet
With the below web.xml file, the last two above works just fine, but the first two gives a 403 error. What gives, I followed the Tomcat documentation to the teeth... It seems to work on my development server, but not on the shared hosting. Is this a setting anyone would block? Any help would be much appreciated.
The full web.xml setting below:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Redirect</display-name>
<servlet>
<display-name>Redirect</display-name>
<servlet-name>Redirect</servlet-name>
<servlet-class>com.somedomain.Redirect</servlet-class>
<init-param>
<param-name>host</param-name>
<param-value>www.myotherdomain</param-value>
</init-param>
<init-param>
<param-name>redirect-type</param-name>
<param-value>301</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Redirect</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>I tried adding other mappings as well that didn't work, such as :
<servlet-mapping>
<servlet-name>Redirect</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>What would happen if I try an empty url-pattern?
<servlet-mapping>
<servlet-name>Redirect</servlet-name>
<url-pattern></url-pattern>
</servlet-mapping>Any help would be much appreciated. I tried workarounds, by using an index.jsp file to supplement, but that isn't working quite right either. I prefer to have it setup properly though.... Please Help!!!tomcat does not compile servlets, only JSP's will be translated and compiled on the fly. You need to compile them yourself, possibly using ANT or an IDE like NetBeans or Eclipse to make it easier to deploy the changes.
-
i need to do considerable pre-processing of requests and would like
to isolate all the pre-processing logic to one servlet. the default
servlet ( as far as I understand ) is served when a resource cannot
be found therefore weblogic serves the default. what i need is
to specify all request come through a single 'preprocessor' servlet
which does all request preprocessing then forwards the request
to the requested URI. How can i achieve this ?
thanks in advance.
Hi,
You can make use of FileServlet which is the default servlet in
Weblogic. You can do any number of pre processing. You can achieve
this by extending the FileServlet class and overridding the appropriate
methods.
Regards
Ganesh
"derrick" <[email protected]> wrote:
>
>i need to do considerable pre-processing of requests and
>would like
>to isolate all the pre-processing logic to one servlet.
>the default
>servlet ( as far as I understand ) is served when a resource
>cannot
>be found therefore weblogic serves the default. what i
>need is
>to specify all request come through a single 'preprocessor'
>servlet
>which does all request preprocessing then forwards the
>request
>to the requested URI. How can i achieve this ?
>
>thanks in advance.
-
Request with URL ending with "/" not routed through default servlet
I have deployed a web application that has a controller servlet. This
servlet is configured (via web.xml) to be the default servlet with a servlet
mapping defined with url-pattern set to "/".
Requests for URLs such as "my.host/my/path" are correctly routed to the
controller servlet, whereas a request to "my.host/my/" is not - it causes a 404
to be returned immediately by the container.
Any help appreciated
PeterThere's not enough data in your post to answer the question directly. Posting an example URL would help a lot.
The chances are that the problem lies in the URL - it might contain some characters that are not directly usable in the shell and are therefore getting munged when you use them in 'do shell script'. There are ways around this, but posting an example URL would go a long way to telling if that's the problem or not.
It is also possible that the web site is configured to block specific user agents such as curl or wget (in a vain attempt to block automated downloads of the content) but, again, it's hard to say without knowing a specific URL.
If this is the case, you could use curl's -A switch to specify a different 'User-Agent' and fake out the server. For example, to pretend you're using Safari, use something like:
do shell script "curl -O -A 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.12+ (KHTML, like Gecko)' " & fullWeb
(note the single quotes around the User-Agent string) -
Tomcat 4.1.2 default servlet request handling
I have a problem which seems to be pretty common. I have a servlet that I would like to make the default servlet in my webapp. I have mapped the servlet to <url-pattern>/</url-pattern>. I would like this servlet to handle all requests, EXCEPT, for those with static content (images, .html files, etc.). The problem it seems is this: The Tomcat default servlet, which is also mapped to "/", in the /conf/web.xml file handles all static content. When I make my servlet the default servlet in my app, it overrides the tomcat default servlet, thus no static content is served. There must be a soulution to this problem other than writing a jsp redirect file??????
Thanks,
KevinYou can write a servlet which extends the default FileServlet of the tomcat.
and in the service method check if the reques is for *.jpg or *.html
If YES call super.service(); and return;
If NO continue your work..
There must be a soulution to this problem other than
writing a jsp redirect file??????Redirect !!! I guess it won't work. Redirect will again hit the servlet mapped with "/" .. and it goes on in a contnious loop.
Hope this helps. -
Default servlet for multi-homed web site
Chaps,
I would like to attach WebLogic to an Apache web server which is configured with
several virtual hosts (identified by different ServerName's in the httpd.conf
file).
Is it possible (and if so, how) to map different default Servlets to each virtual
host (i.e. map by host name)?
Example:
Apache config: one IP address, two virtual hosts for www.domain1.com and www.domain2.com
WL configuration (desired): defaultServlet1 for www.domain1.com (if no better
match found); defaultServlet2 for www.domain2.com (if no better match found)
TIA
Giorgio
weblogic.httpd.defaultServlet=yourRegisteredServlet
Gene Chuang
Teach the world. Join Kiko!
http://www.kiko.com/profile/join.jsp?refcode=TAF-gchuang
"Daniel Wabyick" <[email protected]> wrote in message
news:[email protected]..
>
> Hey,
>
> This is kind of a spin off a previous post - Does anyone know how to
> change the default servlet for a Web Application? We want to
> implement our own version of a servlet pipeline, and this seems like the
> way to go.
>
-
Enable a default servlet with special parameters for first time visitors?
On a website I am developing, inorder to see the default homepage, the
request must first go to a particular servlet with particular http
parameters.
So if you type www.mysite.com, this request will be caught on the
serverside and sent to:
http://mysite.com/myServlet?param1=blahblah.....etc...
How can enable this behavior? There is documentation about a
default servlet but I also need to pass parameters too it...
Thanks
Floyd
On a website I am developing, inorder to see the default homepage, the
request must first go to a particular servlet with particular http
parameters.
So if you type www.mysite.com, this request will be caught on the
serverside and sent to:
http://mysite.com/myServlet?param1=blahblah.....etc...
How can enable this behavior? There is documentation about a
default servlet but I also need to pass parameters too it...
Thanks
Floyd
-
Cannot invoke default servlet through invoker????
Does someone can help me with this exception? what it mean? How to solve? I'm using TomCat 4.0.6
The code i'm using...
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException{
String url = "/lis3d/servlets/index.html";
RequestDispatcher dispatcher =
this.getServletContext().getRequestDispatcher(url);
if(dispatcher ==null)
System.out.println("Dispatcher == null");
else{
try{
dispatcher.include(req, res);
}catch (ServletException e){e.printStackTrace();}
}There�s a reason why cannot be any static content like html
The dispatching uses the POST method from the HTTP protocol and html files can only be retrieved with GET method. If you wanna avoid a overhelm that might occur in your server because of the use of a dynamic content(like a login page) you can use the sendRedirect() method that redirects throught a GET to another page. i�m not sure now but i think its a method of the HttpSerlvetResponse class.
i hope i�ve helped
Bill -
I am using v6.0 sp1
I have a servlet called MainServlet. Any request was passed to this servlet. After
some processing, This servlet will forward the request to the appropriate page
through RequestDispatcher. Unfortunately, this will result in an infinite loop.
Can any one shed some light on it. I saw that prior postings asked this question.
I did not see an solution yet.
Thanks
If the url that you get the request dispatcher for is an url that refers back to your
main servlet, yes, you will get an infinte loop. The pages that you forward to must
be outside the path that is recognized by your main servlet, i.e. outside /control/*
they must not be in the /control/ directory or MainServlet will pick them up, leading
to your infinite loop. You have to redirect to /template.jsp, or
/anythingbutcontrol/template.jsp but not /control/template.jsp
Cheers,
Chris
wyang wrote:
> I am using v6.0 sp1
>
> I have a servlet called MainServlet. Any request was passed to this servlet. After
> some processing, This servlet will forward the request to the appropriate page
> through RequestDispatcher. Unfortunately, this will result in an infinite loop.
>
> Can any one shed some light on it. I saw that prior postings asked this question.
> I did not see an solution yet.
>
> Thanks
>
>
-
Default servlet folder in tomcat
hi,
i trie to run a servlet, but whatever i do the servlet is not recognized by tomcat. does anybody know where i can put the servlet to use it?
cu
pumpindaveWEB-INF\classes
-
404 Error Message while running a servlet
Unable to run Snoop Servlet in JRUN 2.3.3 running on IIS4.0. I give the url
as http://websitename/servlet/SnoopServlet . But I get HTTP error 404 error.
I am trying to run the snoop servlet in the jrun/jsm-default/servlet directory. But, I am not able to run the servlets that are in the Servlet directory. It says '404 - Page Not Found Error'. Can anyone help me out what should I change to run the servlet when I type http//websitename/servlet/snoopservlet. Where 'snoopservlet' is the servlet in the servlets directory.I have been using JRun 3.1 and the default servlets directory is:
servers\default\default-app\web-inf\classes
Try to put your servlets in this folder. -
Default-charset in oc4j 10.1.3
Hi,
We are planning on migrating to OC4J 10.1.3.
It seems default-charset in global-web-application.xml is not recognized by OC4J 10.1.3 as it was in 9.0.3.
I can see lot of discussions about default-charset in this forum, could not find any answer to my problem.
Here is the header of my global-web-application.xml
<orion-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-web-10_0.xsd"
jsp-cache-directory="./persistence"
servlet-webdir="/servlet"
development="false"
jsp-timeout="0"
jsp-cache-tlds="standard"
schema-major-version="10"
schema-minor-version="0"
default-charset="UTF-8"
>
Please note I also have the jsp page directive as it was used in 9.0.3.
<%@page language ="java" contentType="text/html; charset=UTF-8" %>
Any help will be appreciated. Please try testing on German umlaut character ü (ms keyboard entry ALT+129).
Thanks,
ddasIn previous OC4J versions, the "servlet-webdir"
attribute was used as the default servlet path
whenever there was no "servlet-mapping" element
defined in the "web.xml" file of the Web application.
The above excerpt indicates that this is no longer
true for OC4J 10.1.3 -- unless you set the java
[System] property "http.webdir.enable" to 'true'. In
fact, without a "servlet-mapping" element you cannot
activate your servlet at all!
My point is that after reading the above, that I must
forget everything I knew about OC4J (in versions
prior to 10.1.3). 10.1.3 is a totally
different product to its predecessors. I must now
start learning OC4J from scratch. So pardon me while
I throw the last four years of my work experience
with OC4J down the toilet.I can see your point and share your sentiment. However, your last exaggeration sounds funny. That was just a minor change needed for security requirement. In case you use Jdeveloper, servlet declaration and mapping will be done automatically for you. After all, if it does not work, this forum and formal oracle support will help you.
Apart from usnig this post to vent my anger and
frustration with the Oracle OC4J development team
(yes you, messrs Debu Panda, Steve Button, Qiang Lin,
Deepak Arora and others), I wish to inform you,
Matic, that if the behaviour of the "servlet-webdir"
attribute has changed, most probably that of the
"default-charset" attribute has also changed.
So please Oracle OC4J people, inform us where we can
find information/documentation explaining the
behaviour changes of OC4J 10.1.3.0.0 stand-alone as
compared with previous versions.Thanks for the suggestion, Avi. I will ask the documentation writer to see if they have documented that change of behavior of the "servlet-webdir" and if not, document them in an appropriate book such as upgrade guide.
By the way, I do not think the semantic of "default-charset" attribute has changed from 10.1.2 to 10.1.3. If you know it otherwise, please provide a test case for me. Thanks. -
Sending an INVITE to my VoIP account by a SIP Servlet
I tried to make an outbound call to an ordinary landline number through my VoIP account by a SIP Servlet, but never been successful.
I tried something similar to the following:
javax.servlet.sip.SipFactory factory=(javax.servlet.sip.SipFactory) this.getServletContext().getAttribute(javax.servlet.sip.SipServlet.SIP_FACTORY);
javax.servlet.sip.SipApplicationSession appSession =factory.createApplicationSession();
to = “sip:land_line_number@my_voip_proxy_server.com”
from=”sip:my_voip_did_number:my_voip_password@ my_voip_proxy_server.com”
javax.servlet.sip.SipServletRequest invite = factory.createRequest(appSession, "INVITE", from, to);
invite.pushRoute(URI of my_voip_outbound_proxy_server.com);
invite.send();
I use Weblogic SIP server. I configured sip.xml, and everything else is correct to my knowledge.
I always get the error message something similar to “Cannot resolve path to my_voip_proxy_server.com”
(Note: When I use SJPhone softphone with my VoIP account details, it simply rings to a landline)
Is the way I incorporating my_voip_outbound_proxy_server correct?
Any help from anyone is greatly appreciated.
Thank you very much.hi there,
I am at the same point too..
I am using a softphone called mirrial , Using Bea WEB Logic SIP Server...Deployed sar arhieve , did not define any outbound proxy in client side , did not specify default servlet name for sip server..
Is there anybody who succedded such kind of proxy calls ?
And can clarify the details if have?
Thanks -
Hi, it appears that the servlet mapping specified in section 10 of the
Servlet 2.2 spec is broken in Weblogic server 6.0 GA. Here is the servlet
2.2. spec for mapping:
10.1 Use of URL Paths
Servlet containers must use URL paths to map requests to servlets. The
container uses the
RequestURI from the request, minus the Context Path, as the path to map to a
servlet. The URL
path mapping rules are as follows (where the first match wins and no further
rules are attempted):
1. The servlet container will try to match the exact path of the request to
a servlet.
2. The container will then try to recursively match the longest path prefix
mapping. This process
occurs by stepping down the path tree a directory at a time, using the '/'
character as a path
separator, and determining if there is a match with a servlet.
3. If the last node of the url-path contains an extension (.jsp for
example), the servlet container
will try to match a servlet that handles requests for the extension. An
extension is defined as the
part of the path after the last '.' character.
4. If neither of the previous two rules result in a servlet match, the
container will attempt to serve
content appropriate for the resource requested. If a "default" servlet is
defined for the application,
it will be used in this case.
It appears that Weblogic does step #3 before step #2. This means that if
you have a servlet called 'foo' mapped to '/foo/*' and Weblogic 6.0 receives
a request for '/foo/bar.jsp', the container returns an error because it
cannot find a JSP file called "bar.jsp" to compile, when according to the
spec, servlet 'foo' should receive the request with the pathInfo value set
to "/bar.jsp".
The workaround is to assign all *.jsp files to the servlet 'foo' as well,
but this breaks all other JSP files in the same web application.
I consider this a bad bug, as it breaks a proxy server that I have been
working on. Tomcat and other servlet containers seem to have gotten this
right, why not Weblogic?
Thanks
Colin Evans
Colin Evans
Senior Engineer
BITMO, Inc. (http://www.bitmo.com)
(415)920.7225 / [email protected]
Hi, it appears that the servlet mapping specified in section 10 of the
Servlet 2.2 spec is broken in Weblogic server 6.0 GA. Here is the servlet
2.2. spec for mapping:
10.1 Use of URL Paths
Servlet containers must use URL paths to map requests to servlets. The
container uses the
RequestURI from the request, minus the Context Path, as the path to map to a
servlet. The URL
path mapping rules are as follows (where the first match wins and no further
rules are attempted):
1. The servlet container will try to match the exact path of the request to
a servlet.
2. The container will then try to recursively match the longest path prefix
mapping. This process
occurs by stepping down the path tree a directory at a time, using the '/'
character as a path
separator, and determining if there is a match with a servlet.
3. If the last node of the url-path contains an extension (.jsp for
example), the servlet container
will try to match a servlet that handles requests for the extension. An
extension is defined as the
part of the path after the last '.' character.
4. If neither of the previous two rules result in a servlet match, the
container will attempt to serve
content appropriate for the resource requested. If a "default" servlet is
defined for the application,
it will be used in this case.
It appears that Weblogic does step #3 before step #2. This means that if
you have a servlet called 'foo' mapped to '/foo/*' and Weblogic 6.0 receives
a request for '/foo/bar.jsp', the container returns an error because it
cannot find a JSP file called "bar.jsp" to compile, when according to the
spec, servlet 'foo' should receive the request with the pathInfo value set
to "/bar.jsp".
The workaround is to assign all *.jsp files to the servlet 'foo' as well,
but this breaks all other JSP files in the same web application.
I consider this a bad bug, as it breaks a proxy server that I have been
working on. Tomcat and other servlet containers seem to have gotten this
right, why not Weblogic?
Thanks
Colin Evans
Colin Evans
Senior Engineer
BITMO, Inc. (http://www.bitmo.com)
(415)920.7225 / [email protected]
Maybe you are looking for
-
What do you do when an app has been downloaded but won't open
What do you do when you download an app from the app store and it will not open once it is downloaded.
-
Need IMAP and POP for solaris 8
Hello, I need to install impa and pop agent for solaris 2.8 machine and can anyone please help out where I can file them or buy them ? Thanks -K.Kim- [email protected]
-
Can anyone provide tips, best practices, links to documents regarding security and securing private data when using CVP, VXML Server, Reporting Server, Nuance ASR, UCCE? I'm sure some folks have already implemented the solution in secure environments
-
Oracle Outlook Connector Deployment Problem
I am trying to deploy Outlook 2003 with the Oracle Outlook connector. I am using the Custom installation Wizard provided by the Microsoft Office 2003 Support Tools. I have set the Oracle connector to piggy-back on the install, however, it will not se
-
Different pixel sizes while using Sigma 8mm fisheye for Pano photos
I have been using a Canon T4i for a few months now to take panoramic shots of apartments. I use a Sigma 8mm fisheye lens on a Nodal Ninja Ultimate R10 head. I have the camera set to 16:9 aspect ration with 3456x5184 resolution (Not the highest "L" s