What was modernism's relation to the concept of culture? To those of us who have spent some time with modernism, at least two kinds of answer might suggest themselves right away. One would fix on modernism's ambivalent entanglement with "high culture" at its demandingly highest, and find its icons in writers like T. W. Adorno (railing against the culture industry on behalf of a bleak and difficult art) or better still T. S. Eliot (author not only of a poem whose forbidding learnedness helped to secure its eminence but also, thirty years later, of Notes reporting that evidence of cultural decline "is visible in every department of human activity"). 1 The other sort of answer would play upon a rather different sense of "culture": here, res like the Picasso of Les demoiselles d'Avignon or the Conrad of Heart of Darkness would evoke modern Western art's fascination with non- Western people, objects, and texts, and more generally the essential "modernism" of cross-cultural contact on an unprecedented scale. The high-culture response and the other-culture response both attest to the intimacy of modernism and "culture," of course; but contemplated together they also appear as poles of a contradiction that can seem--to anyone worn out by the "culture wars" of the 1990s, and quite apart from questions about modernism per se--more bothersome than generative. The prescriptive sense of the oh-so-tired term bids it be esteemed right into impossibility ("culture," since Matthew Arnold, as the perfection of knowledge and manners that no one can quite achieve); the descriptive one looks ample to the point of meaninglessness ("culture" as a totality hard to differentiate from society itself). Why mess with it anymore?
In her savvy and important new book, Patterns for America: Modernism and the Concept of Culture, Susan Hegeman faces squarely the irritation that "culture" currently produces, arguing both that the slipperiness of the term is a reason to prize rather than dismiss it, and that attempts to negotiate between the aforementioned (and still other) meanings proved crucial to the shaping of a modernism whose consequences continue to be felt. According to her, "the lineaments of many of the most visible contemporary debates about 'culture' are residua of the early Cold War era," and the origins of Cold War formulations themselves to be discerned in confrontations transpiring in the preceding decades . It was during the heyday of modernism that those most concerned with America's ills and possibilities came routinely to invoke "culture" in their diagnoses; it was in the 1930s most acutely, as Warren Susman has argued, that Americans came "to do two new things: to understand themselves as participating in a distinctive 'American' culture, and to see this culture as a set of patterns, values, and beliefs roughly comparable to those of other cultures" . For her, in other words, the roots of our own multicultural panics and pleasures lie in the young century's effort to fulfill at a stroke culture's descriptive and prescriptive mandates--to conceive of an American culture whose virtues would be those of both an American culture (an achieved, coherent culture where none had existed before) and an American culture (not better than any other, but right for Americans where any other would be wrong).
To represent Hegeman's book this way is to make it sound rather more like Our America --Walter Benn Michaels's strenuously provocative effort to intervene in the culture wars through a reading of modernism--than it does in its own voice. Still, it's worth noting up front that in spite of important disagreements (to be considered further on), she shares his belief that the crucial link between modernism and the concept of culture lies in a set of interlocked anxieties about identity and relativism. For her, then, the new understanding described by Susman is rendered "complexly modernist" not only by its siting in the first half of the twentieth century, but also by the "estranged perception of collective identity" that it enables, its allusion to "the construction of group identities of a decidedly uneasy and reflexive kind" . Like Michaels, Hegeman is interested in how unease and reflexivity play around res such as the immigrant and the Indian (Do they represent an alien culture, or the most authentically American culture?), and like him, she finds Americanness at issue in virtually all treatments of culture by American writers of the period. But where his main project is to disclose logics of culture and identity as these materialize in prose fiction, she asks, in addition, where the double sense of "culture" came from, and how it migrated to the realm of literature, high and low.
Her answer is that one origin, at least, lay in what was coalescing, in the early years of the century, as an academic discipline with its own anxieties and enthusiasms. Early in Patterns for America, Hegeman describes as "typically modernist" a certain oft-told tale in which the "'Arnoldian' view of culture as the attainment of social and aesthetic perfection" is "swept away" by "what is often called the 'anthropological' definition of the term, which is more synonymous with custom, connoting both the special and the mundane life ways of a given group of people" . The heroes of this "modernist" story aren't poets, novel-writers, or artists, however, nor is the scene of combat the Paris of Picasso or the London of Arnold, Eliot, and Conrad. Rather, the leading personae are the Columbia University anthropologist Franz Boas and his students; the scene is New York City; and the tale is, precisely, that of how comparative ethnography propelled a rethinking of culture and value that retains its hold on us today.
Hegeman isn't greatly concerned to disburden this story of its heroism, but she does revisit it with an impressive array of reconsiderations and nuances, foremost among them the point that in implicitly opposing (new, good, democratic) ethnography to (old, Arnoldian, hierarchical) literary cultivation, the received story obscures important connections between the Columbia anthropologists and a number of influential literati centered in Greenwich Village during the same years. These connections form the heart of Patterns for America, which--as much intellectual group biography as it is a reading of culture and modernism--might with no loss of aptness have been called Anthropologists and Bohemians in New York, 1918 to 1960, or Greenwich Village to Morningside Heights: An Interdisciplinary Legacy. Yet there's nothing misleading about the title the book does have, for Hegeman shows convincingly how sympathies and disagreements within her loose New York constellation set the terms for much larger debates about the forms of American culture--and in so doing manages nimbly the feat (precious to post-Geertzian anthropology and new historicist literary analysis alike) of drawing broadly consequential inferences from elaborations of specific milieux.
Initially, Hegeman's favored procedure is to pair anthropologists with intellectuals-at-large, in each instance strengthening the case for metaphorical alignment (the two res had similar backgrounds and ideas) with an appeal to metonymy (the two res were linked by the Columbia-Village nexus). In chapter two, for example, she notes in passing that Randolph Bourne was a student of Boas's colleague John Dewey, while considering in some detail how opposition to American intervention in World War One led both Boas and Bourne to their most important contributions to the evolving discourse of culture. (For both, American intolerance of German difference made imperative the defense, if not the articulation, of a relativist cultural pluralism.) In three, she shows how the problem of individual agency within cultural production led both Van Wyck Brooks and Edward Sapir--who shared "the same general social milieu as Boas and Bourne"--to powerful doubts about the very possibility of an authentically valid American culture . And in four, she argues that Ruth Benedict and Waldo Frank are worth reading together not only because of Frank's journalistic connections to Benedict's friend and mentor Sapir, but also because both turned to a "loose federalism" of regional cultures "geographically remote from urban America" for help in resolving the impasses that defeated Sapir and Brooks . Illuminating as this kind of pairing may be, however, it can stand only so much interpretive pressure before it becomes rigid, and Hegeman is alert to that danger. Accordingly, she enriches the Boas-Bourne material with a fresh take on Eliot, the Brooks-Sapir with a look at Alfred Kroeber's notion of "the superorganic," the Benedict-Frank with readings of Jean Toomer and Sherwood Anderson. She abandons the dyadic approach wholly when it ceases to serve, putting Constance Rourke, Kenneth Burke, Robert and Helen Lynd, Thomas Hart Benton, Nathanael West, and others in suggestive array in chapter five, and visiting Benedict, Brooks, Margaret Mead, Dwight Macdonald and James Agee in six.
One advantage of the New York focus is that it enables Hegeman to avoid, very cleanly, one of the traps into which certain historicists (Michaels especially) have been known to fall: that of making appeals to zeitgeist or epistemic rupture unsupported by attention to the paths by which ideas are transmitted and the conditions under which ideological positions mature. It's not that she regards personal contact or shared environments as the necessary foundation of comparison, as if absorption of topics en l'air and undocumented acts of reading and listening aren't the powerful forces they always are; on the contrary, her focal pairs tend to be more distantly connected than other couples that she might have treated at length. (Benedict and Frank, for example, shared nothing like the bonds that linked Benedict to Mead and Sapir.) In its particular way of attending to the Village-Columbia nexus, however, her work answers a demand made by Raymond Williams--but forgotten by some of Williams's less careful admirers--that individuals' experiences, and particularly their experiences of large social forces, be considered as factors in the generation of ideas. True, there are moments when she turns inopportunely from intriguing conceptual problems to blander biographical rationales. When she describes Brooks's tendency to resort to binaries as "a fascinating example of a repetition compulsion," or when (on slender evidence) she traces writers' worries about cultural community to disappointment with the New York scene itself, I hear the note of explanation-through-trauma that is one of contemporary biography's least fortunate tendencies (74, 59, 91, 98). But such moments are rare. More typical is her superb elucidation of how the professionalizing of anthropology and literary criticism affected her subjects' address to national culture, or her canny reading of Agee's recourse to personal recollection in Let Us Now Praise Famous Men--a fitting culmination to her exploration of middle-class guilt's refraction through non-middle-class others in writing of the Cold War and before.
Another reason why biographical sympathies serve Patterns for America so well is that they resonate with a theme that preoccupies Hegeman's subjects: How is individual freedom to be reconciled with the demand of social cohesion? This is, of course, the governing dilemma of liberalism, and as she notes it has shadowed cultural prescription at least since Arnold's recommendation that citizens transcend their "ordinary selves" in favor of "best selves" joined by a cultural glue. Her early chapters show illuminatingly how U.S. writers, confronting both the contradictions of Arnold's "cheery mysticism" and the new world's apparent poverty of tradition, sought to reframe the problem in distinctively American terms . Brooks, for example, tried to imagine a fusion of the spiritual yet desiccated "Puritan" element with that of the practical but unprincipled "Pioneer," yet found in the very intransigence of this binary (and its subsequent incarnations) a split within the middle-class self that culture could never heal. Sapir, in Hegeman's account, came to a similarly unhappy conclusion when he tried to apply his definition of culture as the embodiment of "the national genius" to the case of the United States . And in a provocative reading of Benedict's Patterns of Culture , she argues that the anthropologist's much discussed contrast between the "Apollonian" Zuni of New Mexico and the "Dionysian" Kwakiutl of Vancouver Island may have less to do with the difference between sobriety and ecstasy than with the tension between communal and individual that subtended less veiled period imaginings of the American utopia.
Benedict is the hinge of Hegeman's narrative, as her title might suggest, because her thinking touches, on one side, intellectuals bounded by a more or less Brooksian staging of the problem, and, on the other, a set of mostly younger writers who turned to regionalism for relief from the Arnoldian malady. This second group tried to reconcile diversity with national genius by imagining a country of multiple coherent cultures among which one, some, or none might be privileged as the genuine American article; and it's when she turns to these formulations that she really hits her stride. If the first part of Patterns for America is often insightful, the second is frequently brilliant. Here, a sensitive explication of Sherwood Anderson's Poor White illustrates how a sentimentalized Midwest came to contain America's diversity in the double sense of including it and expunging it; here, an analysis of restless hands in Anderson and Nathanael West illustrates how "Anderson, once held as the exemplar of a new, indigenous American modernist aesthetic, becomes the source of a grotesque representation of the frustrated desires of the middlebrow" (124, 156). Fine as these close readings are, however, the greater strength of this part of the book lies in its ambitious reconstruction of regionalism's role in the culture wars of the interwar years. Working up from instances like Thomas Hart Benton's 1935 response to Diego Rivera (in which Benton replaces Marxism's proletarian version of "the people" with a middle-class and implicitly Midwestern "common man" [142]), she presents an economical, yet extraordinarily powerful, overview of how visions of difference based on region clashed with visions based on class throughout the thirties. Nor is she less suggestive when she winds up the thread of high regionalism's fate. Could the "deep anxiety about cultural loss" felt by forties and fifties intellectuals, she wonders, derive from a kind of spectacular demise of region itself? Might "the increasing globalization of 'American culture'" not have "suggested the increasing difficulty of locating a position for the intellectual to inhabit that was critically exterior to the (global) social whole" (170-1)?
It may be that no critical work ever fails to enact one or two of the problems it describes, and Patterns for America does leave one asking how closely its New York particular represented the American general. The jacket copy promises a tracking of how "the term 'culture' changed from being a technical term associated primarily with anthropology into a term of popular usage," and this promise is handsomely fulfilled in several ways. Hegeman shows concretely how the New York groups disseminated their ideas through anthropological best-sellers, small but influential magazines, government-university partnerships, and other channels; she also usefully spotlights some anti-New York, antihighbrow reactions, notably Time magazine's promotion of Benton and Anderson as regionalists defending sane middle-American representationalism from, respectively, French abstraction and the literary "vagaries of the Da-da school" . Still, I felt a twinge of doubt on encountering the implication that a "widespread consensus over 'culture'" in the thirties enveloped not only "writers, photographers, social crusaders, [and] bureaucrats" but also many an average Joe and Jane, and found myself wondering how culture was actually regarded by more pedestrian residents of places that the New York groups made iconic of regionalism. What were inhabitants of the real New Mexico, the real Ohio, the real Los Angeles thinking ? And what was on the mind of Chicago, a place that Hegeman shows to have been on New Yorkers' minds to a surprising degree? How did Harriet Monroe--hardly an ordinary citizen, certainly, but a Chicagoan in spite of her international connections--feel about culture, regionalism, and identity?
The foregoing isn't a substantial complaint, only a question, and I doubt that many readers will fault Hegeman for failing to cover every last take on culture from the First World War to the Cold. The name of Monroe, however, points to what some will find a more serious absence following from the New York focus, that of extended attention to the expatriate writing still regarded by many as the centerpiece of American modernism. Except for Eliot (about whom more in moment), the expates receive only passing mention here--references to Pound, Stein, and H.D. are few--and even stay-at-home biggies like Stevens, Faulkner, and Moore scarcely surface. 2 To this objection, Hegeman responds by stating plainly that modernism is for her "first and foremost a periodizing concept, characterized by a nexus of related historical, intellectual, technological, and aesthetic developments, rather than . . . a set of formal traits or styles," and by arguing that to hand modernism over wholly to "the cosmopolitan avant-gardes of a few European capitals" is to adopt a view that is "impoverished in its explanatory power" and is more rather than less open to charges of provincialism (19-21). She then offers a précis of recent work on modernism as a historical phenomenon so crisply compact that one might recommend it as a primer for readers outside the field--just as one might hand Patterns for America as a whole to non-anthropologists interested in learning something about that discipline's history. Of course, none of this will satisfy those for whom modernism is a set of formal traits or styles, let alone those who take it to mean a specific canon of authors or works. (Even these, however, might grant Hegeman's claim to the extent that earlier chapters set the stage for her climactic reading of Cold War fabricators of modernism like Macdonald and Clement Greenberg.)
For my money, the muting of expatriate modernism per se offers less occasion for regret than does another omission, that of transatlantic contexts for the American debates Hegeman examines. The book's opening discussion of how "culture" sometimes overlaps with and sometimes opposes "civilization" in writers like Bourne, Sapir, and Lewis Mumford is useful, but it would have been more helpful still if it had engaged more directly with Raymond Williams's work on the tension between these terms in nineteenth-century British discourse, or Norbert Elias's rendering of its inauguration under German Romanticism. (These genealogies would be significant in any case, but they're all the more resonant here because, like Hegeman, both Elias and Williams take very seriously the question of historical actors' experience of social pressures.) 3 As just noted, also, the only American expatriate who receives substantial consideration is T. S. Eliot, but the treatment here fails to engage his most relevant polemic, Notes towards the Definition of Culture . Her early reading of "The Dry Salvages" in relation to developments in anthropology is stimulating, as is her note on the spatialization of culture discernible in After Strange Gods . After this point, however, Eliot all but disappears from the radar, which is odd because Notes makes so many of the pluralist moves that Hegeman explores in other writers. True, Eliot's concern isn't the United States but the United Kingdom (which in his view should remain politically single but culturally multiple: English, Welsh, Scottish, Irish); true also, the texts that she finds most salient in regionalism appeared well before 1949. Yet 1949 isn't beyond the temporal scope of Patterns for America as a whole, and it would surely have been illuminating to put Eliot's later cultural federalism into dialogue with the turn taken by postwar American critics. 4
And speaking of postwar American critics: If the light treatment given Eliot's Notes is a little curious, downright strange is the absence of explicit reference to Lionel Trilling's Beyond Culture , which speaks to Hegeman's concerns more immediately than any other product of the Partisan Review milieu. In his preface to that collection, Trilling not only worries about how far New York (and especially Columbia) intellectuals may presume to speak for a larger society, but also addresses this problem by way of the two meanings of "culture" to which Hegeman recurs (in his rendering: "that complex of activities which includes the practice of the arts and of certain intellectual disciplines," and "a people's technology, its manners and customs, its religious beliefs and organization, its systems of valuation"). 5 Moreover, the governing supposition of Beyond Culture is that "a primary function of art and thought is to liberate the individual from the tyranny of his culture in the environmental sense and to permit him to stand beyond it in an autonomy of perception and judgment." 6 In other words, Trilling here (as in other books like The Liberal Imagination) confronts both the problem of individual agency within culture and a problem of epistemological totality that, as we'll see in a moment, surfaces in the last pages of Patterns for America. Might it be that at some stage in the preparation of Hegeman's book, Trilling was its explicitly presiding genius? As things stand, he remains its (almost) silently presiding ghost.
One omission with which Hegeman can't be charged is a failure to address contemporary battles over "culture." In her last chapter, she applies her insights into the term's genealogy to the question of its place and usage in the United States today, which is to say that Patterns for America, again like Michaels's Our America, is a reading of modernism and culture that has something significant to say to readers with no interest in modernism as such. Confronted with an infinite number of possible approaches to the question, Hegeman elects to examine "arguments that have been made recently by both anthropologists and literary scholars for the complete abandonment of 'culture' as a critical term"--arguments that she would not represent as a "dominant, or even an emergent, view among people invested in . . . things widely thought of as 'cultural'" but that do give some purchase on inclinations and agendas underlying a range of debates on culture today.
Hegeman's first test case is the anthropologist Virginia R. Dominguez's assertion that because the term "culture" has its roots in a Eurocentric elitism, its deployment in anthropology will always be tainted by Eurocentrism and other hegemonic impositions of hierarchy. For Dominguez, in other words, the "anthropological," horizontalizing sense of culture hasn't canceled out, and never can cancel out, the "Arnoldian," vertical vision that it complicated and partially displaced. She addresses this line of argument--and a related one advanced by Johannes Fabian--briskly, asking on what grounds deletion of the term from (anthropological) use should be preferred to a retention that maintains an awareness of the term's complex history. "[U]nless we are to assume that 'culture' is somehow unique among words," she writes, "Fabian and Dominguez are . . . offering a theory of language . . . in which terms somehow inherently contain, or import, specific ideas, largely irrespective of context and usage" . 7 She then turns to a similar recommendation issuing from a nearly opposite critical position, and dispatches it with similar efficiency. To Joel S. Kahn's claim that "culture" is rendered all but meaningless by the distance of the presiding anthropological sense from the Arnoldian origin, and his consequent worry that abuse of "culture" perpetuates an impossible fantasy of "escaping our own concepts and categories into a world of the other" (202; Kahn's phrasing), Hegeman replies that informed retention of a term that insistently recalls the anthropologist's "reflexive dilemma" will likely be more productive for the field than attempts to end ambivalence via dictional purgation (202-3).
Hegeman's final engagement is more extended and more complicated: the opponent this time is Michaels himself, and the texts at issue, Our America and an earlier distillation of its argument, "Race into Culture: A Critical Genealogy of Cultural Identity." In Hegeman's reading, Michaels aligns with Dominguez, Fabian, and Kahn in advocating the eschewing of "culture," and speaks to Kahn especially closely because the ground of this recommendation lies in a critique of "race." Both Kahn and Michaels regard racial essentialism as at once ontologically indefensible and political pernicious, and both link the reification of race to that of culture. Whereas Kahn sees the two terms as operating analogously ("the notion of a culture is formally identical [to that of a race]" [203]), however, Michaels discerns a tighter bond. For him, the "modern concept of culture is not . . . a critique of racism; it is a form of racism," because exhortations to maintain cultural integrity must of necessity be grounded in an appeal to something outside the complex of beliefs and practices that constitute a culture--and that something must be, or at least has been, race. 8
One curiosity of Hegeman's argument with Michaels is that it doesn't unfold on the ground of the American modernism that is the common interest of Patterns for America and Our America; nor does it dwell heavily (though it does dwell some) on present-day popular understandings of "culture" that Michaels strikingly ignores. In keeping with her decision to approach matters via debates in anthropology, Hegeman instead seeks to show how he gets caught up in a version of the reflexive dilemma: chez Michaels, she asserts, "we cannot get outside of our culture any more than we can our beliefs, because like our beliefs, our culture constrains what can be thought--including what can be thought about 'culture'" . 9 Under this view, Michaels joins other advocates of the jettisoning of "culture" who find the term so enveloping that it becomes meaningless, so total that it becomes "impotently descriptive" (Michaels's phrasing) rather than, presumably, potently prescriptive. To this, Hegeman rightly responds that impotence and description need not go together: "Giving descriptive content to 'what we do and believe' . . . would do the significant, and likely very controversial work of (among other things) defining the contours of a bounded population, of marking the difference between 'we' and 'they'" . The stage is then set for her closing recommendation, which is that the term "culture" be retained precisely because it tends to foreground messy exceptions to its own delimitations, and in so doing proves highly serviceable to attempts--utterly crucial "in this postmodern moment of destabilized totalities"--to mediate between "the local instance" and "the conceptual whole" (211-12).
This seems to me a profitable and (once again) sensible suggestion; what I question, however, is whether Michaels quite says everything Hegeman says he says. It seems to me worth taking time to consider further one or two of his arguments, not because Patterns for America is to be seen as laboring in the shadow of Our America (Hegeman's book is significant enough to cast some shadows of its own), but because doing so will give us added purchase on some of her conclusions--and, I think, on the more general question of what relationships among modernism, our own moment, and "culture" finally pertain.
For starters, we might notice that in Our America, if not in "Race into Culture," Michaels is bothered less by culture as such than he is by cultural pluralism--or "cultural pluralism," which, he insists, is an oxymoron. Why? Because
on the one hand, the pluralist claim that our practices are justified only because they are better for us requires us to be able to say who we are independent of those practices and so requires us to produce our racial identity. But, on the other hand, the cultural claim denies the relevance of race and so leaves us unable to appeal to facts about who we are as justifications for what we do. . . . Cultural pluralism is thus committed in principle to identity essentialism, which is to say that in cultural pluralism, culture does not constitute identity, it reflects or, more precisely, expresses it. 10
This claim may sound strange extracted here, but it sounds less so when read as a summary of positions elsewhere developed a little more patiently. Phrased more simply, the claim is that cultural pluralists believe in the preservation of multiple cultures on the ground that those cultures belong to or with certain people, quite apart from any other value they may have; this is in contrast to the view that some cultures or races are worth defending because they're better than others, or even good where others are bad (as in turn-of-the-century white supremacism, which he contrasts to the nativist pluralism of 1920s American writing). While cultural pluralism may be less recognizably racist than this other view, it's not (according to Michaels) actually less so. Each is premised on a reification and indeed a validation of race as the basis of praxis.
There's a certain logical rigor in Michaels's argument, undoubtedly, and if we keep that argument in mind we'll be sure to recognize as racist the insistence that each person must practice--or as we might say more fashionably, "perform"--"her" culture and no other because it's "hers" according to ancestry or biology. Yet how many "pluralists" in this country today actually hold such a view? Certainly, many people believe something of the kind casually much of the time, perhaps less casually at times when their own children's or neighbors' ways of living are at issue. Certainly, too, there are self-proclaimed racists who would readily endorse such a view of cultural obligation, though they might also acknowledge that the cool dictates of culture finally have nothing, for them, on the warm satisfactions of blood. And certainly, again, there are those--Christopher Clausen in last year's Faded Mosaic: The Emergence of Post-Cultural America, for example--who refashion for postmodern times the lament of Bourne, Eliot, and others that true cultural diversity has been one of modernity's victims, the old life ways of distinctive ethnic groups having succumbed to homogenizing forces like advertising and television. 11 Yet it's quite clear that the first two kinds of people are not well characterized as "pluralists." And it remains doubtful that the third, even if pluralist in Michaels's terms, would endorse the proposition that cultural diversity is to be preserved because people should practice what their identity bids them, rather than for the sake of continuity with the past or diversity pure and simple.
Nor, it must be added, would any of these positions be identified with the contemporary political left. This last point isn't pertinent to the absolute logic of Michaels's argument, of course, but it's highly relevant to the status of Our America as an intervention in mid-1990s debates, because the book draws much of its air of controversy from the impression that it aims to expose ugly truths about leftists, not rightists. Actual left-based agendas pertaining to culture, however, are rarely driven by a belief in the metaphysical truth of the proposition that people ought to be true to what they ancestrally are (though, to be fair, they're often supported by an assumption that people should be allowed to be true to what they believe themselves to be, and even--in some cases--that people have a right to possess what they believe to have belonged to their ancestors). A more important motivation for left cultural pluralism is a certain custodial impulse, which may include a commitment to the preservation and dissemination of historical knowledge as well as the kind of general anxiety about things disappearing that impels some environmentalists; another motive is the conviction (shared by conservatives like Clausen) that cultural diversity is valuable simply because it contributes to life's plentitude.
There's also a more evidently political and progressive reason to affirm "culture" as a sanction for certain ideas and practices, which is that concretely injurious hostility to persons believed to belong to other groups is frequently rooted in an antipathy to foreign behaviors, styles, and beliefs--to elements, in other words, that we would unhesitatingly call cultural. This position doesn't require a belief in the reality of race, or even a belief that particular cultural forms need to be attached to particular persons. What it does require is a belief that xenophobia or hostility to difference has been harmful, and that it can be countered in large or small ways by certain affirmations of, or exposures to, practices that could otherwise seem threatening in their strangeness. Michaels performs an inestimably valuable service in reminding us that pluralist initiatives, including multicultural events and curricula, may abet rather than diminish racism insofar as they perpetuate the reification of race and the essentializing of identity. The argument that such initiatives are themselves intrinsically racist, however, is at once overingenious and misleading. It might hold true in a world utterly free of the unreason of history, or rather free of the persistence of unreason, but it's manifestly false in the world we have, where "mistakes" (Michaels's word) like race continue to exert powerful effects on people's lives. 12
Some proponents of this line, certainly, might join with nostalgics like Clausen to decry the degradation of the term "culture" implicit in the foregoing account, especially as it touches on multiculturalism. If the Left proposes a future in which we (where "we" might mean, say, all Americans) come to think of ourselves as one rather than many, but still occasionally trot out some old-country finery or traditional "ethnic" dish by way of nodding to our then-divided ancestors, what has happened to authentic culture? Is what's proffered here not rather an Epcot Center gone global--all ersatz and toothless, and finally not culture at all? Whether such forays (however fraudulent) wouldn't count as elements in a new culture (however attractive or loathsome) is, of course, an open question: the central claim of Clausen's book is that such a condition can't count as culture, which is why the United States in the year 2000 is already, in his calculatingly inflated phrase, "post-cultural." But even if we were to agree that this is a fair picture of multiculturalist aspirations and that it describes something so inauthentic that it ceases to be culture, we might ask why anyone advancing Michaels's argument would care to stake so much on authenticity. It would be strange, after all, to fault pluralists for using culture to support their covertly racist attachment to purity of identity only to fault them for inauthenticity if they respond, "But culture doesn't have to be attached to identity so inflexibly." To the degree that Michaels himself takes this line, then, he does finally oppose "culture" as well as pluralism, for in such terms culture can only serve racist ends or be inauthentic.
All of this should strike us as a problem not least because, as Hegeman reminds us, there are many currently prevalent uses of "culture" that attach to things other than race, including things utterly removed from "identity" in any remotely encompassing sense. We have not only "gay culture," which has been deeply and agonizingly bound up with identity questions, but also "corporate culture," "the culture of death," and locutions like "the culture of my high school," which by and large have not. Michaels entirely refrains from discussing these deployments in Our America, but what they name for contemporary Americans are sets of beliefs and practices characteristic of groups that may not always--and in some cases can absolutely never--subsume one wholly. 13 Authenticity, here, is no longer tethered to essence; one may feel oneself truly a part of corporate culture without believing that one is eternally, absolutely, or even willingly corporate.
It may be that adherents of Michaels's line would find these uses of "culture" illegitimate; the interesting question is what could make them so, apart from the pointlessly doctrinaire claim that culture must always be racial culture. The interesting answer, surely, is that what makes them seem inauthentic is their very rapprochement with partialness. From such a perspective, what makes a "culture" of this sort not a real culture is precisely its failure to meet one of the few criteria on which Arnold and the anthropologists agreed: the criterion of totality, which requires that a culture entail a whole way of being. Hegeman's observation that Michaels "smuggles in" totality when querying culture is therefore apposite, though the notion of totality that subtends his argument may not be exactly the one that she discerns. When Michaels refers to culture as "what we do and believe," he's not, as far as I can tell, evoking the epistemological quandary of how one might get outside one's given conceptual universe in order to talk about that universe. Rather, he's referring to the whole set of beliefs and practices believed to accompany a racial identity, where the presumption is that a person will normally be limited to one identity only.
But fewer and fewer Americans, it seems, believe themselves wholly embedded in a single identity or a single culture (apart from "American" identity and culture), and almost none, probably, imagine all other Americans to be so installed. Charles Altieri alludes to this aspect of contemporary understandings in his contribution to a 1996 forum on Our America in this journal, remarking that
Identity is not a condition that need apply . . . in ways that require a language of grounding substance . . . . [A]ssertions of identity have varying degrees of comprehensiveness depending on the scope of self-reference called for by the situation--my identity as a tennis player may be more intense than my identity as a family man, but it still addresses a much smaller set of features of my life. 14
How many Americans, conservative, moderate, or radical, would insist that immersion in "corporate culture" utterly precludes involvement in, say, "West Indian culture" or "lesbian culture"? A person might, after all, be a West Indian in-house counsel who shares sex and domesticity with another woman; a person might even try to participate in or partake of one or more of these cultures without identifying herself (or himself) as West Indian, corporate, or lesbian. Conservatives may cringe, theorists of performance may rejoice, but the issue here is not whether conceptions of "culture" unhinged from encompassing identity are desirable or undesirable. The point is that such conceptions are in play among contemporary Americans whether one likes it or not. Michaels is certainly correct if he limits himself to the claim that many Americans still do and believe certain things on the grounds that these things belong to their "own" cultures. But he's clearly wrong to imply that American attitudes toward cultural life, cultural diversity, and cultural preservation remain circumscribed, or even dominated, by the belief that one must immerse oneself in one's own culture and nobody else's.
As Hegeman suggests (but might to good effect have brought out more strongly), then, the oscillation of "culture" between wholeness and partialness in contemporary debates results not just from disciplinary uncertainties or scholarly compunction, but from a change in extra-academic understanding that may retain racism of various kinds, but notably eases out the particular strain of racism that occupies Michaels. One of the oddities, not to say ironies, of Michaels's book is that it meticulously charts transformations in the story of "race" and "culture" occurring between the 1890s and the 1920s, yet implies that since the twenties nothing much has altered. In this respect, as in a number of others, Patterns for America is the far superior study of modernism and culture. For not only does Hegeman extend her genealogy of "culture" farther into the century and attend to present-day usages; she also takes care to think about the mechanisms by which certain writers got their beliefs into wide circulation, instead of tacitly mapping the agenda of a historically limited group (early-century pluralists or "progressive racists") on to the whole period of that group's flourishing and on to an ill-defined, though implicitly vast, present-day American imaginary.
But at least one more objection to the retention of "culture" remains. For mightn't it be that the best argument for retiring "culture" lies, precisely, in its recent appropriation by the partial? Couldn't it be argued that, pace Hegeman's tribute to terms with vexed histories, "culture" now promotes a peculiarly harmful confusion because it has come to designate exactly that which both the anthropological and the Arnoldian-Eliotic usages meant to exclude? Couldn't it be claimed that no one's interests--left, center, or right--are served by a term whose polar inversion of its earlier sense promotes the mistaking of partial "culture" for total culture (or partial "cultures" for total cultures)?
Perhaps--except that "culture" has never universally been thought to refer to something total, nor would it be wholly amiss to describe the history of "culture" as a series of attempts to prove encompassing what many imagine to be restricted in scope. We might recall, here, that Arnold frames his Culture and Anarchy as a response to those who would dismiss "culture" as "a smattering of Greek and Latin . . . begotten by nothing so intellectual as curiosity . . . [and] valued either out of sheer vanity and ignorance, or else as an engine of social and class distinction, separating its holder, like a badge or title, from other people who have not got it." Certainly, Arnold wanted to convince his readers that "no serious man would call this culture," and that authentic culture required a continuous and ever-ramifying devotion to the pursuit of perfection; but he acknowledged at the outset that there were (unserious) souls who would mistake it for a detachable set of attainments. 15 What has counted for many as both the originary and the defining use of "culture" in Anglo-American discourse, that is to say, begins with an admission that the term is a contested one, its associations with wholeness comprised by another usage affiliated with the contingent and the partial.
Nor has culture ever been securely total on the anthropological side. Here we might call up Hegeman on how an aspect of nineteenth-century "salvage ethnography" persisted in anthropology well after 1900:
"Salvage" had become . . . a nostalgic operation, recording ways of life that were seen to be dying out in the face of encroaching assimilation and modernization. As James Clifford has pointed out, the very structure of the classic ethnography is based on this newer idea of salvage, which both laments the inevitable loss of the other's 'culture' and then reconstructs it as text." [34]
Virtually from its inception, anthropology has been haunted by the worry that once a group makes contact with modernity, its composite of beliefs and practices may somehow cease to count as its authentic life way--the fear that anything a modern person could actually lay his hands on would fail to qualify as "culture," rigorously speaking. And as many moments in the rest of Hegeman's book elegantly testify, it was but a small step from this anxiety to the thought that modern societies might be as incapable of producing a culture in the purest anthropological sense as they were of generating full culture in the Arnoldian. In other words, if "culture" was to denominate anything experienceable by modern people, limits on the term's use might have to be relaxed sufficiently to admit the partial after all.
For Hegeman's modernists, as we've seen, that concession to partialness didn't come easy: even regionalism, which might at first look like an embrace of diversity, seems on closer inspection to be fueled by a sort of melodrama of synecdoche. (Which region, complete in itself, will stand for America as a unified whole? Which complex of traits will define the region?) Yet it does seem worthwhile to ask whether the mistrust of partialness in this period was as unrelieved as her survey implies. What happens to the picture, we might ask, if we add to the mix a re like Mead? At the end of Coming of Age in Samoa , after all, Mead advises modern Americans to learn from Samoan educational practice not in order to attain a unified culture, but in order to prepare children for existence in a disunified one whose wealth of options may be admired as soon as regretted. "[W]hen no one group claims ethical sanction for its customs, and each group welcomes to its midst only those who are temperamentally fitted for membership," she concludes grandly,
then we shall have realised the high point of individual choice and universal toleration which a heterogeneous culture and a heterogeneous culture alone can attain. Samoa knows but one way of life and teaches it to her children. Will we, who have the knowledge of many ways, leave our children free to choose among them? 16
To be sure, Mead continues to refer to "our" culture in the singular, but it's quite clear that if a yearning for lost unity lingers at all here, it's balanced by a sense that such wholeness can't--and very likely shouldn't--be the destiny of modern people. The knowledge of many ways seems at least as promising a social formula as the limitation to one.
Or suppose we consider the literature of canonical high modernism, which depends for many of its effects on an encounter between a part of life holding intense significance and a great remainder whose very vacuousness, ironically, makes possible the intensity of the other. The neatest example here may come from Virginia Woolf, whose "moments of being" align closely with the cultural productions that count for her as worthwhile; but if we want to stick with Americans we need only turn to Eliot, who in spite of his critical invocations of the Arnoldian whole produced a poetry that depended--more radically than almost anything in nineteenth-century writing--upon a dialectic of the banal and the vital. 17 And even were we to limit ourselves to nonexpatriate Americans, in deference to the parameters of Hegeman's and Michaels's studies, we wouldn't have to go too far to find the same structure at work. Consider, as example, the re of Stevens, the lawyer-by-day / poet-by-night whose poetics locates value in "imagination" but requires also an antithetical term ("reality") for imagination to play upon and, in so doing, secondarily hallow. 18
Of course, high modernists didn't always name the meaning-bearing part of life "culture." But it's important to see that in both their visions and Mead's, the partialness associated with divided experience has a positive aspect with immediate implications for cultural thinking. In both, the intensity or plenitude deriving from meaning's localization makes it at least possible to embrace (rather than lament) the difference between a less happy but existentially richer "us" and a primitive "them" whose culture remains unified and whole. It's understandable that modernist scholarship has had more to say about the urge to go primitive than about the urge to refrain; the latter is harder to detect, and where construed as a claim of modern superiority could make one's chosen authors look more ethnocentric than they otherwise would. Yet it would surely be odd for us to imagine that the word "culture" could signify both a modern person's acquaintance with arts and ideas (descendant of Arnold's smattering of Greek and Latin) and the total set of practices of a non-modern tribe without instilling some sense of parity between a partialness proper to "us" and a wholeness proper to "them."
This is to say, clearly, that one intriguing question left unexplored by Hegeman concerns the ways in which modernism was inflected by the assumed asymmetry between anthropological others and Arnoldian selves--an aymmetry that may have diminished, and undoubtedly complicated, the pathos of lost totality. Is it also to say, however, that in trying to solve the dilemma of culture by embracing partialness more openly and less guiltily, recent decades have only extended or brought to light processes already at work in modernism? Not quite. For the innovation of the later part of the century, in the U. S. at least, has not only been to lower the temperature of remorse; it has also been to join modernism's relatively abstract embrace of division in modern life to sets of practices and beliefs associated with concretely nameable groups, in this sense making the problem of "our" culture an anthropological as well as an Arnoldian matter after all. For more and more Americans, as we've already observed, it's not only that culture can be (coherent) culture without being encompassing, but also that a culture can be a (coherent) culture without constituting a totality. To say that recent decades have moved to validate the partial along both "anthropological" and "Arnoldian" lines, and made this validation the basis of a new integration of the two, is in a way to say no more than that "my culture" means less and less "the culture to which I belong," more and more "a culture that belongs to me."
1. T. S. Eliot, Notes towards the Definition of Culture (New York: Harcourt, Brace, 1949), 17.
2. Marjorie Perloff directed this kind of complaint at Michaels's Our America: Nativism, Modernism, and Pluralism (Durham, N.C.: Duke University Press, 1995); see "Modernism without the Modernists: A Response to Walter Benn Michaels," 3 (September 1996): 99-105.
3. I'm thinking here principally of Williams's Culture and Society: 1780-1950 (1958; New York: Columbia University Press, 1983)--which, it should be noted, Hegeman refers to in two footnotes. For Elias, see The Civilizing Process, trans. Edmund Jephcott (1939; Oxford: Blackwell, 1994).
4. Eliot in fact mentions "having profited by reading an article by Mr. Dwight Macdonald" in his preface to Notes . Hegeman includes two footnotes pointing the reader to Christianity and Culture (New York: Harcourt, Brace, 1988), a volume that reprints Notes toward the Definition of Culture together with The Idea of a Christian Society.
5. Lionel Trilling, Beyond Culture (New York: Viking, 1965), xi.
6. Ibid., xiii.
7. Hegeman's dismissal may be a little too brisk, inasmuch as it passes over a key piece of Dominguez's argument. This is the point that governments around the world invoke a quasi-Arnoldian sense of "culture" in setting policies whose practical results (not to say authentic motives) are worthy of scrutiny. For Dominguez, the problem may be less the Eurocentrism of "culture" per se than the ways culture has been "invoked to explain (justify?) continuing social, economic, and political inequalities" . Thus Hegeman's comments on the place of "culture" within the discourse of anthropology offer needed perspective on Dominguez's claim that "the very notion of a cultural policy does not allow the rebellious, populist, holistic Boasian sense of culture to be employed," but they don't fully answer her questions about what happens when people who contest the validation of European elements or qualities nonetheless buy into "the elite European ideas that there is such a thing as culture and that it is through one's culture that one's value is judged" (24, 36). "Invoking Culture: The Messy Side of 'Cultural Politics.'" South Atlantic Quarterly 91 (Winter 1992): 19-42.
8. Quoted in Patterns for America, 206. See also Our America, 129.
9. An extended consideration of how domestic American currents affected treatments of the reflexive dilemma can be found in Susan R. Trencher's recent Mirrored Images: American Anthropology and American Culture, 1960-1980 (Westport, Conn.: Bergin and Garvey, 2000). Trencher isn't nearly as subtle or interesting as Hegeman, but her book does help to fill in the anthropological narrative in the decades that Patterns for America skips over.
10. Our America, 139-40.
11. Christopher Clausen, Faded Mosaic: The Emergence of Post-Cultural America (Chicago: Ivan R. Dee, 2000).
12. Indeed the most disheartening aspect of Michaels's response to his critics has been his resistance to the idea that the mistake of race might have to be countered, in the world that we do have, by anything more than a simple pointing to the fact of its mistakenness. The summer 1994 issue of Critical Inquiry contains a critique of "Race into Culture" in which Avery Gordon and Christopher Newfield argue that
civil rights era common sense . . . promotes discussion of racism in all of its forms, particularly in its friendlier modern ones, like institutional racism. It asks for increased use of the category of race not because race is a biological fact or even because it defines one's intrinsic personal or cultural identity but because it is one of the most important principles by which U. S. social relations are organized. [740]
In their view, Michaels's essay provides a philosophical rationale for an ascendant liberal racism that concentrates on the pure erroneousness of race rather than on the consequences of that error's persistence; this kinder, subtler form of racism, they write, takes comfort in the proposition that "racism does not make people talk about race; talk about race sustains racism." Critical Inquiry 20 (summer 1994): 739. Perloff makes a related point, commenting on Michaels's failure to see that "[i]n an imperfect world, as the history of our brutal century has taught us, identity is largely a question of how others perceive us" .
Both of these critiques are followed by responses from Michaels that, while thoughtful enough on some fronts, strikingly evade the problem at issue here. Michaels suggests that Perloff's remark encodes a strong essentialist claim about the truth of identity, but this seems willful obtuseness on his part, since it's clear in context that Perloff is talking about how others' perceptions of what we are impinge on the lives we lead, no matter whether these perceptions are true or false. Tellingly, not to say astonishingly, he addresses Nazi persecution, her relevant example, by asserting that we would have no grounds "for criticizing the Nazis if we didn't think that their perceptions of Jewish identity were mistaken," as though brutality alone doesn't provide sufficient matter for rebuke ("Response," 3 [September 1996]: 122). Replying to Gordon and Newfield, meanwhile, Michaels rightly defends reason as a principle of argument, but once again circumvents the crucial point that we don't live in a world in which all parties exercise reason all the time. Criticizing "social" recuperations of race, he works several pages of analysis toward a culminating contention that Gordon and Newfield "are obviously right: U. S. social relations have been and continue to be organized in part by race. My point is that this organization is the consequence of a mistake; and that antiessentialist defenses of race amount to nothing more than new ways of making the mistake" ("The No-Drop Rule," Critical Inquiry 20 [summer 1994]: 769). Yet this both restates Michaels's earlier position and ignores Gordon and Newfield's major contention, which is not that race should be defended as an abstractly significant essence, but that it should continue to be discussed as a historically consequential category.
13. In his response, however, Michaels summarizes his thesis by claiming "that any notion of cultural identity that goes beyond the description of our actual beliefs and practices must rely on race (or something equivalent, say, sex) in order to determine which culture is actually ours (121, emphasis added).
14. Charles Altieri, "Whose America is Our America: On Walter Benn Michaels's Characterizations of Modernity in America," 3 (September 1996): 110.
15. Matthew Arnold, Culture and Anarchy (1869; Cambridge: Cambridge University Press, 1935), 43.
16. Margaret Mead, Coming of Age in Samoa (1928; New York: Modern Library, 1953), 248.
17. The nineteenth-century writing that most clearly marks an exception to this rule--Baudelaire and company--is, of course, also the nineteenth-century writing most often called modernist or protomodernist. In Notes Eliot confronts something very much like the modern condition as described by Mead when he asserts that the more highly developed a culture is, the more likely it is to disintegrate or fragment (22-6). Given that his desiderata are both high development and integration, it's not surprising that he assesses any society's chances of producing a culture worthy of regard as slim.
18. Any attempt to summarize Stevens's thinking on imagination and reality in a few words is bound to misrepresent it, as is any suggestion that it finds a definitive articulation in any one text. Still, it's reasonable to say that Stevens's nearest address to the question of culture and partialness in modern life is also found in one of his fullest statements on imagination, the 1948 essay "Imagination as Value" in The Necessary Angel (New York: Knopf, 1951), 131-56.


