.jsp is auto-binded according to the url-pattern of "*.jsf" ?

i mean, x.jsp is auto returned if i type x.jsf?
but failed if i rename x.jsp to x.jspx, that means .jspx is not accepted.
could someone explain the mechanism for me ?

Check the servlet mapping in web.xml. You've apparently mapped FacesServlet on *.jsf. With regard to JSP files, you need to check the JspServlet mapping in the web.xml of the application server itself. It is by default *.jsp. If you want to add *.jspx to that, then you need to add another <servlet-mapping> of the JspServlet to your web.xml (or the web.xml of the application server, if you have admin control over that).

Similar Messages

  • How to specify  a servlet mapping as the url pattern with in the security constraints

    Hi ,
    Weblogic 6.0 documentation says the following:-
    Define which resources in the Web Application the security constraint applies to using the <url-pattern> element that is nested inside the <web-resource-collection> element. The <url-pattern> can refer to either a directory, filename or a <servlet-mapping>.
    To apply the security constraint to the entire Web Application, use the following <url-pattern>:
    <url-pattern>/*</url-pattern>
    Could any one let me know how to specify servlet mapping as the url pattern.
    I tried various combination and it doesn't seem to work and any help in this regard will be greatly appreciated.
    Thanks
    kannan

    The answer is posted here:
    Unapproved User Flag in UME

  • Filter does not work with *.jsp URL pattern???

    Hi All,
    I am, by no means, very good at JSF or Java. I have looked at various forum posts on here for ways to implement a security filter to intercept requests to pages that first require one to be logged in, and if not, redirect them to the login page. Yes, I know a lot of you have heard this many times before, and I'm sorry to bring it up again.
    BUT, from the guidance of other posts, I have got a filter that works fine when the url pattern is set to "/faces/*" or "/<anything>/*", however it won't work for "*.jsp" or "*.<anything>"
    My filter is as follows:
    package test.security;
    import javax.faces.context.FacesContext;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.http.HttpSession;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SecurityFilter implements Filter{
        /** Creates a new instance of SecurityFilter */
        private final static String FILTER_APPLIED = "_security_filter_applied";
        public SecurityFilter() {
        public void init(FilterConfig filterConfig) {
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException{
            HttpServletRequest req = (HttpServletRequest)request;
            HttpServletResponse res = (HttpServletResponse)response;
            HttpSession session = req.getSession();
            String requestedPage = req.getPathTranslated();
            String user=null;
            if(request.getAttribute(FILTER_APPLIED) == null) {
                //check if the page requested is the login page or register page
                if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */
                    //set the FILTER_APPLIED attribute to true
                    request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
                    //Check that the session bean is not null and get the session bean property username.
                    if(((test.SessionBean1)session.getAttribute("SessionBean1"))!=null) {
                        user = ((test.SessionBean1)session.getAttribute("SessionBean1")).getUsername();
                    if((user==null)||(user.equals(""))) {
                       // try {
                     //       FacesContext.getCurrentInstance().getExternalContext().redirect("Page1.jsp");
                      //  } catch (ServletException ex) {
                      //      log("Error Description", ex);
                        res.sendRedirect("../Page1.jsp");
                        return;
            //deliver request to next filter
            chain.doFilter(request, response);
        public void destroy(){
    }My web.xml declaration for the filter is:
    <filter>
      <description>Filter to check whether user is logged in.</description>
      <filter-name>SecurityFilter</filter-name>
      <filter-class>test.security</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>SecurityFilter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    Note: I have also tried this with <url-pattern>*.jsp</url-pattern> for the filter mapping in place of the Faces Servlet
    My web.xml declaration for the url pattern is:
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>Which JSC/NetbeansVWP automatically creates a "JSCreator_index.jsp" which has:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root  version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page">
      <jsp:forward page="Page1.jsp"/>
    </jsp:root>When run, this causes an Error 500 in the browser and a NullPointerException in SecurityFilter.java on the line:
    if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */I think I'm missing something that would be obvious to anyone who knows better than me. Any ideas?

    Dear Ginger and Boris,
    thanks for the information - the problem seems to ocur in EP7 as well, Boris told me it is fixed in SP15. We are on SP14 now, so there is hope !
    actually the information in the oss note stated above is also true, as we have an Oracle DB. On a similar demo system (only difference is SQL DB) the hyphen search works !
    best regards, thank you !
    Johannes

  • How does the URL of DataSocket constitute?And how to use it in LabWindows/CVI ?

    Hi !
    There's a problem puzzled me some days.How does the URL of DataSocket constitute ? And how to use it in LabWindow/CVI ?
    For example.I have downloaded a code in http://zone.ni.com/devzone/cda/epd/p/id/3787.I want to make it work properly.So I configure my DataSocket Server Manger according to the URL of this statement.
    DS_Open ("dstp://weather.natinst.com/weather/current",
    DSConst_ReadAutoUpdate, DSCurrentCallback, NULL,
    &dsCurrentHandle);
     My DateSockket Server Manger is configured as:
    However,it could not work properly when I debug it.
    There's a introduction at the top of the code."You may need to replace the references to weather.natinst.com to 130.164.140.10 if the DNS isn't working properly."So,I modified the statement into
    DS_Open ("dstp://130.164.140.10/weather/current",
    DSConst_ReadAutoUpdate, DSCurrentCallback, NULL,
    &dsCurrentHandle);
    but,it did work properly.
    We want to communicate with other computers via the URL of  DataSocket in LabWindows/CVI.Whereas,how could we make it ia the URL ?
    If anyone could help me solve this problem,I would appreciate it very much !
    Best regards.
                     xiepei
    I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.

    Hi !
    Thank you very much for your reply! I will accept your advice.
    Besides,I have another question.If I want to visit other computers or other websites,how does the URL of DataSocket  I constitute ? Does the URL has any relation with the DataSocket Server Manger ?If does,how to configure the DataSocket Server Manager to let them connected.If they have no relation,how to use the DataSocket Server Manger ?
    After all,I want to know how to use it in LabWinows/CVI ?
    Thank you very much !
    Best regards!
    I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.

  • Can the parameter in the url be invisible?

    hi,
    I want the parameters in the url to be invisible. That is if the url is
    http://localhost:8080/index.jsp?create=12 , so in the url bar it has to be displayed like
    http://localhost:8080/index.jsp. But the parameters should not be displayed. Is it possible?
    If possible how? Can you send the code?
    Thanks in anticipation
    Deepa Datar

    Greetings,
    if the username & password is right the user has to be
    redirected to the index.jsp page, where the usernameHow are you "redirecting", with sendRedirect? This method adds an HTTP 'Location' header to the response which instructs the browser to "fetch the response" from the given URL (including parameters, if any). Unfortunately, the browser uses a GET request on the next resource so, "no", its not possible to make the (GET) parameter(s) invisible - this is a limitation of the HTTP protocol. However, it seems what you really want in this case is not to "redirect" but to "dispatch" the request. Request dispatching allows your servlet to forward the request to, and/or include responses from, another resource on the same server without the overhead of redirecting the client. Additionally, the original request and response objects are maintained which can be modified with additional ("invisible") attributes:
    // In service thread...
    request.setAttribute( "client", "12" );
    RequestDispatcher rd = request.getRequestDispatcher( "index.jsp" );
    rd.forward( request, response );I hope this helps.
    Can any one help me out? Its actually urgent.
    Thanks in anticipation
    Deepa DatarRegards,
    Tony "Vee Schade" Cook

  • Using security-constraint in web.xml; not recognizing url-pattern tag

    I am creating a very simple jsp application within JDeveloper 10.1.3.1. I have 2 jsp files...a readData.jsp and a maintainData.jsp. I would like to deploy this application to Oracle Application Server 10.1.2.2. I would like to use Oracle Internet Directory with Single Sign on enabled. The deployment to OAS works fine. For the security, I would like an administrator user to get to both pages...and a user to only be able to see the readData.jsp. I used the security constraints on the properties of the web.xml file within JDeveloper. Here is my web.xml file:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <session-config>
    <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>adm_full_access</web-resource-name>
    <url-pattern>*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>adm_all</role-name>
    </auth-constraint>
    </security-constraint>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>usr_access</web-resource-name>
    <url-pattern>readData.jsp</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>usr_all</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>BASIC</auth-method>
    </login-config>
    <security-role>
    <role-name>usr_all</role-name>
    </security-role>
    <security-role>
    <role-name>adm_all</role-name>
    </security-role>
    </web-app>
    When I deploy to OAS I added an OID account to the adm_all role...this works fine I can log on as that user and get to both jsps. But, when I add my user to the usr_all role within OAS I try to log on to the app...I then enter my SSO username and password and I get Access Denied errors from my browser when trying to access either page. I am confused about the <url-pattern> tag...is that relative to a directory within my deployment? Most of the examples I have seen use servlets...so I was wondering if I can even use the <url-pattern> tag to restrict/allow access to individual jsps? If someone could point me to some documentation on this set-up I would appreciate it!
    Thank you.

    I was able to get this to work. By doing the following:
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>adm_full_access</web-resource-name>
    <url-pattern>*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>adm_all</role-name>
    </auth-constraint>
    </security-constraint>
    I was restricting access to all other groups by uisng <url-pattern>*</url-pattern>. Any other security-constraints set-up after that will not work. So saying * requires usr_all will restrict ALL webpages to ONLY adm_all, regardless of what future constraints say. So, my first security-constraints lists all directories or pages that every user can access. My next security-constraint then list resources that only my admins (adm_all) can acess. Any other security constraints then are set-up for each user role that I have...if adm_all should have access to these then the <role-name>adm_all</role-name> is added to each security constraint.

  • Different url-patterns for same servlet running in 2 different environments

    Hi All,
    I have a question about url mappings in my web.xml file and I hope somebody can help. The situation is that I�m putting together a web app using a combination of JSPs and servlets. I can�t develop on the machine that it will be hosted on, so I�m working and testing on my own machine and will transfer to the host machine when finished. However, the host machine is set up to map serlvets to http://�/servlet/MyServlet but the copy of tomcat I have installed locally maps to http://�/MySerlvet. My question is, when I get ready to transfer my application do I have to go through all my code and find serlvet references and insert the �servlet/� path info required by the hosting service, or can I just change the url patterns for the servlet mappings of the web.xml file on the host machine ? In other words:
    Local install of Tomcat where servlets are accessed at http://�/MyServlet
    <servlet-mapping>
    <servlet-name> MyServlet </servlet-name>
    <url-pattern>/MyServlet </url-pattern>
    </servlet-mapping>
    Host machine install of Tomcat where servlets are accessed at http://�/servlet/MyServlet
    <servlet-mapping>
    <servlet-name> MyServlet </servlet-name>
    <url-pattern>/servlet/MyServlet </url-pattern>
    </servlet-mapping>
    I guess my thinking is that it would be better/easier to have a remote and local version of the web.xml file that reflects the environment each one resides in and have only one codebase rather than 2 codebases and 1 web.xml file. Am I thinking about this in the right way, or have I misunderstood something?
    Thanks,
    Peter

    What you�re suggesting is logical, but won�t that
    effect all the other stuff I�ve got running on my
    local Tomcat install that expects servlets to be
    accessed at http://.../ServletName ?
    in web.xml, you decide of your mapping, so you could use the /servlet/ServletName pattern for your application that needs to be remote, and /ServletName for the rest of your stuff. You can even define more than one mapping for a servlet...
    In fact, you should probably put your whole application that is going to be on a remote server in it's own context, and to be ahead of dufymo :-) , learn to put it a war file for deployment.

  • url-pattern working?

    Greet the sun all,
              Question, does anybody know if <url-pattern> in the web.xml file is
              working for file patterns? I try to map file pattern *.xyz to a servlet
              and it does not work. I have tried this under Tomcat and it works fine.
              Perry Hoekstra
              Consultant
              Talent Software Services
              [email protected]
              

    Perry Hoekstra <[email protected]> wrote in message
              news:[email protected]..
              > Question, does anybody know if <url-pattern> in the web.xml file is
              > working for file patterns? I try to map file pattern *.xyz to a servlet
              > and it does not work. I have tried this under Tomcat and it works fine.
              I can't get it to work either. My webapplication looks like this:
              /WEB-INF
              /public.html
              /guarded.html
              /login.html
              /error.html
              ...and my web.xml has a <url-pattern> element in it that looks like this:
              <url-pattern>/guarded.html</url-pattern>
              ...that is, in accordance with the Servlet 2.2 specification, I'm trying to
              get my web application to declare that that particular security constraint
              should apply only to the guarded.html page and nothing else. I'm using FORM
              based login.
              Can anyone from BEA comment on the brokenness or lack thereof of the
              <url-pattern> element and how it should be used? I've of course read all
              the documentation about it because there isn't much. :-)
              Cheers,
              Laird
              

  • url-pattern syntax

    I am trying to deploy a jsp (adf) application to tomcat 5.2 but I am getting errors because of the filter-mapping tags I am using. This is the relevant part of my web.xml file:
    <!-- OK -->
    <filter-mapping>
    <filter-name>ADFBindingFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ADFBindingFilter</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ADFBindingFilter</filter-name>
    <servlet-name>action</servlet-name>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ADFBindingFilter</filter-name>
    <servlet-name>jsp</servlet-name>
    </filter-mapping>
    <filter-mapping>
    <filter-name>LoginCheckFilter</filter-name>
    <servlet-name>action</servlet-name>
    </filter-mapping>
    <!-- OK -->
    <!— NOT OK -->
    <filter-mapping>
    <filter-name>CheckUnosRole</filter-name>
    <url-pattern>admin.do</url-pattern>
    </filter-mapping>
    <!— NOT OK -->
    Tomcat complains about the part marked with NOT OK. It says that the url-pattern has syntax error. Mapping the filter to: .do, .jsp or jsp (as in the OK part) works fine. But, I need to map some filters to specific actions, like myAction.do. How am I supposed to do that?
    I have deployed the same application to oc4j and there it works fine.

    I am trying to deploy a jsp (adf) application to tomcat 5.2 but I am getting errors because of the filter-mapping tags I am using. This is the relevant part of my web.xml file:
    <!-- OK -->
    <filter-mapping>
    <filter-name>ADFBindingFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ADFBindingFilter</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ADFBindingFilter</filter-name>
    <servlet-name>action</servlet-name>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ADFBindingFilter</filter-name>
    <servlet-name>jsp</servlet-name>
    </filter-mapping>
    <filter-mapping>
    <filter-name>LoginCheckFilter</filter-name>
    <servlet-name>action</servlet-name>
    </filter-mapping>
    <!-- OK -->
    <!— NOT OK -->
    <filter-mapping>
    <filter-name>CheckUnosRole</filter-name>
    <url-pattern>admin.do</url-pattern>
    </filter-mapping>
    <!— NOT OK -->
    Tomcat complains about the part marked with NOT OK. It says that the url-pattern has syntax error. Mapping the filter to: .do, .jsp or jsp (as in the OK part) works fine. But, I need to map some filters to specific actions, like myAction.do. How am I supposed to do that?
    I have deployed the same application to oc4j and there it works fine.

  • Can you have url pattern with struts action in a directory to security

    i want to implement security based on roles and want to use struts action patterns but they dont work
    i am trying something like this
    <url-pattern>/jsps-one/*.jsp</url-pattern>
    <url-pattern>/action-jsps-one/*.do</url-pattern>

    Hi,
    do you knwo that Struts actions have a Role property ? You can use J2EE roles directly on Struts actions without having to fish for the URL pattern.
    Best practices for security in Struts is to place teh JSP files in the WEB-INF directory so they are safe there.
    See http://www.oracle.com/technology/products/jdev/collateral/papers/10g/adfstrutsj2eesec.pdf
    Frank

  • Changing from url-pattern /faces/* url-pattern

    I would like to change from having to go to /faces/mypage.jsp to get server faces to render. I was thinking of having a url pattern of:
    <url-pattern>*.jsf</url-pattern>
    Is there any way to get this type of functionality? I tried changing the url pattern and renamed my pages but some reason it is still looking for mypage.jsp, even after restarting the computer.

    I am not sure I got your idea to have two copies of the same page, but with the different extentions.
    If you have <url-pattern>*.jsf</url-pattern>, the URL with .jsf on the end will be mapped to the corresponded .jsp file.
    For example,
    /pages/inputname.jsf will be mapped to the /pages/inputname.jsp
    /index.jsf will be mapped to the /index.jsp
    However, if you call /pages/inputname.jsp directly, the same page (/pages/inputname.jsp) will be invoked directly and the exception will occure if this page contains jsf tags.

  • Problems With url-pattern in a filter-mapping

    Hi!
    I need to make a filter when the clients call a jsf pages in /pages in my web application, but when i make the filter-mapping like this:
         <filter-mapping>
              <filter-name>sessionFilter</filter-name>
              <url-pattern>/pages/*.jsf</url-pattern>
         </filter-mapping>An exception appears:
    SEVERE: Parse error in application web.xml
    java.lang.IllegalArgumentException: Invalid <url-pattern> /pages/*.jsf in filter mapping
         at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
         at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
         at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
         at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
         at org.apache.commons.digester.Digester.parse(Digester.java:1548)
         at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:263)
         at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:624)
         at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
         at org.apache.catalina.core.StandardService.start(StandardService.java:480)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)the <url-pattern>/pages/*</url-pattern> not work to me because process all pages, I nedd only *.jsf
    Please Help me whit this.

    "the <url-pattern>/pages/*</url-pattern> not work to me because process all pages, I nedd only *.jsf"
    Yes but in the filter you can get the url from the request.getUrl() and then only process requests that contain .jsf. Simply just pass all other requests along.
    Some information on url pattern matching:
    http://edocs.bea.com/wls/docs61/webapp/components.html#113049

  • Trying to implement the Builder pattern with inheritance

    This is just a bit long, but don't worry, it's very understandable.
    I'm applying the Builder pattern found in Effective Java (J. Bloch). The pattern is avaiable right here :
    http://books.google.fr/books?id=ka2VUBqHiWkC&lpg=PA15&ots=yXGmIjr3M2&dq=nutritionfacts%20builder%20java&pg=PA14
    My issue is due to the fact that I have to implement that pattern on an abstract class and its extensions. I have declared a Builder inside the base class, and the extensions specify their own extension of the base's Builder.
    The abstract base class is roughly this :
    public abstract class Effect extends Trigger implements Cloneable {
        protected Ability parent_ability;
        protected Targetable target;
        protected EffectBinder binder;
        protected Effect(){
        protected Effect(EffectBuilder parBuilder){
            parent_ability = parBuilder.parent_ability;
            target = parBuilder.target;
            binder = parBuilder.binder;
        public static class EffectBuilder {
            protected Ability parent_ability;
            protected Targetable target;
            protected EffectBinder binder;
            protected EffectBuilder() {}
            public EffectBuilder(Ability parParentAbility) {
                parent_ability = parParentAbility;
            public EffectBuilder target(Targetable parTarget)
            { target = parTarget; return this; }
            public EffectBuilder binder(EffectBinder parBinder)
            { binder = parBinder ; return this; }
        // etc.
    }And the following is one of its implementation :
    public class GainGoldEffect extends Effect {
        private int gold_gain;
        public GainGoldEffect(GainGoldEffectBuilder parBuilder) {
            super(parBuilder);
            gold_gain = parBuilder.gold_gain;
        public class GainGoldEffectBuilder extends EffectBuilder {
            private int gold_gain;
            public GainGoldEffectBuilder(int parGoldGain, Ability parParentAbility) {
                this.gold_gain = parGoldGain;
                super.parent_ability = parParentAbility;
            public GainGoldEffectBuilder goldGain(int parGoldGain)
            { gold_gain = parGoldGain; return this; }
            public GainGoldEffect build() {
                return new GainGoldEffect(this);
        // etc.
    }Effect requires 1 parameter to be correctly instantiated (parent_ability), and 2 others that are optional (target and binder). Implementing the Builder Pattern means that I won't have to rewrite specific construcors that cover all the combination of parameters of the Effect base class, plus their own parameter as an extension. I expect the gain to be quite huge, as there will be at least a hundred of Effects in this API.
    But... in the case of these 2 classes, when I'm trying to create the a GoldGainEffect like this :
    new GainGoldEffect.GainGoldEffectBuilder(1 , locAbility).goldGain(5);the compiler says "GainGoldEffect is not an enclosing class". Is there something wrong with the way I'm trying to extend the base Builder ?
    I need your help to understand this and find a solution.
    Thank you for reading.

    The GainGoldEffectBuilder class must be static.
    Otherwise a Builder would require a GainGoldEffect object to exist, which is backwards.

  • Bug when specifying url-pattern in web.xml

    Hi
              I have been using Weblogic 6.0 Beta and managed to specify the following
              security constraint
              <security-constraint>
              <web-resource-collection>
              <web-resource-name>SecurePages</web-resource-name>
              <description>no description</description>
              <url-pattern>/control/signin</url-pattern>
              <url-pattern>/control/refreshUser</url-pattern>
              <url-pattern>/control/updateUser</url-pattern>
              <url-pattern>/control/deleteaddress</url-pattern>
              <url-pattern>/control/updateaddress</url-pattern>
              <url-pattern>/control/refreshcontacts</url-pattern>
              <url-pattern>/control/updatecard</url-pattern>
              <http-method>POST</http-method>
              <http-method>GET</http-method>
              </web-resource-collection>
              </security-constraint>
              This works fine as you would expect. I have upgraded to Weblogic 6.0 Service
              Pack 1 Rolling Patch 1 and the same web.xml file no longer works. When you
              try and start the server Weblogic hangs just after loading the Oracle driver
              that I use.
              The odd behaviour is that if I change the order of the url-pattern elements
              so that the updatecard URL is above the refreshUser URL the server starts!
              (shown below)
              <url-pattern>/control/signin</url-pattern>
              <url-pattern>/control/updatecard</url-pattern>
              <url-pattern>/control/refreshUser</url-pattern>
              <url-pattern>/control/updateUser</url-pattern>
              <url-pattern>/control/deleteaddress</url-pattern>
              <url-pattern>/control/updateaddress</url-pattern>
              <url-pattern>/control/refreshcontacts</url-pattern>
              A deadlock condition appears to occur, a section of the thread dump looks
              like:
              "Reference Handler" daemon prio=10 tid=0x8990b20 nid=0x7dc waiting on
              monitor [0
              x8c0f000..0x8c0fdc4]
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:420)
              at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)
              "main" prio=5 tid=0x234ce0 nid=0x6cc runnable [0x6e000..0x6fc3c]
              at weblogic.servlet.utils.URLMatchMap.put(URLMatchMap.java:156)
              at
              weblogic.servlet.security.internal.WebAppSecurity.setConstraints(WebA
              ppSecurity.java:77)
              Looking at the weblogic.jar file the URLMatchMap class is a new addition
              over the original Weblogic 6.0. It seems that the put method of the
              URLMatchMap may be going into an infinite loop, dependant on the URLs that
              are being entered. The fact that changing the order of the URLs overcomes
              the bug seems to suggest there may be some coding error in this new class.
              A fix would be great if anyone has one.
              Chris Mein
              

              Just wondering if anyone ever came up with the solution to the bug with WL 6.0
              sp1, mentioned by Chris, below. Any information on this would be greatly appreciated.
              Tony
              "Chris Mein" <[email protected]> wrote:
              >Hi
              >
              >I have been using Weblogic 6.0 Beta and managed to specify the following
              >security constraint
              >
              ><security-constraint>
              > <web-resource-collection>
              > <web-resource-name>SecurePages</web-resource-name>
              > <description>no description</description>
              > <url-pattern>/control/signin</url-pattern>
              > <url-pattern>/control/refreshUser</url-pattern>
              > <url-pattern>/control/updateUser</url-pattern>
              > <url-pattern>/control/deleteaddress</url-pattern>
              > <url-pattern>/control/updateaddress</url-pattern>
              > <url-pattern>/control/refreshcontacts</url-pattern>
              > <url-pattern>/control/updatecard</url-pattern>
              > <http-method>POST</http-method>
              > <http-method>GET</http-method>
              > </web-resource-collection>
              > </security-constraint>
              >
              >This works fine as you would expect. I have upgraded to Weblogic 6.0
              >Service
              >Pack 1 Rolling Patch 1 and the same web.xml file no longer works. When
              >you
              >try and start the server Weblogic hangs just after loading the Oracle
              >driver
              >that I use.
              >
              >The odd behaviour is that if I change the order of the url-pattern elements
              >so that the updatecard URL is above the refreshUser URL the server starts!
              >(shown below)
              >
              ><url-pattern>/control/signin</url-pattern>
              ><url-pattern>/control/updatecard</url-pattern>
              ><url-pattern>/control/refreshUser</url-pattern>
              ><url-pattern>/control/updateUser</url-pattern>
              ><url-pattern>/control/deleteaddress</url-pattern>
              ><url-pattern>/control/updateaddress</url-pattern>
              ><url-pattern>/control/refreshcontacts</url-pattern>
              >
              >A deadlock condition appears to occur, a section of the thread dump looks
              >like:
              >
              >"Reference Handler" daemon prio=10 tid=0x8990b20 nid=0x7dc waiting on
              >monitor [0
              >x8c0f000..0x8c0fdc4]
              > at java.lang.Object.wait(Native Method)
              > at java.lang.Object.wait(Object.java:420)
              > at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)
              >
              >"main" prio=5 tid=0x234ce0 nid=0x6cc runnable [0x6e000..0x6fc3c]
              > at weblogic.servlet.utils.URLMatchMap.put(URLMatchMap.java:156)
              > at
              >weblogic.servlet.security.internal.WebAppSecurity.setConstraints(WebA
              >ppSecurity.java:77)
              >
              >Looking at the weblogic.jar file the URLMatchMap class is a new addition
              >over the original Weblogic 6.0. It seems that the put method of the
              >URLMatchMap may be going into an infinite loop, dependant on the URLs
              >that
              >are being entered. The fact that changing the order of the URLs overcomes
              >the bug seems to suggest there may be some coding error in this new class.
              >
              >A fix would be great if anyone has one.
              >
              >Chris Mein
              >
              >
              

  • Servlet Filters/url patterns with WLS 8

    Hello,
    I am trying to use filters to do some pre processing before my web service
    is invoked. It seems the doFilter() method does not seem to be getting invoked.
    The init() method is getting invoked as I see print statements in the log file.
    I am not sure if the url-pattern is correct and I am enclosing the web.xml file
    here along with relevant lines from web-services.xml and application.xml.In access.log
    I do see HTTP calls to the web service.
    Any help would be appreciated.
    <web-app>
    <filter>
    <filter-name>l10nWebServiceFilter</filter-name>
    <filter-class>com.globalsight.dotNet.L10nWebServiceFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>l10nWebServiceFilter</filter-name>
    <url-pattern>/l10nWebService/*</url-pattern>
    </filter-mapping>
    </web-app>
    From web-services.xml -
    web-service useSOAP12="false" targetNamespace="http://localhost:7001/L10nWebServiceEJB"
    name="L10nWebServiceEJB" style="rpc" uri="/L10nWebServiceEJB">
    and from application.xml -
    <application>
    <display-name></display-name>
    <module>
    <web>
    <web-uri>l10nWebService.war</web-uri>
    <context-root>l10nWebService</context-root>
    </web>
    </module>
    <module>
    <ejb>cap_ssb.jar</ejb>
    </module>
    </application>

    Hi Aswin,
    I think the problem may be in your Servlet Filter code :-)
    The last line in your doFilter() method should be:
    filterChain.doFilter(servletRequest, servletResponse);
    I have attached a small zip that uses a ServletFilter to get around situations,
    where the WLS web services stack/tools has problems dynamically generating the
    WSDL I want to present to the "outside world". It (the zip) contains a web.xml
    that illustrates how to set the <url-pattern>. This web.xml goes with the web-services.xml
    in the web services' .war, but the ServletFilter is "generic" :-)
    HTH,
    Mike Wooten
    "Aswin Dinakar" <[email protected]> wrote:
    >
    Changing the url-pattern to /* solved the problem and the doFilter()
    method is
    being called. However the webservice is not being invoked now. Is there
    any changes
    to web-services.xml that I need to make that after the doFilter() code
    is invoked
    the webservice methods would be invoked ?
    Thanks,
    Aswin.
    "Aswin Dinakar" <[email protected]> wrote:
    Hello,
    I am trying to use filters to do some pre processing beforemy
    web service
    is invoked. It seems the doFilter() method does not seem to be getting
    invoked.
    The init() method is getting invoked as I see print statements in the
    log file.
    I am not sure if the url-pattern is correct and I am enclosing the web.xml
    file
    here along with relevant lines from web-services.xml and application.xml.In
    access.log
    I do see HTTP calls to the web service.
    Any help would be appreciated.
    <web-app>
    <filter>
    <filter-name>l10nWebServiceFilter</filter-name>
    <filter-class>com.globalsight.dotNet.L10nWebServiceFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>l10nWebServiceFilter</filter-name>
    <url-pattern>/l10nWebService/*</url-pattern>
    </filter-mapping>
    </web-app>
    From web-services.xml -
    web-service useSOAP12="false" targetNamespace="http://localhost:7001/L10nWebServiceEJB"
    name="L10nWebServiceEJB" style="rpc" uri="/L10nWebServiceEJB">
    and from application.xml -
    <application>
    <display-name></display-name>
    <module>
    <web>
    <web-uri>l10nWebService.war</web-uri>
    <context-root>l10nWebService</context-root>
    </web>
    </module>
    <module>
    <ejb>cap_ssb.jar</ejb>
    </module>
    </application>
    [webservice_servlet_filter.zip]

Maybe you are looking for