Create a listener for all pages

Dinath

I have to use some listener class to listen all pages. According to the url, I must split it and get some informations.

For example :

x.domain.com/$member

I want to get the member name through url, get the following bean and retrieve some database informations.

So, I created a PhaseListener to do the job, but it is not called every times I needed it, for example in case of 404 error.

How can I proceed ?

Thanks a lot :)

PS : I am using Glassfish 4.1.

BalusC

Use a servlet filter which is mapped on both normal and error page requests:

<filter-mapping>
    <filter-name>yourFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>

그런 다음 필터 내에서 RequestDispatcher#ERROR_REQUEST_URI오류 페이지에서 트리거되었는지 여부를 입력 한 요청 속성의 존재 여부를 확인할 수 있습니다 .

String errorRequestURI = (String) request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);

if (errorRequestURI != null) {
    // Error page was triggered on the given URI.
}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Same navigation on all pages of the website

분류에서Dev

Extracting Google Analytics report for all pages

분류에서Dev

How can I create dynamic CONTAO pages?

분류에서Dev

Do I need to repeat all the categories on all sub-pages?

분류에서Dev

Get LibreOffice to change the margins for all pages and not just the last page when select all pages is active?

분류에서Dev

Add the generation date in all Typo3 pages

분류에서Dev

Spring Security provides anonymous acces to all pages instead only one

분류에서Dev

Redirect all Wordpress pages to SSL apart from one

분류에서Dev

Github API - create contents api method not triggering GitHub Pages build

분류에서Dev

How do I create an AWS ELB listener with frontend security policy? How do I replace the policy?

분류에서Dev

Glassfish-bin / asadmin create-network-listener가 실패했습니다.

분류에서Dev

Is it OK to create all primary partitions.?

분류에서Dev

Generate CREATE statements for all MySql Tables

분류에서Dev

Flask-SQLAlchemy create_all ()

분류에서Dev

Is it OK to create all primary partitions.?

분류에서Dev

Create all possible permutations of given variable set

분류에서Dev

dolphin create service menu for all files

분류에서Dev

How can I read all pages of an API response using aiohttp with discord.py?

분류에서Dev

How can I find all wiki pages that link to a specific wiki page?

분류에서Dev

How do I stop KeePass from automatch-ing all pages, when using the tag/title "Google"

분류에서Dev

Is it possible to get a list of all the pages where I authenticated with my Google OpenID

분류에서Dev

How to create android apps using Html and maintain those html pages using a management system?

분류에서Dev

Command line tool to create a pdf file with a4 sized pages from a poster pdf

분류에서Dev

I would like to create a log of all commands typed in terminal

분류에서Dev

Create .txt file inPowesShell containing Version number for all files in folder

분류에서Dev

Create multiple threads and wait for them all to complete, calling again for the complete

분류에서Dev

Create a linq query that get all elements that are not referenced in an aditonal table

분류에서Dev

Trying to create a method (and test) that counts all numbers,letters,and chars in a string and

분류에서Dev

MailgunTransport의 Mailgun ID create를 Laravel의 Event Listener에 전달하는 방법은 무엇입니까?

Related 관련 기사

  1. 1

    Same navigation on all pages of the website

  2. 2

    Extracting Google Analytics report for all pages

  3. 3

    How can I create dynamic CONTAO pages?

  4. 4

    Do I need to repeat all the categories on all sub-pages?

  5. 5

    Get LibreOffice to change the margins for all pages and not just the last page when select all pages is active?

  6. 6

    Add the generation date in all Typo3 pages

  7. 7

    Spring Security provides anonymous acces to all pages instead only one

  8. 8

    Redirect all Wordpress pages to SSL apart from one

  9. 9

    Github API - create contents api method not triggering GitHub Pages build

  10. 10

    How do I create an AWS ELB listener with frontend security policy? How do I replace the policy?

  11. 11

    Glassfish-bin / asadmin create-network-listener가 실패했습니다.

  12. 12

    Is it OK to create all primary partitions.?

  13. 13

    Generate CREATE statements for all MySql Tables

  14. 14

    Flask-SQLAlchemy create_all ()

  15. 15

    Is it OK to create all primary partitions.?

  16. 16

    Create all possible permutations of given variable set

  17. 17

    dolphin create service menu for all files

  18. 18

    How can I read all pages of an API response using aiohttp with discord.py?

  19. 19

    How can I find all wiki pages that link to a specific wiki page?

  20. 20

    How do I stop KeePass from automatch-ing all pages, when using the tag/title "Google"

  21. 21

    Is it possible to get a list of all the pages where I authenticated with my Google OpenID

  22. 22

    How to create android apps using Html and maintain those html pages using a management system?

  23. 23

    Command line tool to create a pdf file with a4 sized pages from a poster pdf

  24. 24

    I would like to create a log of all commands typed in terminal

  25. 25

    Create .txt file inPowesShell containing Version number for all files in folder

  26. 26

    Create multiple threads and wait for them all to complete, calling again for the complete

  27. 27

    Create a linq query that get all elements that are not referenced in an aditonal table

  28. 28

    Trying to create a method (and test) that counts all numbers,letters,and chars in a string and

  29. 29

    MailgunTransport의 Mailgun ID create를 Laravel의 Event Listener에 전달하는 방법은 무엇입니까?

뜨겁다태그

보관