{% extends 'base.html' %} {% block content %} {{super()}}
fill in the form below to creatt an account with us
By creating an account you agree to our Terms & Privacy.


y axis
x axis
Graph
?
Graph type:
Line
Area
Bar
Pie
Graph settings:
Title:
X-Axis:
Y-Axis:
X-Axis units:
Y-Axis units:
Graph data:
Import data:


UK weather forecast: Further health warning as temperatures plummet below freezing
Temperatures dropped to -9.9C in one part of Scotland
by Alexander BrockPublic Health England is urging the public to look out for vulnerable and elderly people as temperatures plummet below freezing.
The Met Office has said low temperatures will continue into today (November 20) after -9.9C was recorded in Braemar, north-east Scotland, earlier this week.
With more cold weather on the way, health chiefs have warned that vulnerable people are at risk, Mirror Online reports.
Dr Emer OConnell, consultant in public health at Public Health England, said: "Older people and those with heart and lung problems are at risk of getting sick in cold weather.
"Keep an eye out for those who may need help staying warm, ensure they wear lots of thin layers and have everything they need.
"Below 18 degrees, changes to the body mean that the risk of strokes, heart attacks and chest infections increase so heating homes to this temperature is particularly important to stay well."
For Bristol, temperatures thankfully won't be as bitterly cold.
The outlook for today says: "The rain will clear throughout the morning, leaving patchy cloud and some sunny spells and a light breeze during the day.
"Scattered showers will continue across Cornwall throughout. Maximum temperature 10C."
But temperatures feel feel cooler across the city due to a nasty wind chill.
Met Office 5-day forecast
Wednesday:
Western areas often cloudy with occasional rain. Mostly dry and bright elsewhere. Feeling cold in brisk southeasterly winds, with coastal gales in the west.
Outlook for Thursday to Saturday:
Northern and eastern areas should be dry on Thursday. Bands of rain, already in the southwest, will move slowly and erratically northeast to much of the UK through the period.
For the latest news in and around Bristol, check Bristol Live's homepage .


