Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • how do i get the User-Agent info?

    6 answers - 639 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    I'm trying to find out the browser issuing the request in my portlet.
    Looks like the portlet API provides no way to access the "User-Agent"
    HTTP header info. At least, I found none. Is there some way to access
    the servlet request? or some jetspeed-2 specific (non-JSR168) way to
    get this HTTP header?
    if all else fails, I'll probably have to solve this with javascript and
    that would be plain ugly.
    cheers,
    Edmund
    To unsubscribe, e-mail: jetspeed-user-unsubscribe (AT) portals (DOT) apache.org
    For additional commands, e-mail: jetspeed-user-help (AT) portals (DOT) apache.org
  • No.1 | | 1103 bytes | |

    Hi,
    You should try this in your portlet code.
    HttpServletRequest sss = (HttpServletRequest)((HttpServletRequestWrapper)
    request).getRequest();
    sss.getHeader("User-Agent");

    or you can import a jetspeed2 service named ServletContextProvider into your
    portlet, then you can get HttpServletRequest, HttpServletResponse and
    ServletContext from it.
    -James Liao

    6/14/05, Edmund Urbani <emu (AT) liland (DOT) orgwrote:

    I'm trying to find out the browser issuing the request in my portlet.
    Looks like the portlet API provides no way to access the "User-Agent"
    HTTP header info. At least, I found none. Is there some way to access
    the servlet request? or some jetspeed-2 specific (non-JSR168) way to
    get this HTTP header?

    if all else fails, I'll probably have to solve this with javascript and
    that would be plain ugly.

    cheers,
    Edmund

    To unsubscribe, e-mail: jetspeed-user-unsubscribe (AT) portals (DOT) apache.org
    For additional commands, e-mail: jetspeed-user-help (AT) portals (DOT) apache.org

  • No.2 | | 1949 bytes | |

    James Liao wrote:

    6/14/05, Edmund Urbani <emu (AT) liland (DOT) orgwrote:

    >
    >>I'm trying to find out the browser issuing the request in my portlet.
    >>Looks like the portlet API provides no way to access the "User-Agent"
    >>HTTP header info. At least, I found none. Is there some way to access
    >>the servlet request? or some jetspeed-2 specific (non-JSR168) way to
    >>get this HTTP header?
    >>
    >>if all else fails, I'll probably have to solve this with javascript and
    >>that would be plain ugly.
    >>
    >>cheers,
    >>Edmund
    >>
    >>

    >
    >>

    >Hi,
    >You should try this in your portlet code.
    >HttpServletRequest sss = (HttpServletRequest)((HttpServletRequestWrapper)
    >request).getRequest();
    >sss.getHeader("User-Agent");
    >
    >or you can import a jetspeed2 service named ServletContextProvider into your
    >portlet, then you can get HttpServletRequest, HttpServletResponse and
    >ServletContext from it.
    >
    >-James Liao


    the first solution seems to work fine. i'm doing checks with
    'instanceof' to be on the safe side here. so it's actually been bloated
    to about this:

    if (req instanceof HttpServletRequestWrapper) {
    HttpServletRequestWrapper reqWrapper=(HttpServletRequestWrapper)req;
    ServletRequest ();
    if (servletReq instanceof HttpServletRequest) {
    HttpServletRequest httpServletReq=(HttpServletRequest)servletReq;
    String ("User-Agent");

    }
    }

    that should do nicely. thanks a lot!

    cheers,
    Edmund

    To unsubscribe, e-mail: jetspeed-user-unsubscribe (AT) portals (DOT) apache.org
    For additional commands, e-mail: jetspeed-user-help (AT) portals (DOT) apache.org
  • No.3 | | 1287 bytes | |

    You should use :
    portletRequest.getClient().getUserAgent().

    2005/6/14, David Pankros <dpankros (AT) miragy (DOT) com>:
    if (req instanceof HttpServletRequestWrapper) {
    HttpServletRequestWrapper
    reqWrapper=(HttpServletRequestWrapper)req;
    ServletRequest ();
    if (servletReq instanceof HttpServletRequest) {
    HttpServletRequest
    httpServletReq=(HttpServletRequest)servletReq;
    String ("User-Agent");

    }
    }

    FYI, for correctness, you may want to change that. All you really care
    about is that the request is an HttpServletRequest. The wrapper is just
    a convenience class. There is nothing forcing an implementation to use
    the HttpServletRequestWrapper. They could write their own
    implementation from scratch only implementing HttpServletRequest and not
    extending the wrapper, which would cause your code to miss the fact that
    HttpServletRequest is actually implemented! With that, you can get rid
    of your outer "if" check and go straight to the HttpServletRequest
    check.

    If you only plan on using JS2, then it's not a big deal (other than the
    extra casts and thus the extra work that would be incurred), but if you
    support other environments, I'd definitely change it.

    Cheers!

    Dave
  • No.4 | | 524 bytes | |

    Benjamin DAHN wrote:

    >You should use :
    >portletRequest.getClient().getUserAgent().
    >


    i think that's the way you do it with the jetspeed 1.x portlet API. the
    PortletRequest class of Sun's JSR-168 Portlet API does not have
    getClient() or any similar method.

    Edmund

    To unsubscribe, e-mail: jetspeed-user-unsubscribe (AT) portals (DOT) apache.org
    For additional commands, e-mail: jetspeed-user-help (AT) portals (DOT) apache.org
  • No.5 | | 1377 bytes | |

    I have J1.6 running on against an 9i Database.

    When I try to add a user I get the following :-
    Caused by: java.sql.SQLException: RA-02289: sequence does not exist
    at (DBError.java:134)
    at (TTIoer.java:289)
    at (:579)
    at oracle.jdbc.ttc7.TTC7P(TTC7Protocol.java:1894)
    at
    (TTC7Protocol.java:831)
    at
    Statement.doExecuteQuery(Statement.java:2496)
    at
    Statement.doExecuteWithTimeout(Statement.java:2840 )
    at
    Statement.executeQuery(Statement.java:

    The following sequqnces exist in the database :-
    CFFEES_SEQ
    EMAIL_INBX_SEQ
    JETSPEED_GRUP_PRFILE_SEQ
    JETSPEED_RLE_PRFILE_SEQ
    JETSPEED_USER_PRFILE_SEQ
    PRTLET_CATEGRY_SEQ
    PRTLET_MEDIATYPE_SEQ
    PRTLET_PARAMETER_SEQ
    PRTLET_SEQ
    SECURITY_ACCESS_SEQ
    SECURITY_ALLW_SEQ
    SECURITY_ENTRY_SEQ
    TURBINE_GRUP_SEQ
    TURBINE_PERMISSIN_SEQ
    TURBINE_RLE_PERMISSIN_SEQ
    TURBINE_RLE_SEQ
    TURBINE_USER_GRUP_RLE_SEQ
    TURBINE_USER_SEQ

    I have populated the database using the supplied scripts and I tool the
    jetspeed-torque-om-1.6.jar from www.bluesunrise.com distribution for

    I have looked at but code
    appears to be ok.

    Any Ideas,

    Jon

    To unsubscribe, e-mail: jetspeed-user-unsubscribe (AT) portals (DOT) apache.org
    For additional commands, e-mail: jetspeed-user-help (AT) portals (DOT) apache.org
  • No.6 | | 1972 bytes | |

    Is there anyway to find out what sequence is trying to be used.

    Thanks

    Jon

    jonathan.hawkins (AT) hawkinsweb (DOT) co.uk wrote:

    >I have J1.6 running on against an 9i Database.
    >
    >When I try to add a user I get the following :-
    >
    >Caused by: java.sql.SQLException: RA-02289: sequence does not exist

    at (DBError.java:134)
    at (TTIoer.java:289)
    at (:579)
    at oracle.jdbc.ttc7.TTC7P(TTC7Protocol.java:1894)
    at
    (TTC7Protocol.java:831)
    at
    Statement.doExecuteQuery(Statement.java:2496)
    at
    Statement.doExecuteWithTimeout(Statement.java:2840 )
    at
    Statement.executeQuery(Statement.java:
    >
    >
    >
    >The following sequqnces exist in the database :-
    >
    >CFFEES_SEQ
    >EMAIL_INBX_SEQ
    >JETSPEED_GRUP_PRFILE_SEQ
    >JETSPEED_RLE_PRFILE_SEQ
    >JETSPEED_USER_PRFILE_SEQ
    >PRTLET_CATEGRY_SEQ
    >PRTLET_MEDIATYPE_SEQ
    >PRTLET_PARAMETER_SEQ
    >PRTLET_SEQ
    >SECURITY_ACCESS_SEQ
    >SECURITY_ALLW_SEQ
    >SECURITY_ENTRY_SEQ
    >TURBINE_GRUP_SEQ
    >TURBINE_PERMISSIN_SEQ
    >TURBINE_RLE_PERMISSIN_SEQ
    >TURBINE_RLE_SEQ
    >TURBINE_USER_GRUP_RLE_SEQ
    >TURBINE_USER_SEQ
    >
    >I have populated the database using the supplied scripts and I tool the
    >jetspeed-torque-om-1.6.jar from www.bluesunrise.com distribution for
    >
    >I have looked at but code
    >appears to be ok.
    >
    >Any Ideas,
    >
    >Jon
    >
    >
    >
    >
    >
    >
    >To unsubscribe, e-mail: jetspeed-user-unsubscribe (AT) portals (DOT) apache.org
    >For additional commands, e-mail: jetspeed-user-help (AT) portals (DOT) apache.org
    >


    To unsubscribe, e-mail: jetspeed-user-unsubscribe (AT) portals (DOT) apache.org
    For additional commands, e-mail: jetspeed-user-help (AT) portals (DOT) apache.org

Re: how do i get the User-Agent info?


max 4000 letters.
Your nickname that display:
In order to stop the spam: 3 + 2 =
QUESTION ON "Java"

EMSDN.COM