{{no footnotes|date=March 2013}} {{Infobox prepared food | name = Esterházy torta | image = | caption = Esterházy torta slice, served at a confectionery in Sopron | alternate_name = | country = Hungary and Austria | region = | creator = | course = | type = Cake | served = | main_ingredient = Almond meringue, buttercream | variations = | calories = | other = }}
Esterházy torta is a Hungarian cake (torta) named after Prince Paul III Anton Esterházy de Galántha (1786–1866), a member of the Esterházy dynasty and diplomat of the Austrian Empire. It was invented by Budapest confectioners in the late 19th century and soon became one of the most famous cakes in the lands of the Austro-Hungarian Monarchy.{{citation needed|date=May 2012}}
Esterházy torta consists of buttercream spiced with cognac or vanilla, sandwiched between four to five layers of almond meringue (macaroon) dough. The torte is iced with a fondant glaze and decorated with a characteristic chocolate striped pattern. There are, however, many different recipe variations. In Hungary, the original almonds have been entirely replaced by walnuts.<ref>The Esterházy cake, Ruszwurm Confectionery</ref>
A popular variant, although not in Hungary, are Esterházy Schnitten: while a Torta is always of round shape, Schnitten are made in square shape. Other versions based on sponge cake or decorated with crystallized fruit also exist.
{{reflist}}
{{Cakes}}
{{DEFAULTSORT:Esterhazy torte}}


Values
How would I discribe myself.
4th May, 2015
If you were to ask me what words best discribe you, I would pick: Compassionate, Creativity, Enthusiasm, Family, Justice, Self-reliance.
The one thing that truly defines me is my family. I would do anything I possibilicy can when I come to maily matter. They have always supported me and would truly like to see me succeed. Without my family backing me I dont think I would be able to shift.
Next, I would consider myself self-relianant and compassionate. This is because I always start to think about others when I should be thinking about myslef. This causes me to think about how justice is not present in society and how I can help.
Those are the 6 words that I would choose to discribe my self.


Nav link 1
Nav link 2
Nav link 3
Header link 1
Header link 2
Header link 3
Article link 1
Article link 2
Article link 3
First h2 tag
Third h2 tag
this is image content for scraping
without url param
with url param


A UI element that can be placed via its position, anchor, and size, and can render child elements in a heirarchy.
More...
|
|
| CUIElement () |
| | CUIElement constructor to initialize element pointers.
|
| |
|
void | Update (CGame game) |
| |
|
void | Update (CGame game, Vector2 translation) |
| |
| void | Draw (CGame game) |
| | Draws the element given its computed translation. More...
|
| |
|
void | Draw (CGame game, Vector2 translation) |
| |
|
void | CUIElementDraw (CGame game, Vector2 translation) |
| |
| final void | Anchor (Vector2 anchor) |
| | Sets the anchor (0, 0) -> Top Left, (1, 1) -> Bottom Right. More...
|
| |
|
final void | UpdateTranslation () |
| | Recomputes the translation given the size, position, and anchor.
|
| |
| final void | Position (Vector2 position) |
| | Sets the position. More...
|
| |
| final void | Size (Vector2 size) |
| | Sets the size. More...
|
| |
| final Vector2 | Anchor () |
| | The Anchor. More...
|
| |
| final Vector2 | Position () |
| | The Position. More...
|
| |
| final Vector2 | Size () |
| | The Size. More...
|
| |
| final Vector2 | Translation () |
| | The computed translation. More...
|
| |
| final boolean | IsHovered () |
| | If the mouse is over this element. More...
|
| |
| final boolean | IsPressed () |
| | If the mouse or enter key pressed this element. More...
|
| |
| void | AddChildElement (CUIElement child) |
| | Adds a child element to this element. More...
|
| |
| void | RemoveChildElement (CUIElement child) |
| | Removes a child from this element. More...
|
| |
|
void | ClearChildren () |
| | Removes all children from this element.
|
| |
| final java.util.LinkedList< CUIElement > | Children () |
| | Gets the children of this element. More...
|
| |
| final CUIElement | DownElement () |
| | Gets down pointer. More...
|
| |
| final CUIElement | UpElement () |
| | Gets up pointer. More...
|
| |
| final void | LeftElement (CUIElement element) |
| | Sets left pointer to the element left. More...
|
| |
| final CUIElement | LeftElement () |
| | Gets left pointer. More...
|
| |
| final void | RightElement (CUIElement element) |
| | Sets right pointer to the element right. More...
|
| |
| final CUIElement | RightElement () |
| | Gets right pointer. More...
|
| |
| final boolean | IsSelected () |
| | If the element has been selected. More...
|
| |
|
final void | ConnectVertically (CUIElement other) |
| | Sets this's up pointer to other, other's down pointer to this.
|
| |
| final void | UpElement (CUIElement element) |
| | Sets up pointer to the element above. More...
|
| |
| final void | DownElement (CUIElement element) |
| | Sets down pointer to the element below. More...
|
| |
| CUIElement | DetermineSelected (Vector2 mousePosition) |
| | Determines which UI element is selected given the computed translation. More...
|
| |
|
CUIElement | DetermineSelected (Vector2 mousePosition, Vector2 translation) |
| |
A UI element that can be placed via its position, anchor, and size, and can render child elements in a heirarchy.
| void game.ui.CUIElement.AddChildElement |
( |
CUIElement |
child | ) |
|
Adds a child element to this element.
- Parameters
-
| final void game.ui.CUIElement.Anchor |
( |
Vector2 |
anchor | ) |
|
Sets the anchor (0, 0) -> Top Left, (1, 1) -> Bottom Right.
- Parameters
-
| final Vector2 game.ui.CUIElement.Anchor |
( |
| ) |
|
| final java.util.LinkedList<CUIElement> game.ui.CUIElement.Children |
( |
| ) |
|
Gets the children of this element.
- Returns
| CUIElement game.ui.CUIElement.DetermineSelected |
( |
Vector2 |
mousePosition | ) |
|
Determines which UI element is selected given the computed translation.
- Parameters
-
| mousePosition | Position of the mouse |
| parent | Parent of UI element |
- Returns
- The selected UI element
| final CUIElement game.ui.CUIElement.DownElement |
( |
| ) |
|
Gets down pointer.
- Returns
| final void game.ui.CUIElement.DownElement |
( |
CUIElement |
element | ) |
|
Sets down pointer to the element below.
- Parameters
-
| void game.ui.CUIElement.Draw |
( |
CGame |
game | ) |
|
Draws the element given its computed translation.
Derived classes should override this. Also draws its children.
- Parameters
-
| final boolean game.ui.CUIElement.IsHovered |
( |
| ) |
|
If the mouse is over this element.
- Returns
- TRUE if the mouse is over this element
| final boolean game.ui.CUIElement.IsPressed |
( |
| ) |
|
If the mouse or enter key pressed this element.
- Returns
- TRUE if the mouse or enter key pressed this element
| final boolean game.ui.CUIElement.IsSelected |
( |
| ) |
|
If the element has been selected.
- Returns
- TRUE if the element has been selected
| final void game.ui.CUIElement.LeftElement |
( |
CUIElement |
element | ) |
|
Sets left pointer to the element left.
- Parameters
-
| final CUIElement game.ui.CUIElement.LeftElement |
( |
| ) |
|
Gets left pointer.
- Returns
| final void game.ui.CUIElement.Position |
( |
Vector2 |
position | ) |
|
Sets the position.
- Parameters
-
| final Vector2 game.ui.CUIElement.Position |
( |
| ) |
|
| void game.ui.CUIElement.RemoveChildElement |
( |
CUIElement |
child | ) |
|
Removes a child from this element.
- Parameters
-
| final void game.ui.CUIElement.RightElement |
( |
CUIElement |
element | ) |
|
Sets right pointer to the element right.
- Parameters
-
| final CUIElement game.ui.CUIElement.RightElement |
( |
| ) |
|
Gets right pointer.
- Returns
| final void game.ui.CUIElement.Size |
( |
Vector2 |
size | ) |
|
Sets the size.
- Parameters
-
| final Vector2 game.ui.CUIElement.Size |
( |
| ) |
|
| final Vector2 game.ui.CUIElement.Translation |
( |
| ) |
|
The computed translation.
- Returns
| final void game.ui.CUIElement.UpElement |
( |
CUIElement |
element | ) |
|
Sets up pointer to the element above.
- Parameters
-
The documentation for this class was generated from the following file:
- android/src/game/ui/CUIElement.java


| Class | Description |
|---|---|
| CommonReferenceOperator |
Entity for the COMMON_REFERENCE_OPERATOR table.
|
| ConnectionForecastSnapshot |
Object used to save a Connection Forecast Snapshot (power per connection per PTU per period).
|
| ConnectionGroupPowerContainer |
Extension of
PowerContainer to link it with a ConnectionGroup |
| ConnectionPowerContainer |
Extension of
PowerContainer to link it with a Connection |
| DeviceMessage |
Entity class representing an ADS Device Message.
|
| DeviceRequest |
Abstract class for
DeviceRequest , with the core information |
| Element |
Base entity for the Element Data store.
|
| ElementDtuData |
A extra object to represent the ElementData per DTU.
|
| ForecastPowerData |
Extended PowerData for Forecast data.
|
| IncreaseRequest |
Class representing a Power Increase request (production or consumption), child of
VariationRequest . |
| InterruptRequest |
Class representing an Interrupt Request for a device.
|
| PowerContainer |
This object represents all power data within usef.
|
| PowerData |
Helper object which contains all the fields for one set of PowerData.
|
| ReduceRequest |
Class representing a Power Reduction request (production or consumption), child of
VariationRequest . |
| ReportRequest |
Class representing a Report Request for a device.
|
| ShiftRequest |
Class representing a Shift Request for a device.
|
| SynchronisationConnection |
Entity for the SYNCHRONISATION_CONNECTION Table.
|
| SynchronisationConnectionStatus |
Entity for the SYNCHRONISATION_CONNECTION_STATUS Table.
|
| Udi |
Udi entity class represents the UDI device which forecasts have been received. |
| UdiEvent |
Entity class representing a UDI Event.
|
| UdiPowerContainer |
Extension of
PowerContainer to link it with a Connection |
| VariationRequest |
Abstract class child of
DeviceRequest . |
| Enum | Description |
|---|---|
| ConsumptionProductionType |
Enumeration of the action types for power values (used for device capabilities and requests):
CONSUMPTION
PRODUCTION
|
| DeviceMessageStatus |
Enumeration of the various statuses possible for a
DeviceMessage entity. |
| ElementType |
A enum to represent the different Element Types.
|
| Priority |
Enumeration of the various priorities for UDI Events.
|
| SynchronisationConnectionStatusType |
Enumeration of the several allowed status of a
SynchronisationConnection in the BRP database. |
| UdiEventType |
Enumeration of the various UDI Event types.
|
Copyright © 2016. All rights reserved.


httplib
The HTTPlib is a collection of classes to handle HTTP Headers (reading / creating them). They are used by the webserver, so normally there
is no need to use them as long as you don't use IWebserverPassthrough. There it could become in handy using the HTTPlib classes to handle the
HTTP header stuff. After setting the version number and the HTTP result (or the HTTP request method), the header is prepared to be send.
You can set what ever field you want to and send that header directly by getting the buffer to the byte-stream and the size of it. So there
is no need for any other function to prepare a http header. Just set the version, the request or result, what ever field you want to set more
(it will always be a good idea to set at least the content length, even if it will be 0) and send the header.
File information
Classes
HTTPLib
class HTTPLib {
public:
static inline const char * GetHTTPRequestMethodName(http_request_method_t method);
inline static const http_result_t * HTTPResultFromStatusNumber(int number);
inline static const http_result_t * HTTPResultFromStatusNumberStr(const char * numStr);
};
This class actually is only for wrapping the types and constants used by the HTTP lib (beside the one helper function described here). The other parts of
that class are described in the data types section of this document (see below).
Public functions
GetHTTPRequestMethodName
This inline function simply is for getting the name (as string) for a given HTTP method.
Parameters
| http_request_method_t method | The method id to get the name for. |
Return Values
The name of the method as string.
HTTPResultFromStatusNumber
This inline function simply is for converting the integer status code to http_result_t *.
Parameters
| int number | The status code as int. |
Return Values
The corresponding http_result_t *.
HTTPResultFromStatusNumberStr
This inline function simply is for converting a char * "integer" status code to http_result_t *.
Parameters
| const char * numStr | The status code as char * which contains numbers. |
Return Values
The corresponding http_result_t *.
class HTTPHeader {
public:
HTTPHeader();
~HTTPHeader();
void SetHTTPVersion(int major, int minor);
void SetHTTPResult(const HTTPLib::http_result_t * result);
void SetContentSize(ulong64 size);
void SetContentRange(ulong64 start, ulong64 end, ulong64 completeSize);
void SetContentType(const char * contentType);
void SetEncoding(HTTPLib::http_encoding_t enc);
void SetETag(const char * etag);
void SetConnection(HTTPLib::http_connection_t connection);
void SetUpgrade(HTTPLib::http_upgrade_t upgrade);
void SetWebsocketAcceptKey(const char * key);
void SetCustomField(const char * field);
void SetCustomField(const char * field, const char * value);
void SetDate();
void SetRequest(HTTPLib::http_request_method_t req, const char * resource);
const char * GetHeaderData() { return buffer; }
size_t GetHeaderSize() { return contentSize; }
};
This class is used for creating an HTTP header asresponse or request. If you want to parse an HTTP Header, HTTPParser must be used.
Public functions
SetHTTPVersion
Sets the major and minor version of the HTTP protocol you want to use. If a header will be created as a response, the HTTP version requested can be obtained
from an HTTPParser instance by calling HTTPParser::GetMajorVersion() or HTTPParser::GetMinorVersion() and set the same version for the response as used for
the request.
This function must be called before using any other function, or the header you're going to build up will be incorrect. However, if you need to build a HTTP
header multiple times for response to requests, you can reuse a HTTPHeader instance, setting the version only once and reuse it by setting the HTTP result
code at first.
Parameters
| int major | The major HTTP version to set. |
| int minor | The minor HTTP version to set. |
SetHTTPResult
Set the result code for the HTTP header, to response to a HTTP request. This function will reset all other, previous set header data (except the HTTP version).
So by setting the result code first n already existing HTTPHeader object can be reused for further response header creation.
Parameters
| HTTPLib::http_result_t * result | Pointer to the result code. Must be one of the HTTPLib::HTTP_* constants (see below). |
SetContentSize
Set the content-length field of the header. It should be set every time, regardless if the size is 0 (for no content) or not.
Parameters
| ulong64 size | The content length to set. |
SetContentRange
Set the Content-Range field of the header. The start and end values are numbered from 0. The range field will be encoded with the given
complete size in the format "start-end/completeSize".
Parameters
| ulong64 start | The start of the range. |
| ulong64 end | The end of the range. |
| ulong64 completeSize | The complete size of the requested resource. |
SetContentType
Set the mime-type of the content field of the header.
Parameters
| const char * contentType | The mime-type of the content to set (e. g. "text/html; charset=utf-8"). |
SetContentType
Set the mime-type of the content field of the header.
Parameters
| const char * contentType | The mime-type of the content to set (e. g. "text/html; charset=utf-8"). |
SetContSetEncodingentType
Set the encoding of the content. For now, there are only two encoding type: HTTP_ENCODING_NONE and HTTP_ENCODING_GZIP if the content is in gzip compressed format.
Parameters
| HTTPLib::http_encoding_t enc | The encoding type to set. |
SetETag
Set the etag. The etag field will be used to support browser side caching of data.
Parameters
| const char * etag | The etag to set. |
SetConnection
Set the connection type.
Parameters
| HTTPLib::http_connection_t connection | The type of the connection (HTTP_CONNECTION_NONE, HTTP_CONNECTION_KEEP_ALIVE, HTTP_CONNECTION_UPGRADE). |
SetUpgrade
Set the upgrade type for connections defined with HTTP_CONNECTION_UPGRADE. For now, only HTTP_UPGRADE_WEBSOCKET is supported.
Parameters
| HTTPLib::http_upgrade_t upgrade | The upgrade type for the connection. |
SetWebsocketAcceptKey
Set the key to accept incomming websocket connection (only for response headers).
Parameters
| const char * key | The key to set. |
SetCustomField (overloaded)
Set a custom header field. In this version of the function, the header field with the value must be given with the HTTP header conform format ("FieldName: Value").
Custom header field means not only totally user defined header fields, but also every protocol defined header field not covered by any of the other Set*() functions.
Parameters
| const char * key | The headerfield with the value to set. |
SetCustomField (overloaded)
Set a custom header field. In this version, the header field anem and the value can be given seperately. Custom header field means not only totally user defined
header fields, but also every protocol defined header field not covered by any of the other Set*() functions.
Parameters
| const char * field | The name of the headerfield to set. |
| const char * key | The value for that field. |
SetDate
Set the date-time field for the HTTP header, using the current time.
SetRequest
(For request only) Set the request the header is for. This function resets all internal fields, starting to build up a new header.
Parameters
| HTTPLib::http_request_method_t method | The HTTP request method to build the header for. |
| const char * resource | The resource to request. |
GetHeaderData
Return Value
The http header in completely build up version, ready to send.
GetHeaderSize
Return Value
The length of the HTTP header.
HTTPParser
class HTTPParser {
public:
typedef enum {
HTTP_PARSE_DONE,
HTTP_PARSE_NEED_DATA,
HTTP_PARSE_CANCEL,
HTTP_PARSE_ERROR
} parseresult_t;
HTTPParser();
~HTTPParser();
size_t ParseData(char * data, size_t len, UHTTPParser * user = nullptr);
parseresult_t GetParseResult() const { return (parseresult_t)parseResult; }
HTTPLib::http_encoding_t GetAcceptEncoding() const { return acceptEncoding; }
HTTPLib::http_request_method_t GetRequestMethod() const { return reqMethod; }
const char * GetRequestTarget() const { return requestTarget; }
const char * GetRequestParameters() const { return requestParameters; }
int GetMajorVersion() const { return httpVersion >> 8; }
int GetMinorVersion() const { return httpVersion & 0x00FF; }
int GetVersion() const { return httpVersion; }
const HTTPHeaderField * GetHeaderField(const char * fieldName) const;
ulong64 GetContentLength() const { return contentLength; }
bool IsConnectionType(HTTPLib::http_connection_t ct) const { return (connectionType & ct) != 0; }
bool IsChunkedTransfer();
const char * GetCookie() const { return cookie; }
const char * GetETag() const { return etag; }
const char * GetContentType() const { return contentType; }
const char * GetHost() const { return host; }
HTTPLib::http_upgrade_t GetUpgrade() const { return upgradeType; }
const HTTPRange * GetRange() const { return rangeListStart; }
size_t GetRangeCount() const { return rangeCount; }
HTTPLib::http_encoding_t GetEncoding() const { return encoding; }
const char * GetWebsocketKey() const { return websocketKey; }
int GetWebsocketVersion() const { return websocketVersion; }
const char * GetOrigin() const { return origin; }
const HTTPLib::http_result_t * GetHTTPResultCode() const { return httpResultCode; }
size_t GetHeaderSize() const { return 0; }
char * MakeHeaderCopy() const { return nullptr; };
void GetFieldListCopy(byte * & buffer, size_t & bufferSize) const;
};
This class will be used to parse a byte stream for a HTTP header and extract the fields / data from the header. Note that the byte stream
must begin with a valid HTTP header, or an error will be returned.
Public functions
ParseData
Parsed the given data with the given length. You have to first call this function and then call GetParseResult() to check the status of the parsing process.
Everything will be copied to an inside buffer, so the given buffer can be reused to receive additional header data to parse.
Parameters
| char * data | The data to parse. |
| size_t len | The number of bytes inside the given data buffer. |
| UHTTPParser * user |
An UHTTPParser instance that will be called after the request line had been parsed. This helps to define, wheter
parsing should continue or not. See UHTTPParser for more information.
|
Callbacks
If the header indicates a HTTP request and if user is not nullptr, UHTTPParser::HTTPParserValidateRequest() will be called after parsing the first line (which is the request
line), so that the request can be accepted or recjected before continue parsing the rest of the header.
Return Values
The number of bytes processed from the given data buffer. If less then len, the value should be added to data to acces the data behind the header inside the byte stream.
GetParseResult
Return Value
The result of the last ParseData() call. The result determines how to continue and will be one of the following value:
- HTTP_PARSE_DONE: Parsing had been finished succesfully. You can now access the values of the parsed header.
- HTTP_PARSE_NEED_DATA: The end of the given bytestream had been reached without reaching the end of the header. ParseData() must be called again with the continouse data of the byte stream.
- HTTP_PARSE_ERROR: An error occures during parsing. Noramly that means, that a correct header could not been found or that there was some error inside the header structure. In this case, the bytestream should be discarded, because there is no way of recovering the broken header and correctly interpreting whatever data follow.
GetAcceptEncoding
Return Value
Returns the encoding the other requested server or requesting client side will accept. For now, HTTPlib only support the GZIP encoding (HTTP_ENCODING_GZIP).
GetRequestMethod
Return Value
Returns the request method of the header. Will be one of the following values:
- HTTP_NONE
- HTTP_GET
- HTTP_HEAD
- HTTP_POST
- HTTP_PUT
- HTTP_CONNECT
- HTTP_OPTIONS
- HTTP_TRACE
- HTTP_PROPFIND
- HTTP_MKCOL
- HTTP_COPY
- HTTP_MOVE
- HTTP_DELETE
GetRequestTarget
Return Value
Retruns the requested target aka requested resource.
GetMajorVersion
Return Value
Retruns the major version of the HTTP protocol for the request.
GetMinorVersion
Return Value
Retruns the minor version of the HTTP protocol for the request.
GetHeaderField
Use this function to ask for a specified header field. Use this if the headerfield you need canot be accessed through the functions of the mostly used
header fields provided by HTTPParser.
Parameters
| const char * fieldName | The name of the header field to get. |
Return Value
If the header field canot be found, the function returns nullptr. Else a HTTPHeaderField instance will be returned, providing the detail of the field. That instance
canot be deleted and will completely managed by HTTPParser itself.
GetContentLength
Return Value
(For response only) Reports the content length defined by the header. This will be the amount of data to read from the byte stream to completely process the response. Can be 0.
Remarks
The return value of 0 doesn't mean, that there is no further data to process. The data send with a response can also be chunk encoded. Check IsChunkedTransfer() to get
that information.
IsConnectionType
Can be used to check if the parsed header defines a special type of connection.
Parameters
| HTTPLib::http_connection_t ct | The connection type to check for. |
Return Value
True, of the conenction type given is defined in the header, else false.
Remarks
The value for ct must be HTTP_CONNECTION_NONE, HTTP_CONNECTION_KEEP_ALIVE or HTTP_CONNECTION_UPGRADE. See the data types section below for details.
IsChunkedTransfer
Return Value
True, if there is data available in chunk encoded format. reading and handling the cunks will be the applications responsebility.
GetCookie
Return Value
Returns the value of the cookie header field.
GetETag
Return Value
Returns the value of the etag header field.
GetContentType
Return Value
Returns the content type (aka mime-type) declared by the header.
GetHost
Return Value
Returns the host reported by the header.
GetUpgrade
Return Value
Returns the upgrade type (if there is any). For now, the HTTPlib only supports HTTP_UPGRADE_WEBSOCKET.
GetRange
Return Value
Returns an HTTPRange object to access the values given by the range header field. If there is no range request, nullptr will be returned.
The returned object is the start of a linked list of ranges. See HTTPRange for more information.
GetEncoding
Return Value
Returns the value of the headers content-encoding field.
GetWebsocketKey
Return Value
Returns the websocket key.
GetWebsocketVersion
Return Value
Returns the requested websocket version.
GetOrigin
Return Value
Returns the value of the origin field.
GetHTTPResultCode
Return Value
For response headers, the function returns the HTTP result code of the previous request. If the incomming header was a request and there was an error during parsing the header,
the function returns the HTTP result code to send as an answer.
GetFieldListCopy
Makes a copy of the field list from the header.
Parameters
| byte * & buffer | (Out) A reference to a byte * variable the buffer with the copy will be written to. |
| size_t & bufferSize | (Out) A reference to a size_t variable the size of the buffer with the copy will be written to. |
Return Value
After creating the copy, the pointer to the malloced buffer will be stored int the variable bufffer, and the size of it in bufferSize. The caller is responsible for
releasing the buffer if no longer needed by calling free(buffer).
UHTTPParser
class UHTTPParser {
public:
virtual ~UHTTPParser() {}
virtual bool HTTPParserValidateRequest(class HTTPParser * httpParser) = 0;
};
This class is for passing a user to HTTPParser::ParseData(). After parsing the request line, UHTTPParser::HTTPParserValidateRequest() will be called. The app can
check the request and validate it the HTTPParser continues with parsing the rest of the header. This can be done by checking the values of the given HTTPParser
instance. Note that only the request type and the requested resource will be available at this point, but no header fields.
Public functions
HTTPParserValidateRequest
Will be called after parsing the request line to let the app decide, whether to continue parsing or not.
Parameters
| HTTPParser * httpParser | The calling HTTPParser object. |
Return Value
True to continue parsing, false to cancel it.
Remarks
When canceling the parsing process, the app must take care of eating up all unused data to clean the byte stream (if the same byte stream should be used for parsing
the next header).
class HTTPHeaderField {
public:
const char * GetValue(size_t idx) const { return values[idx]; }
size_t GetValueCount() const { return valueCount; }
};
Represents a HTTP header field and its values. Even if a field can have more values (that means, that field appears mutltiple times in the header), there also can be
multiple values set, seperated by ';'. Those will be handled as one value only, so an app must seperate them if needed. An header field can be obtained by calling
HTTPParser::GetHeaderField().
Public functions
GetValue
Returns the value of the header field.
Parameters
| size_t idx | The index of the value to get. Must be between 0 and GetValueCount(). |
Return Value
The value of the header.
Remarks
Don't manipulate that string (even not by typecasting). If there is need to edit the items, a copy of that return value mast be made.
GetValueCount
Return Value
The number of values available for that field.
HTTPRange
class HTTPRange {
public:
HTTPRange() { this->next = NULL; }
virtual ~HTTPRange() {}
enum {
RANGE_NONE = 0x00,
RANGE_START_END = 0x01,
RANGE_START_ONLY = 0x02,
RANGE_LAST_BYTES = 0x03
} rangeType;
size_t start;
size_t end;
HTTPRange * next;
};
Represents the values of ranges send with an HTTP header. An instance of HTTPRange will be returned by HTTPParser::GetRange(). The retunred instance is the start of a linked list.
So you must not call delete on it! HTTPParser itself will take care of releasing the objects when needed. The class itself has no functions. You have access directly to the fields
of the class.
start
The start of the range given by the HTTP header.
end
The end of the range given by the HTTP header.
rangeType
The type of the range. Depending on the type the values of start and end need to be interpreted. rangeType can be one of the following:
- RANGE_NONE: only used internally for initialization.
- RANGE_START_END: a range with start and end, with the values in the fields start and end.
- RANGE_START_ONLY: only the start had been given. So the application should return everything from of the from the byte given in start to the end of the file. The value of end is undefined and should be ignored.
- RANGE_LAST_BYTES: only the last bytes of a file should be retunred. The number of the bytes to return are set in start. The value of end is undefined and should be ignored.
Data types
Defines / Statics
#define CLRF "\r\n"
#define HTTP_GET_KEY "GET"
#define HTTP_HEAD_KEY "HEAD"
#define HTTP_POST_KEY "POST"
#define HTTP_PUT_KEY "PUT"
#define HTTP_CONNECT_KEY "CONNECT"
#define HTTP_OPTIONS_KEY "OPTIONS"
#define HTTP_TRACE_KEY "TRACE"
#define HTTP_PROPFIND_KEY "PROPFIND"
#define HTTP_MKCOL_KEY "MKCOL"
#define HTTP_COPY_KEY "COPY"
#define HTTP_MOVE_KEY "MOVE"
#define HTTP_DELETE_KEY "DELETE"
#define HTTP_LOCK_KEY "LOCK"
#define HTTP_UNLOCK_KEY "UNLOCK"
#define HTTP_PROPPATCH_KEY "PROPPATCH"
#define HTTP_SYSCLIENT_KEY "SYSCLIENT"
#define HTTP_VERSION_1_0 0x0100
#define HTTP_VERSION_1_1 0x0101
| CLRF | The end of line, used inside the HTTP header. The Header ends with on empty line, which is a line that only holds CLRF. |
| HTTP_GET_KEY | The keyword for a GET request. |
| HTTP_HEAD_KEY | The keyword for a HEAD request. |
| HTTP_POST_KEY | The keyword for a POST request. |
| HTTP_PUT_KEY | The keyword for a PUT request. |
| HTTP_CONNECT_KEY | The keyword for a CONNECT request. |
| HTTP_OPTIONS_KEY | The keyword for a OPTIONS request. |
| HTTP_TRACE_KEY | The keyword for a TRACE request. |
| HTTP_PROPFIND_KEY | The keyword for a PROPFIND request. |
| HTTP_MKCOL_KEY | The keyword for a MKCOL request. |
| HTTP_COPY_KEY | The keyword for a COPY request. |
| HTTP_MOVE_KEY | The keyword for a MOVE request. |
| HTTP_DELETE_KEY | The keyword for a DELETE request. |
| HTTP_LOCK_KEY | The keyword for a LOCK request. |
| HTTP_UNLOCK_KEY | The keyword for a UNLOCK request. |
| HTTP_PROPPATCH_KEY | The keyword for a PROPPATCH request. |
| HTTP_SYSCLIENT_KEY | Internally AppPlatform specified request - don't use it. |
| HTTP_VERSION_1_0 | Dword constant for HTTP 1.0. |
| HTTP_VERSION_1_1 | Dword constant for HTTP 1.1. |
http_request_method_t
typedef enum {
HTTP_NONE,
HTTP_GET,
HTTP_HEAD,
HTTP_POST,
HTTP_PUT,
HTTP_CONNECT,
HTTP_OPTIONS,
HTTP_TRACE,
HTTP_PROPFIND,
HTTP_MKCOL,
HTTP_COPY,
HTTP_MOVE,
HTTP_DELETE,
HTTP_LOCK,
HTTP_UNLOCK,
HTTP_PROPPATCH,
HTTP_SYSCLIENT
} http_request_method_t;
This enum is used to define the method to use for a HTTP request and must be one of the following:
| HTTP_NONE | (NO HTTP VALUE!!!) Dummy value to initialize variable. |
| HTTP_GET | Transfer a current representation of the target resource. |
| HTTP_HEAD | Same as GET, but only transfer the status line and header section. |
| HTTP_POST | Perform resource - specific processing on the request payload. |
| HTTP_PUT | (WebDAV) Replace all current representations of the target resource with the request payload. |
| HTTP_CONNECT | Establish a tunnel to the server identified by the target resource. |
| HTTP_OPTIONS | (WebDAV) Describe the communication options for the target resource. |
| HTTP_TRACE | (WebDAV) Perform a message loop - back test along the path to the target resource. |
| HTTP_PROPFIND | (WebDAV) Used to revceive properties for the given resource. |
| HTTP_MKCOL | (WebDAV) Creates a new collection at the specified location. |
| HTTP_COPY | (WebDAV) Copy the given resource to a specificed location. |
| HTTP_MOVE | (WebDAV) Moves the given resource to a specified location. |
| HTTP_DELETE | (WebDAV) Deletes the given resource. |
| HTTP_LOCK | (WebDAV) Locks the given resource. |
| HTTP_UNLOCK | (WebDAV) Unlocks the previously locked resource. |
| HTTP_PROPPATCH | (WebDAV) Patches the properties of the given resource. |
| HTTP_SYSCLIENT | (Used internally only) Sysclient request to authenticate localsocket requests - internally used. |
http_connection_t
typedef enum {
HTTP_CONNECTION_NONE = 0x00,
HTTP_CONNECTION_KEEP_ALIVE = 0x01,
HTTP_CONNECTION_CLOSE = 0x02,
HTTP_CONNECTION_UPGRADE = 0x04
} http_connection_t;
This enum describes the type of a connection and must be one of the following:
| HTTP_CONNECTION_NONE | The connection has no special state. This is the default. |
| HTTP_CONNECTION_KEEP_ALIVE | The connection is defiend to keep alive. |
| HTTP_CONNECTION_CLOSE | If defined, the connection must be closed after responding or receiving the response to a request. |
| HTTP_CONNECTION_UPGRADE | The connection should be (for requests) or had been (for responses) upgraded. Normally that will be used to establish websocket connections. |
Remarks
The way how to handle HTTP_CONNECTION_KEEP_ALIVE and HTTP_CONNECTION_CLOSE depends on the used HTTP protocol version. For HTTP 1.0, close will be the default. So if HTTP_CONNECTION_KEEP_ALIVE is
not set, the connection must close after responding or receiving the response of a request. For HTTP 1.1, keep alive is the default. So the connection should only be closed after receiving the
response or responding a request, if HTTP_CONNECTION_CLOSE is set.
http_upgrade_t
typedef enum {
HTTP_UPGRADE_NONE,
HTTP_UPGRADE_WEBSOCKET
} http_upgrade_t;
These are the upgrades the a request can define.
| HTTP_UPGRADE_NONE | No upgrade, just a normal connection. This is the default. |
| HTTP_UPGRADE_WEBSOCKET | The connection had been or should be upgraded to be a websocket connection. |
http_encoding_t
typedef enum {
HTTP_ENCODING_NONE, // Default
HTTP_ENCODING_GZIP
} http_encoding_t;
These are the encoding types for a HTTP connection (the moment, only gzip is supported as special encoding).
| HTTP_ENCODING_NONE | No encoding. This is the default. |
| HTTP_ENCODING_GZIP | The data received or sent is in gzip compressed format. |
http_result_t
typedef struct {
int code;
const char * description;
size_t descLen;
} http_result_t;
This structure holds an HTTP result code in three parts: an integer value (easier to use for checking inside the code), a descroption string (actualle the one
tha must be put to the header) and the length of the description. The HTTPLib defines constants for most of the result codes (see below). That constans
can be used to pass to functions loke HTTPHeader::SetHTTPResult(). For more information about the resturn codes see RFC 7231, Page 41.
Values
| int code | The HTTP code as interger value. |
| const char * description | The description of the code. |
| size_t descLen | The length of the description. |
Remarks
HTTPLib has most of the HTTP return codes predefined in HTTP_* constants. The interger code of them is the same a the code of the result. So HTTP 100 has the integer number 100.
The Description is a combination of the code number and the description defined by RFC (e. G. "200 OK"). The following result codes are offered by HTTPLib:
| HTTP_100 | Continue |
| HTTP_101 | Switching Protocols |
| HTTP_200 | OK |
| HTTP_201 | Created |
| HTTP_202 | Accepted |
| HTTP_203 | Non-Authoritative Information |
| HTTP_204 | No Content |
| HTTP_205 | Reset Content |
| HTTP_206 | Partial Content |
| HTTP_207 | Multi-Status |
| HTTP_300 | Multiple Choices |
| HTTP_301 | Moved Permanently |
| HTTP_302 | Found |
| HTTP_303 | See Other |
| HTTP_304 | Not Modified |
| HTTP_305 | Use Proxy |
| HTTP_307 | Temporary Redirect |
| HTTP_400 | Bad Request |
| HTTP_401 | Unauthorized |
| HTTP_402 | Payment Required |
| HTTP_403 | Forbidden |
| HTTP_404 | Not Found |
| HTTP_405 | Method Not Allowed |
| HTTP_406 | Not Acceptable |
| HTTP_407 | Proxy Authentication Required |
| HTTP_408 | Request Timeout |
| HTTP_409 | Conflict |
| HTTP_410 | Gone |
| HTTP_411 | Length Required |
| HTTP_412 | Precondition Failed |
| HTTP_413 | Payload Too Large |
| HTTP_414 | URI Too Long |
| HTTP_415 | Unsupported Media Type |
| HTTP_416 | Range Not Satisfiable |
| HTTP_417 | Expectation Failed |
| HTTP_423 | Locked |
| HTTP_426 | Upgrade Required |
| HTTP_500 | Internal Server Error |
| HTTP_501 | Not Implemented |
| HTTP_502 | Bad Gateway |
| HTTP_503 | Service Unavailable |
| HTTP_504 | Gateway Timeout |
| HTTP_505 | HTTP Version Not Supported |
| HTTP_507 | Insufficient Storage |
Code examples
// This example shows how to use the HTTP library to response to an incomming HTTP request.
// The class itself is a subclass of USocket (for receiving data) and UHTTPParser
// (to check the request and only accept GET requests).
void MyApp::SocketRecvResult(ISocket * const socket, void * buf, size_t len) {
// parser is an HTTPParser instance of the object the function here is part of.
this->parser->ParseData(buf, len, this);
switch (this->parser->GetParseResult())
{
case HTTPParser::HTTP_PARSE_NEED_DATA:
// More data need for the header. Note that we must make a partial Recv() call here.
socket->Recv(buffer, 8192, true);
break;
case HTTPParser::HTTP_PARSE_ERROR:
debug->printf("Error while parsing the HTTP header.");
socket->Shutdown();
break;
case HTTPParser::HTTP_PARSE_CANCEL: // Unsupported request - see below
debug->printf("Parsing canceled.");
socket->Shutdown();
break;
case HTTPParser::HTTP_PARSE_DONE:
this->ResponseGETRequest(socket);
break;
}
}
// The callback function from UHTTPParser. We only accept GET requests...
bool MyApp::HTTPParserValidateRequest(class HTTPParser * httpParser)
{
if (httpParser->GetRequestMethod()) == HTTPLib::HTTP_GET) return true;
debug->printf("Only GET requests are supported.");
return false;
}
void MyApp::ResponseGETRequest(ISocket * socket)
{
const char * responseData = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><body>Hello World</body></html>"
size_t responseLen = strlen(responseData);
// Use the object on the stack - no need to delete it later.
HTTPHeader header;
header.SetHTTPVersion(this->parser->GetMajorVersion(), this->parser->GetMinorVersion());
header.SetHTTPResult(&HTTPLib::HTTP_200);
header.SetContentSize(responseLen);
// Finally - send everything.
socket->Send(header.GetHeaderData(), header.GetHeaderSize());
socket->Send(responseData, responseLen);
}